From: Alexander Shishkov Date: Fri, 2 Mar 2012 18:06:15 +0000 (+0000) Subject: fixed #1645 X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~5430 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=defbdcba77cff5dceb60fe430095640afc782f85;p=platform%2Fupstream%2Fopencv.git fixed #1645 --- diff --git a/doc/tutorials/core/mat-mask-operations/mat-mask-operations.rst b/doc/tutorials/core/mat-mask-operations/mat-mask-operations.rst index 17ac1d0..7972610 100644 --- a/doc/tutorials/core/mat-mask-operations/mat-mask-operations.rst +++ b/doc/tutorials/core/mat-mask-operations/mat-mask-operations.rst @@ -3,7 +3,7 @@ Mask operations on matrices *************************** -Mask operations on matrices are quite simple. The idea is that we recalculate each pixels value in an image according to a mask matrix (also known as kernel). This mask holds values that will just how much influence have neighbor pixel values (and the pixel value itself) to the new pixel value. From a mathematical point of view we make a weighted average, with our specified values. +Mask operations on matrices are quite simple. The idea is that we recalculate each pixels value in an image according to a mask matrix (also known as kernel). This mask holds values that will adjust how much influence neighboring pixels (and the current pixel) have on the new pixel value. From a mathematical point of view we make a weighted average, with our specified values. Our test case ============= @@ -21,7 +21,7 @@ Let us consider the issue of an image contrast enhancement method. Basically we +1 & 0 & -1 & 0 \cr } -The first notation is by using a formula, while the second is a compacted version of the first by using a mask. You use the mask by putting the center of the mask matrix (in the upper case noted by the zero-zero index) on the pixel you want to calculate and sum up the pixel values multiplicity with the overlapped matrix values. It's the same thing, however in case of large matrices the later notation is a lot easier to look over. +The first notation is by using a formula, while the second is a compacted version of the first by using a mask. You use the mask by putting the center of the mask matrix (in the upper case noted by the zero-zero index) on the pixel you want to calculate and sum up the pixel values multiplied with the overlapped matrix values. It's the same thing, however in case of large matrices the latter notation is a lot easier to look over. Now let us see how we can make this happen by using the basic pixel access method or by using the :filtering:`filter2D ` function. @@ -66,7 +66,7 @@ At first we make sure that the input images data is in unsigned char format. For CV_Assert(myImage.depth() == CV_8U); // accept only uchar images -We create an output image with the same size and the same type than our input. As you can see at the :ref:`How_Image_Stored_Memory` section, depending on the number of channels we may have one or more subcolumns. We will iterate through them via pointers so the total number of elements depends from this number. +We create an output image with the same size and the same type as our input. As you can see in the :ref:`How_Image_Stored_Memory` section, depending on the number of channels we may have one or more subcolumns. We will iterate through them via pointers so the total number of elements depends from this number. .. code-block:: cpp @@ -92,7 +92,7 @@ We'll use the plain C [] operator to access pixels. Because we need to access mu } } -On the borders of the image the upper notation results inexistent pixel locations (like minus one - minus one). In these points our formula is undefined. A simple solution is to do not apply the mask in these points and, for example, set the pixels on the borders to zeros: +On the borders of the image the upper notation results inexistent pixel locations (like minus one - minus one). In these points our formula is undefined. A simple solution is to not apply the mask in these points and, for example, set the pixels on the borders to zeros: .. code-block:: cpp @@ -118,7 +118,7 @@ Then call the :filtering:`filter2D ` function specifying the input, th filter2D(I, K, I.depth(), kern ); -The function even has a fifth optional argument to specify the center of the kernel, and a sixth one for determining what to do in the regions where the operation is undefined (borders). Using this function has the advantage that it's shorter, less verbose and that because they are some optimization techniques implemented usually faster than the *hand method*. For example in my test while the second one took only 13 milliseconds the first took around 31 milliseconds. Quite some difference. +The function even has a fifth optional argument to specify the center of the kernel, and a sixth one for determining what to do in the regions where the operation is undefined (borders). Using this function has the advantage that it's shorter, less verbose and because there are some optimization techniques implemented it is usually faster than the *hand-coded method*. For example in my test while the second one took only 13 milliseconds the first took around 31 milliseconds. Quite some difference. For example: