From b6ab96ae0bb3ea4b16008af7682b53112bce31c2 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Tue, 27 Mar 2012 14:58:46 +0000 Subject: [PATCH] added special notice about the missing saturation in 32s case (ticket #1529) --- modules/core/doc/intro.rst | 2 ++ modules/core/doc/operations_on_arrays.rst | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/modules/core/doc/intro.rst b/modules/core/doc/intro.rst index 670a4aa..fac19ae 100644 --- a/modules/core/doc/intro.rst +++ b/modules/core/doc/intro.rst @@ -149,6 +149,8 @@ Similar rules are applied to 8-bit signed, 16-bit signed and unsigned types. Thi where ``cv::uchar`` is an OpenCV 8-bit unsigned integer type. In the optimized SIMD code, such SSE2 instructions as ``paddusb``, ``packuswb``, and so on are used. They help achieve exactly the same behavior as in C++ code. +.. note:: Saturation is not applied when the result is 32-bit integer. + Fixed Pixel Types. Limited Use of Templates ------------------------------------------- diff --git a/modules/core/doc/operations_on_arrays.rst b/modules/core/doc/operations_on_arrays.rst index c8e3de7..e224aa7 100644 --- a/modules/core/doc/operations_on_arrays.rst +++ b/modules/core/doc/operations_on_arrays.rst @@ -69,6 +69,7 @@ The function ``absdiff`` computes: where ``I`` is a multi-dimensional index of array elements. In case of multi-channel arrays, each channel is processed independently. +.. note:: Saturation is not applied when the arrays have the depth ``CV_32S``. You may even get a negative value in the case of overflow. .. seealso:: :ocv:func:`abs` @@ -129,6 +130,8 @@ The first function in the list above can be replaced with matrix expressions: :: The input arrays and the destination array can all have the same or different depths. For example, you can add a 16-bit unsigned array to a 8-bit signed array and store the sum as a 32-bit floating-point array. Depth of the output array is determined by the ``dtype`` parameter. In the second and third cases above, as well as in the first case, when ``src1.depth() == src2.depth()``, ``dtype`` can be set to the default ``-1``. In this case, the output array will have the same depth as the input array, be it ``src1``, ``src2`` or both. +.. note:: Saturation is not applied when the output array has the depth ``CV_32S``. You may even get result of an incorrect sign in the case of overflow. + .. seealso:: :ocv:func:`subtract`, @@ -176,6 +179,7 @@ The function can be replaced with a matrix expression: :: dst = src1*alpha + src2*beta + gamma; +.. note:: Saturation is not applied when the output array has the depth ``CV_32S``. You may even get result of an incorrect sign in the case of overflow. .. seealso:: @@ -998,6 +1002,8 @@ or a scalar by an array when there is no ``src1`` : When ``src2(I)`` is zero, ``dst(I)`` will also be zero. Different channels of multi-channel arrays are processed independently. +.. note:: Saturation is not applied when the output array has the depth ``CV_32S``. You may even get result of an incorrect sign in the case of overflow. + .. seealso:: :ocv:func:`multiply`, @@ -1955,6 +1961,8 @@ There is also a For a not-per-element matrix product, see :ocv:func:`gemm` . +.. note:: Saturation is not applied when the output array has the depth ``CV_32S``. You may even get result of an incorrect sign in the case of overflow. + .. seealso:: :ocv:func:`add`, @@ -3097,6 +3105,8 @@ The first function in the list above can be replaced with matrix expressions: :: The input arrays and the destination array can all have the same or different depths. For example, you can subtract to 8-bit unsigned arrays and store the difference in a 16-bit signed array. Depth of the output array is determined by ``dtype`` parameter. In the second and third cases above, as well as in the first case, when ``src1.depth() == src2.depth()``, ``dtype`` can be set to the default ``-1``. In this case the output array will have the same depth as the input array, be it ``src1``, ``src2`` or both. +.. note:: Saturation is not applied when the output array has the depth ``CV_32S``. You may even get result of an incorrect sign in the case of overflow. + .. seealso:: :ocv:func:`add`, -- 2.7.4