From 3c137f7a0429e2c946417304d8a5595228984f59 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Wed, 21 Aug 2013 18:52:15 +0400 Subject: [PATCH] Converted tabs to spaces. --- cmake/checks/win32uitest.cpp | 10 +- cmake/checks/winrttest.cpp | 2 +- doc/opencv_cheatsheet.tex | 10 +- .../basic_geometric_drawing.rst | 146 +++++------ .../corner_subpixeles/corner_subpixeles.rst | 16 +- .../harris_detector/harris_detector.rst | 26 +- .../erosion_dilatation/erosion_dilatation.rst | 44 ++-- .../back_projection/back_projection.rst | 2 +- .../imgproc/imgtrans/remap/remap.rst | 84 +++--- .../opening_closing_hats.rst | 16 +- doc/tutorials/imgproc/threshold/threshold.rst | 18 +- .../windows_visual_studio_image_watch.rst | 12 +- doc/tutorials/ios/hello/hello.rst | 6 +- .../ios/video_processing/video_processing.rst | 166 ++++++------ modules/core/src/stat.cpp | 212 ++++++++-------- modules/highgui/src/cap_ffmpeg.cpp | 6 +- modules/highgui/src/cap_ffmpeg_impl.hpp | 14 +- modules/imgproc/src/morph.cpp | 240 +++++++++--------- modules/imgproc/src/sumpixels.cpp | 86 +++---- modules/java/android_test/AndroidManifest.xml | 2 +- modules/ocl/perf/perf_calib3d.cpp | 54 ++-- modules/ocl/perf/perf_precomp.hpp | 48 ++-- modules/ocl/src/interpolate_frames.cpp | 2 +- modules/ocl/src/opencl/objdetect_hog.cl | 72 +++--- modules/ocl/src/opencl/tvl1flow.cl | 76 +++--- modules/ocl/src/stereobp.cpp | 2 +- .../MacOSX/FaceTracker/FaceTracker-Info.plist | 28 +- samples/c/build_all.sh | 22 +- .../MediaExtensions/Common/CritSec.h | 10 +- .../OcvTransform/OcvImageManipulations.idl | 6 +- .../OcvTransform/OcvTransform.cpp | 28 +- .../MediaExtensions/OcvTransform/dllmain.cpp | 2 +- .../common/LayoutAwarePage.cpp | 42 +-- 33 files changed, 755 insertions(+), 755 deletions(-) mode change 100755 => 100644 samples/c/build_all.sh diff --git a/cmake/checks/win32uitest.cpp b/cmake/checks/win32uitest.cpp index 6f13a09cc..f475e1c96 100644 --- a/cmake/checks/win32uitest.cpp +++ b/cmake/checks/win32uitest.cpp @@ -2,10 +2,10 @@ int main(int argc, char** argv) { - CreateWindow(NULL /*lpClassName*/, NULL /*lpWindowName*/, 0 /*dwStyle*/, 0 /*x*/, - 0 /*y*/, 0 /*nWidth*/, 0 /*nHeight*/, NULL /*hWndParent*/, NULL /*hMenu*/, - NULL /*hInstance*/, NULL /*lpParam*/); - DeleteDC(NULL); + CreateWindow(NULL /*lpClassName*/, NULL /*lpWindowName*/, 0 /*dwStyle*/, 0 /*x*/, + 0 /*y*/, 0 /*nWidth*/, 0 /*nHeight*/, NULL /*hWndParent*/, NULL /*hMenu*/, + NULL /*hInstance*/, NULL /*lpParam*/); + DeleteDC(NULL); - return 0; + return 0; } diff --git a/cmake/checks/winrttest.cpp b/cmake/checks/winrttest.cpp index 6e15e1b36..9ec0c9ac1 100644 --- a/cmake/checks/winrttest.cpp +++ b/cmake/checks/winrttest.cpp @@ -2,5 +2,5 @@ int main(int, char**) { - return 0; + return 0; } diff --git a/doc/opencv_cheatsheet.tex b/doc/opencv_cheatsheet.tex index e76bd016e..fc0c0fa41 100644 --- a/doc/opencv_cheatsheet.tex +++ b/doc/opencv_cheatsheet.tex @@ -75,11 +75,11 @@ % if using A4 paper. (This probably isn't strictly necessary.) % If using another size paper, use default 1cm margins. \ifthenelse{\lengthtest { \paperwidth = 11in}} - { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} } - {\ifthenelse{ \lengthtest{ \paperwidth = 297mm}} - {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} } - {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} } - } + { \geometry{top=.5in,left=.5in,right=.5in,bottom=.5in} } + {\ifthenelse{ \lengthtest{ \paperwidth = 297mm}} + {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} } + {\geometry{top=1cm,left=1cm,right=1cm,bottom=1cm} } + } % Turn off header and footer % \pagestyle{empty} diff --git a/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst b/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst index 3bd3237b7..d9c681ed4 100644 --- a/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst +++ b/doc/tutorials/core/basic_geometric_drawing/basic_geometric_drawing.rst @@ -99,11 +99,11 @@ Explanation /// 2.b. Creating rectangles rectangle( rook_image, - Point( 0, 7*w/8.0 ), - Point( w, w), - Scalar( 0, 255, 255 ), - -1, - 8 ); + Point( 0, 7*w/8.0 ), + Point( w, w), + Scalar( 0, 255, 255 ), + -1, + 8 ); /// 2.c. Create a few lines MyLine( rook_image, Point( 0, 15*w/16 ), Point( w, 15*w/16 ) ); @@ -118,16 +118,16 @@ Explanation .. code-block:: cpp void MyLine( Mat img, Point start, Point end ) - { - int thickness = 2; - int lineType = 8; - line( img, - start, - end, - Scalar( 0, 0, 0 ), - thickness, - lineType ); - } + { + int thickness = 2; + int lineType = 8; + line( img, + start, + end, + Scalar( 0, 0, 0 ), + thickness, + lineType ); + } As we can see, *MyLine* just call the function :line:`line <>`, which does the following: @@ -145,18 +145,18 @@ Explanation void MyEllipse( Mat img, double angle ) { - int thickness = 2; - int lineType = 8; + int thickness = 2; + int lineType = 8; - ellipse( img, - Point( w/2.0, w/2.0 ), - Size( w/4.0, w/16.0 ), - angle, - 0, - 360, - Scalar( 255, 0, 0 ), - thickness, - lineType ); + ellipse( img, + Point( w/2.0, w/2.0 ), + Size( w/4.0, w/16.0 ), + angle, + 0, + 360, + Scalar( 255, 0, 0 ), + thickness, + lineType ); } From the code above, we can observe that the function :ellipse:`ellipse <>` draws an ellipse such that: @@ -176,17 +176,17 @@ Explanation .. code-block:: cpp void MyFilledCircle( Mat img, Point center ) - { - int thickness = -1; - int lineType = 8; + { + int thickness = -1; + int lineType = 8; - circle( img, - center, - w/32.0, - Scalar( 0, 0, 255 ), - thickness, - lineType ); - } + circle( img, + center, + w/32.0, + Scalar( 0, 0, 255 ), + thickness, + lineType ); + } Similar to the ellipse function, we can observe that *circle* receives as arguments: @@ -203,41 +203,41 @@ Explanation .. code-block:: cpp void MyPolygon( Mat img ) - { - int lineType = 8; + { + int lineType = 8; - /** Create some points */ - Point rook_points[1][20]; - rook_points[0][0] = Point( w/4.0, 7*w/8.0 ); - rook_points[0][1] = Point( 3*w/4.0, 7*w/8.0 ); - rook_points[0][2] = Point( 3*w/4.0, 13*w/16.0 ); - rook_points[0][3] = Point( 11*w/16.0, 13*w/16.0 ); - rook_points[0][4] = Point( 19*w/32.0, 3*w/8.0 ); - rook_points[0][5] = Point( 3*w/4.0, 3*w/8.0 ); - rook_points[0][6] = Point( 3*w/4.0, w/8.0 ); - rook_points[0][7] = Point( 26*w/40.0, w/8.0 ); - rook_points[0][8] = Point( 26*w/40.0, w/4.0 ); - rook_points[0][9] = Point( 22*w/40.0, w/4.0 ); - rook_points[0][10] = Point( 22*w/40.0, w/8.0 ); - rook_points[0][11] = Point( 18*w/40.0, w/8.0 ); - rook_points[0][12] = Point( 18*w/40.0, w/4.0 ); - rook_points[0][13] = Point( 14*w/40.0, w/4.0 ); - rook_points[0][14] = Point( 14*w/40.0, w/8.0 ); - rook_points[0][15] = Point( w/4.0, w/8.0 ); - rook_points[0][16] = Point( w/4.0, 3*w/8.0 ); - rook_points[0][17] = Point( 13*w/32.0, 3*w/8.0 ); - rook_points[0][18] = Point( 5*w/16.0, 13*w/16.0 ); - rook_points[0][19] = Point( w/4.0, 13*w/16.0) ; + /** Create some points */ + Point rook_points[1][20]; + rook_points[0][0] = Point( w/4.0, 7*w/8.0 ); + rook_points[0][1] = Point( 3*w/4.0, 7*w/8.0 ); + rook_points[0][2] = Point( 3*w/4.0, 13*w/16.0 ); + rook_points[0][3] = Point( 11*w/16.0, 13*w/16.0 ); + rook_points[0][4] = Point( 19*w/32.0, 3*w/8.0 ); + rook_points[0][5] = Point( 3*w/4.0, 3*w/8.0 ); + rook_points[0][6] = Point( 3*w/4.0, w/8.0 ); + rook_points[0][7] = Point( 26*w/40.0, w/8.0 ); + rook_points[0][8] = Point( 26*w/40.0, w/4.0 ); + rook_points[0][9] = Point( 22*w/40.0, w/4.0 ); + rook_points[0][10] = Point( 22*w/40.0, w/8.0 ); + rook_points[0][11] = Point( 18*w/40.0, w/8.0 ); + rook_points[0][12] = Point( 18*w/40.0, w/4.0 ); + rook_points[0][13] = Point( 14*w/40.0, w/4.0 ); + rook_points[0][14] = Point( 14*w/40.0, w/8.0 ); + rook_points[0][15] = Point( w/4.0, w/8.0 ); + rook_points[0][16] = Point( w/4.0, 3*w/8.0 ); + rook_points[0][17] = Point( 13*w/32.0, 3*w/8.0 ); + rook_points[0][18] = Point( 5*w/16.0, 13*w/16.0 ); + rook_points[0][19] = Point( w/4.0, 13*w/16.0) ; - const Point* ppt[1] = { rook_points[0] }; - int npt[] = { 20 }; + const Point* ppt[1] = { rook_points[0] }; + int npt[] = { 20 }; - fillPoly( img, - ppt, - npt, - 1, - Scalar( 255, 255, 255 ), - lineType ); + fillPoly( img, + ppt, + npt, + 1, + Scalar( 255, 255, 255 ), + lineType ); } To draw a filled polygon we use the function :fill_poly:`fillPoly <>`. We note that: @@ -255,11 +255,11 @@ Explanation .. code-block:: cpp rectangle( rook_image, - Point( 0, 7*w/8.0 ), - Point( w, w), - Scalar( 0, 255, 255 ), - -1, - 8 ); + Point( 0, 7*w/8.0 ), + Point( w, w), + Scalar( 0, 255, 255 ), + -1, + 8 ); Finally we have the :rectangle:`rectangle <>` function (we did not create a special function for this guy). We note that: diff --git a/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst b/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst index 0c5aedbcc..a0f184a23 100644 --- a/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst +++ b/doc/tutorials/features2d/trackingmotion/corner_subpixeles/corner_subpixeles.rst @@ -87,14 +87,14 @@ This tutorial code's is shown lines below. You can also download it from `here < /// Apply corner detection goodFeaturesToTrack( src_gray, - corners, - maxCorners, - qualityLevel, - minDistance, - Mat(), - blockSize, - useHarrisDetector, - k ); + corners, + maxCorners, + qualityLevel, + minDistance, + Mat(), + blockSize, + useHarrisDetector, + k ); /// Draw corners detected diff --git a/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst b/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst index 2c3cb14aa..8eb72ebfd 100644 --- a/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst +++ b/doc/tutorials/features2d/trackingmotion/harris_detector/harris_detector.rst @@ -98,16 +98,16 @@ How does it work? u & v \end{bmatrix} \left ( - \displaystyle \sum_{x,y} + \displaystyle \sum_{x,y} w(x,y) \begin{bmatrix} I_x^{2} & I_{x}I_{y} \\ I_xI_{y} & I_{y}^{2} - \end{bmatrix} - \right ) - \begin{bmatrix} + \end{bmatrix} + \right ) + \begin{bmatrix} u \\ - v + v \end{bmatrix} * Let's denote: @@ -115,11 +115,11 @@ How does it work? .. math:: M = \displaystyle \sum_{x,y} - w(x,y) - \begin{bmatrix} - I_x^{2} & I_{x}I_{y} \\ - I_xI_{y} & I_{y}^{2} - \end{bmatrix} + w(x,y) + \begin{bmatrix} + I_x^{2} & I_{x}I_{y} \\ + I_xI_{y} & I_{y}^{2} + \end{bmatrix} * So, our equation now is: @@ -128,10 +128,10 @@ How does it work? E(u,v) \approx \begin{bmatrix} u & v \end{bmatrix} - M - \begin{bmatrix} + M + \begin{bmatrix} u \\ - v + v \end{bmatrix} diff --git a/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst b/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst index 9bd460d15..300327aba 100644 --- a/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst +++ b/doc/tutorials/imgproc/erosion_dilatation/erosion_dilatation.rst @@ -112,21 +112,21 @@ This tutorial code's is shown lines below. You can also download it from `here < /// Create Erosion Trackbar createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Erosion Demo", - &erosion_elem, max_elem, - Erosion ); + &erosion_elem, max_elem, + Erosion ); createTrackbar( "Kernel size:\n 2n +1", "Erosion Demo", - &erosion_size, max_kernel_size, - Erosion ); + &erosion_size, max_kernel_size, + Erosion ); /// Create Dilation Trackbar createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Dilation Demo", - &dilation_elem, max_elem, - Dilation ); + &dilation_elem, max_elem, + Dilation ); createTrackbar( "Kernel size:\n 2n +1", "Dilation Demo", - &dilation_size, max_kernel_size, - Dilation ); + &dilation_size, max_kernel_size, + Dilation ); /// Default start Erosion( 0, 0 ); @@ -145,8 +145,8 @@ This tutorial code's is shown lines below. You can also download it from `here < else if( erosion_elem == 2) { erosion_type = MORPH_ELLIPSE; } Mat element = getStructuringElement( erosion_type, - Size( 2*erosion_size + 1, 2*erosion_size+1 ), - Point( erosion_size, erosion_size ) ); + Size( 2*erosion_size + 1, 2*erosion_size+1 ), + Point( erosion_size, erosion_size ) ); /// Apply the erosion operation erode( src, erosion_dst, element ); @@ -162,8 +162,8 @@ This tutorial code's is shown lines below. You can also download it from `here < else if( dilation_elem == 2) { dilation_type = MORPH_ELLIPSE; } Mat element = getStructuringElement( dilation_type, - Size( 2*dilation_size + 1, 2*dilation_size+1 ), - Point( dilation_size, dilation_size ) ); + Size( 2*dilation_size + 1, 2*dilation_size+1 ), + Point( dilation_size, dilation_size ) ); /// Apply the dilation operation dilate( src, dilation_dst, element ); imshow( "Dilation Demo", dilation_dst ); @@ -201,8 +201,8 @@ Explanation else if( erosion_elem == 2) { erosion_type = MORPH_ELLIPSE; } Mat element = getStructuringElement( erosion_type, - Size( 2*erosion_size + 1, 2*erosion_size+1 ), - Point( erosion_size, erosion_size ) ); + Size( 2*erosion_size + 1, 2*erosion_size+1 ), + Point( erosion_size, erosion_size ) ); /// Apply the erosion operation erode( src, erosion_dst, element ); imshow( "Erosion Demo", erosion_dst ); @@ -216,17 +216,17 @@ Explanation .. code-block:: cpp - Mat element = getStructuringElement( erosion_type, - Size( 2*erosion_size + 1, 2*erosion_size+1 ), - Point( erosion_size, erosion_size ) ); + Mat element = getStructuringElement( erosion_type, + Size( 2*erosion_size + 1, 2*erosion_size+1 ), + Point( erosion_size, erosion_size ) ); We can choose any of three shapes for our kernel: .. container:: enumeratevisibleitemswithsquare - + Rectangular box: MORPH_RECT - + Cross: MORPH_CROSS - + Ellipse: MORPH_ELLIPSE + + Rectangular box: MORPH_RECT + + Cross: MORPH_CROSS + + Ellipse: MORPH_ELLIPSE Then, we just have to specify the size of our kernel and the *anchor point*. If not specified, it is assumed to be in the center. @@ -251,8 +251,8 @@ The code is below. As you can see, it is completely similar to the snippet of co else if( dilation_elem == 2) { dilation_type = MORPH_ELLIPSE; } Mat element = getStructuringElement( dilation_type, - Size( 2*dilation_size + 1, 2*dilation_size+1 ), - Point( dilation_size, dilation_size ) ); + Size( 2*dilation_size + 1, 2*dilation_size+1 ), + Point( dilation_size, dilation_size ) ); /// Apply the dilation operation dilate( src, dilation_dst, element ); imshow( "Dilation Demo", dilation_dst ); diff --git a/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst b/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst index f8b134322..923137263 100644 --- a/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst +++ b/doc/tutorials/imgproc/histograms/back_projection/back_projection.rst @@ -94,7 +94,7 @@ Code * Loads an image * Convert the original to HSV format and separate only *Hue* channel to be used for the Histogram (using the OpenCV function :mix_channels:`mixChannels <>`) * Let the user to enter the number of bins to be used in the calculation of the histogram. - * Calculate the histogram (and update it if the bins change) and the backprojection of the same image. + * Calculate the histogram (and update it if the bins change) and the backprojection of the same image. * Display the backprojection and the histogram in windows. * **Downloadable code**: diff --git a/doc/tutorials/imgproc/imgtrans/remap/remap.rst b/doc/tutorials/imgproc/imgtrans/remap/remap.rst index b86897ba9..c4a6671fa 100644 --- a/doc/tutorials/imgproc/imgtrans/remap/remap.rst +++ b/doc/tutorials/imgproc/imgtrans/remap/remap.rst @@ -124,34 +124,34 @@ Code for( int j = 0; j < src.rows; j++ ) { for( int i = 0; i < src.cols; i++ ) - { + { switch( ind ) - { - case 0: - if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 ) + { + case 0: + if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 ) { - map_x.at(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ; - map_y.at(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ; - } - else - { map_x.at(j,i) = 0 ; - map_y.at(j,i) = 0 ; + map_x.at(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ; + map_y.at(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ; + } + else + { map_x.at(j,i) = 0 ; + map_y.at(j,i) = 0 ; } break; - case 1: - map_x.at(j,i) = i ; - map_y.at(j,i) = src.rows - j ; - break; + case 1: + map_x.at(j,i) = i ; + map_y.at(j,i) = src.rows - j ; + break; case 2: - map_x.at(j,i) = src.cols - i ; - map_y.at(j,i) = j ; - break; + map_x.at(j,i) = src.cols - i ; + map_y.at(j,i) = j ; + break; case 3: - map_x.at(j,i) = src.cols - i ; - map_y.at(j,i) = src.rows - j ; - break; + map_x.at(j,i) = src.cols - i ; + map_y.at(j,i) = src.rows - j ; + break; } // end of switch - } + } } ind++; } @@ -241,34 +241,34 @@ Explanation for( int j = 0; j < src.rows; j++ ) { for( int i = 0; i < src.cols; i++ ) - { + { switch( ind ) - { - case 0: - if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 ) + { + case 0: + if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 ) { - map_x.at(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ; - map_y.at(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ; - } - else - { map_x.at(j,i) = 0 ; - map_y.at(j,i) = 0 ; + map_x.at(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ; + map_y.at(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ; + } + else + { map_x.at(j,i) = 0 ; + map_y.at(j,i) = 0 ; } break; - case 1: - map_x.at(j,i) = i ; - map_y.at(j,i) = src.rows - j ; - break; + case 1: + map_x.at(j,i) = i ; + map_y.at(j,i) = src.rows - j ; + break; case 2: - map_x.at(j,i) = src.cols - i ; - map_y.at(j,i) = j ; - break; + map_x.at(j,i) = src.cols - i ; + map_y.at(j,i) = j ; + break; case 3: - map_x.at(j,i) = src.cols - i ; - map_y.at(j,i) = src.rows - j ; - break; + map_x.at(j,i) = src.cols - i ; + map_y.at(j,i) = src.rows - j ; + break; } // end of switch - } + } } ind++; } diff --git a/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst b/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst index 113200506..9cb14ab02 100644 --- a/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst +++ b/doc/tutorials/imgproc/opening_closing_hats/opening_closing_hats.rst @@ -154,13 +154,13 @@ This tutorial code's is shown lines below. You can also download it from `here < /// Create Trackbar to select kernel type createTrackbar( "Element:\n 0: Rect - 1: Cross - 2: Ellipse", window_name, - &morph_elem, max_elem, - Morphology_Operations ); + &morph_elem, max_elem, + Morphology_Operations ); /// Create Trackbar to choose kernel size createTrackbar( "Kernel size:\n 2n +1", window_name, - &morph_size, max_kernel_size, - Morphology_Operations ); + &morph_size, max_kernel_size, + Morphology_Operations ); /// Default start Morphology_Operations( 0, 0 ); @@ -211,16 +211,16 @@ Explanation .. code-block:: cpp createTrackbar( "Element:\n 0: Rect - 1: Cross - 2: Ellipse", window_name, - &morph_elem, max_elem, - Morphology_Operations ); + &morph_elem, max_elem, + Morphology_Operations ); * The final trackbar **"Kernel Size"** returns the size of the kernel to be used (**morph_size**) .. code-block:: cpp createTrackbar( "Kernel size:\n 2n +1", window_name, - &morph_size, max_kernel_size, - Morphology_Operations ); + &morph_size, max_kernel_size, + Morphology_Operations ); * Every time we move any slider, the user's function **Morphology_Operations** will be called to effectuate a new morphology operation and it will update the output image based on the current trackbar values. diff --git a/doc/tutorials/imgproc/threshold/threshold.rst b/doc/tutorials/imgproc/threshold/threshold.rst index 7788e6c51..889ec1154 100644 --- a/doc/tutorials/imgproc/threshold/threshold.rst +++ b/doc/tutorials/imgproc/threshold/threshold.rst @@ -174,12 +174,12 @@ The tutorial code's is shown lines below. You can also download it from `here Other Windows --> Image Watch`. Like Visual Studio's *Locals* window, Image Watch can dock to the Visual Studio IDE. Also, Visual Studio will remember whether you had Image Watch open, and where it was located between debugging sessions. This means you only have to do this once--the next time you start debugging, Image Watch will be back where you left it. Here's what the docked Image Watch window looks like at our breakpoint: .. image:: images/toolwindow.jpg - :height: 320pt + :height: 320pt The radio button at the top left (*Locals/Watch*) selects what is shown in the *Image List* below: *Locals* lists all OpenCV image objects in the current scope (this list is automatically populated). *Watch* shows image expressions that have been pinned for continuous inspection (not described here, see `Image Watch documentation `_ for details). The image list shows basic information such as width, height, number of channels, and, if available, a thumbnail. In our example, the image list contains our two local image variables, *input* and *edges*. If an image has a thumbnail, left-clicking on that image will select it for detailed viewing in the *Image Viewer* on the right. The viewer lets you pan (drag mouse) and zoom (mouse wheel). It also displays the pixel coordinate and value at the current mouse position. .. image:: images/viewer.jpg - :height: 160pt + :height: 160pt Note that the second image in the list, *edges*, is shown as "invalid". This indicates that some data members of this image object have corrupt or invalid values (for example, a negative image width). This is expected at this point in the program, since the C++ constructor for *edges* has not run yet, and so its members have undefined values (in debug mode they are usually filled with "0xCD" bytes). @@ -113,17 +113,17 @@ From here you can single-step through your code (:menuselection:`Debug->Step Ove Now assume you want to do a visual sanity check of the *cv::Canny()* implementation. Bring the *edges* image into the viewer by selecting it in the *Image List* and zoom into a region with a clearly defined edge: .. image:: images/edges_zoom.png - :height: 160pt + :height: 160pt Right-click on the *Image Viewer* to bring up the view context menu and enable :menuselection:`Link Views` (a check box next to the menu item indicates whether the option is enabled). .. image:: images/viewer_context_menu.png - :height: 120pt + :height: 120pt The :menuselection:`Link Views` feature keeps the view region fixed when flipping between images of the same size. To see how this works, select the input image from the image list--you should now see the corresponding zoomed-in region in the input image: .. image:: images/input_zoom.png - :height: 160pt + :height: 160pt You may also switch back and forth between viewing input and edges with your up/down cursor keys. That way you can easily verify that the detected edges line up nicely with the data in the input image. @@ -141,4 +141,4 @@ Image watch has a number of more advanced features, such as Please refer to the online `Image Watch Documentation `_ for details--you also can get to the documentation page by clicking on the *Help* link in the Image Watch window: .. image:: images/help_button.jpg - :height: 80pt + :height: 80pt diff --git a/doc/tutorials/ios/hello/hello.rst b/doc/tutorials/ios/hello/hello.rst index 196b88de9..a7ca1f6f0 100644 --- a/doc/tutorials/ios/hello/hello.rst +++ b/doc/tutorials/ios/hello/hello.rst @@ -43,9 +43,9 @@ Now we will learn how to write a simple Hello World Application in Xcode using O .. code-block:: cpp - #ifdef __cplusplus - #import - #endif + #ifdef __cplusplus + #import + #endif .. image:: images/header_directive.png :alt: header diff --git a/doc/tutorials/ios/video_processing/video_processing.rst b/doc/tutorials/ios/video_processing/video_processing.rst index 4d8116a4c..bd83ace75 100644 --- a/doc/tutorials/ios/video_processing/video_processing.rst +++ b/doc/tutorials/ios/video_processing/video_processing.rst @@ -17,32 +17,32 @@ Including OpenCV library in your iOS project The OpenCV library comes as a so-called framework, which you can directly drag-and-drop into your XCode project. Download the latest binary from . Alternatively follow this guide :ref:`iOS-Installation` to compile the framework manually. Once you have the framework, just drag-and-drop into XCode: - .. image:: images/xcode_hello_ios_framework_drag_and_drop.png + .. image:: images/xcode_hello_ios_framework_drag_and_drop.png Also you have to locate the prefix header that is used for all header files in the project. The file is typically located at "ProjectName/Supporting Files/ProjectName-Prefix.pch". There, you have add an include statement to import the opencv library. However, make sure you include opencv before you include UIKit and Foundation, because else you will get some weird compile errors that some macros like min and max are defined multiple times. For example the prefix header could look like the following: .. code-block:: objc - :linenos: + :linenos: - // - // Prefix header for all source files of the 'VideoFilters' target in the 'VideoFilters' project - // + // + // Prefix header for all source files of the 'VideoFilters' target in the 'VideoFilters' project + // - #import + #import - #ifndef __IPHONE_4_0 - #warning "This project uses features only available in iOS SDK 4.0 and later." - #endif + #ifndef __IPHONE_4_0 + #warning "This project uses features only available in iOS SDK 4.0 and later." + #endif - #ifdef __cplusplus - #import - #endif + #ifdef __cplusplus + #import + #endif - #ifdef __OBJC__ - #import - #import - #endif + #ifdef __OBJC__ + #import + #import + #endif @@ -53,23 +53,23 @@ User Interface First, we create a simple iOS project, for example Single View Application. Then, we create and add an UIImageView and UIButton to start the camera and display the video frames. The storyboard could look like that: - .. image:: images/xcode_hello_ios_viewcontroller_layout.png + .. image:: images/xcode_hello_ios_viewcontroller_layout.png Make sure to add and connect the IBOutlets and IBActions to the corresponding ViewController: .. code-block:: objc - :linenos: + :linenos: - @interface ViewController : UIViewController - { - IBOutlet UIImageView* imageView; - IBOutlet UIButton* button; - } + @interface ViewController : UIViewController + { + IBOutlet UIImageView* imageView; + IBOutlet UIButton* button; + } - - (IBAction)actionStart:(id)sender; + - (IBAction)actionStart:(id)sender; - @end + @end Adding the Camera @@ -78,37 +78,37 @@ Adding the Camera We add a camera controller to the view controller and initialize it when the view has loaded: .. code-block:: objc - :linenos: + :linenos: - #import - using namespace cv; + #import + using namespace cv; - @interface ViewController : UIViewController - { - ... - CvVideoCamera* videoCamera; - } - ... - @property (nonatomic, retain) CvVideoCamera* videoCamera; + @interface ViewController : UIViewController + { + ... + CvVideoCamera* videoCamera; + } + ... + @property (nonatomic, retain) CvVideoCamera* videoCamera; - @end + @end .. code-block:: objc - :linenos: + :linenos: - - (void)viewDidLoad - { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. + - (void)viewDidLoad + { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. - self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView]; - self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionFront; - self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288; - self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait; - self.videoCamera.defaultFPS = 30; - self.videoCamera.grayscale = NO; - } + self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView]; + self.videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionFront; + self.videoCamera.defaultAVCaptureSessionPreset = AVCaptureSessionPreset352x288; + self.videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait; + self.videoCamera.defaultFPS = 30; + self.videoCamera.grayscale = NO; + } In this case, we initialize the camera and provide the imageView as a target for rendering each frame. CvVideoCamera is basically a wrapper around AVFoundation, so we provie as properties some of the AVFoundation camera options. For example we want to use the front camera, set the video size to 352x288 and a video orientation (the video camera normally outputs in landscape mode, which results in transposed data when you design a portrait application). @@ -143,7 +143,7 @@ Additionally, we have to manually add framework dependencies of the opencv frame * Foundation - .. image:: images/xcode_hello_ios_frameworks_add_dependencies.png + .. image:: images/xcode_hello_ios_frameworks_add_dependencies.png Processing frames @@ -152,35 +152,35 @@ Processing frames We follow the delegation pattern, which is very common in iOS, to provide access to each camera frame. Basically, the View Controller has to implement the CvVideoCameraDelegate protocol and has to be set as delegate to the video camera: .. code-block:: objc - :linenos: + :linenos: - @interface ViewController : UIViewController + @interface ViewController : UIViewController .. code-block:: objc - :linenos: + :linenos: - - (void)viewDidLoad - { - ... - self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView]; - self.videoCamera.delegate = self; - ... - } + - (void)viewDidLoad + { + ... + self.videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView]; + self.videoCamera.delegate = self; + ... + } .. code-block:: objc - :linenos: + :linenos: - #pragma mark - Protocol CvVideoCameraDelegate + #pragma mark - Protocol CvVideoCameraDelegate - #ifdef __cplusplus - - (void)processImage:(Mat&)image; - { - // Do some OpenCV stuff with the image - } - #endif + #ifdef __cplusplus + - (void)processImage:(Mat&)image; + { + // Do some OpenCV stuff with the image + } + #endif Note that we are using C++ here (cv::Mat). Important: You have to rename the view controller's extension .m into .mm, so that the compiler compiles it under the assumption of Objective-C++ (Objective-C and C++ mixed). Then, __cplusplus is defined when the compiler is processing the file for C++ code. Therefore, we put our code within a block where __cplusplus is defined. @@ -193,18 +193,18 @@ From here you can start processing video frames. For example the following snipp .. code-block:: objc - :linenos: + :linenos: - - (void)processImage:(Mat&)image; - { - // Do some OpenCV stuff with the image - Mat image_copy; - cvtColor(image, image_copy, CV_BGRA2BGR); + - (void)processImage:(Mat&)image; + { + // Do some OpenCV stuff with the image + Mat image_copy; + cvtColor(image, image_copy, CV_BGRA2BGR); - // invert image - bitwise_not(image_copy, image_copy); - cvtColor(image_copy, image, CV_BGR2BGRA); - } + // invert image + bitwise_not(image_copy, image_copy); + cvtColor(image_copy, image, CV_BGR2BGRA); + } Start! @@ -213,14 +213,14 @@ Start! Finally, we have to tell the camera to actually start/stop working. The following code will start the camera when you press the button, assuming you connected the UI properly: .. code-block:: objc - :linenos: + :linenos: - #pragma mark - UI Actions + #pragma mark - UI Actions - - (IBAction)actionStart:(id)sender; - { - [self.videoCamera start]; - } + - (IBAction)actionStart:(id)sender; + { + [self.videoCamera start]; + } diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index d8ce658f0..447141c5d 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -455,41 +455,41 @@ cv::Scalar cv::sum( InputArray _src ) int k, cn = src.channels(), depth = src.depth(); #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - size_t total_size = src.total(); - int rows = src.size[0], cols = (int)(total_size/rows); - if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) ) - { - IppiSize sz = { cols, rows }; - int type = src.type(); - typedef IppStatus (CV_STDCALL* ippiSumFunc)(const void*, int, IppiSize, double *, int); - ippiSumFunc ippFunc = - type == CV_8UC1 ? (ippiSumFunc)ippiSum_8u_C1R : - type == CV_8UC3 ? (ippiSumFunc)ippiSum_8u_C3R : - type == CV_8UC4 ? (ippiSumFunc)ippiSum_8u_C4R : - type == CV_16UC1 ? (ippiSumFunc)ippiSum_16u_C1R : - type == CV_16UC3 ? (ippiSumFunc)ippiSum_16u_C3R : - type == CV_16UC4 ? (ippiSumFunc)ippiSum_16u_C4R : - type == CV_16SC1 ? (ippiSumFunc)ippiSum_16s_C1R : - type == CV_16SC3 ? (ippiSumFunc)ippiSum_16s_C3R : - type == CV_16SC4 ? (ippiSumFunc)ippiSum_16s_C4R : - type == CV_32FC1 ? (ippiSumFunc)ippiSum_32f_C1R : - type == CV_32FC3 ? (ippiSumFunc)ippiSum_32f_C3R : - type == CV_32FC4 ? (ippiSumFunc)ippiSum_32f_C4R : - 0; - if( ippFunc ) - { - Ipp64f res[4]; - if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 ) - { - Scalar sc; - for( int i = 0; i < cn; i++ ) - { - sc[i] = res[i]; - } - return sc; - } - } - } + size_t total_size = src.total(); + int rows = src.size[0], cols = (int)(total_size/rows); + if( src.dims == 2 || (src.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) ) + { + IppiSize sz = { cols, rows }; + int type = src.type(); + typedef IppStatus (CV_STDCALL* ippiSumFunc)(const void*, int, IppiSize, double *, int); + ippiSumFunc ippFunc = + type == CV_8UC1 ? (ippiSumFunc)ippiSum_8u_C1R : + type == CV_8UC3 ? (ippiSumFunc)ippiSum_8u_C3R : + type == CV_8UC4 ? (ippiSumFunc)ippiSum_8u_C4R : + type == CV_16UC1 ? (ippiSumFunc)ippiSum_16u_C1R : + type == CV_16UC3 ? (ippiSumFunc)ippiSum_16u_C3R : + type == CV_16UC4 ? (ippiSumFunc)ippiSum_16u_C4R : + type == CV_16SC1 ? (ippiSumFunc)ippiSum_16s_C1R : + type == CV_16SC3 ? (ippiSumFunc)ippiSum_16s_C3R : + type == CV_16SC4 ? (ippiSumFunc)ippiSum_16s_C4R : + type == CV_32FC1 ? (ippiSumFunc)ippiSum_32f_C1R : + type == CV_32FC3 ? (ippiSumFunc)ippiSum_32f_C3R : + type == CV_32FC4 ? (ippiSumFunc)ippiSum_32f_C4R : + 0; + if( ippFunc ) + { + Ipp64f res[4]; + if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 ) + { + Scalar sc; + for( int i = 0; i < cn; i++ ) + { + sc[i] = res[i]; + } + return sc; + } + } + } #endif SumFunc func = getSumFunc(depth); @@ -567,77 +567,77 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask ) int k, cn = src.channels(), depth = src.depth(); #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - size_t total_size = src.total(); - int rows = src.size[0], cols = (int)(total_size/rows); - if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) ) - { - IppiSize sz = { cols, rows }; - int type = src.type(); - if( !mask.empty() ) - { - typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *); - ippiMaskMeanFuncC1 ippFuncC1 = - type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR : - type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR : - type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR : - 0; - if( ippFuncC1 ) - { - Ipp64f res; - if( ippFuncC1(src.data, src.step[0], mask.data, mask.step[0], sz, &res) >= 0 ) - { - return Scalar(res); - } - } - typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *); - ippiMaskMeanFuncC3 ippFuncC3 = - type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR : - type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR : - type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR : - 0; - if( ippFuncC3 ) - { - Ipp64f res1, res2, res3; - if( ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 1, &res1) >= 0 && - ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 2, &res2) >= 0 && - ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 3, &res3) >= 0 ) - { - return Scalar(res1, res2, res3); - } - } - } - else - { - typedef IppStatus (CV_STDCALL* ippiMeanFunc)(const void*, int, IppiSize, double *, int); - ippiMeanFunc ippFunc = - type == CV_8UC1 ? (ippiMeanFunc)ippiMean_8u_C1R : - type == CV_8UC3 ? (ippiMeanFunc)ippiMean_8u_C3R : - type == CV_8UC4 ? (ippiMeanFunc)ippiMean_8u_C4R : - type == CV_16UC1 ? (ippiMeanFunc)ippiMean_16u_C1R : - type == CV_16UC3 ? (ippiMeanFunc)ippiMean_16u_C3R : - type == CV_16UC4 ? (ippiMeanFunc)ippiMean_16u_C4R : - type == CV_16SC1 ? (ippiMeanFunc)ippiMean_16s_C1R : - type == CV_16SC3 ? (ippiMeanFunc)ippiMean_16s_C3R : - type == CV_16SC4 ? (ippiMeanFunc)ippiMean_16s_C4R : - type == CV_32FC1 ? (ippiMeanFunc)ippiMean_32f_C1R : - type == CV_32FC3 ? (ippiMeanFunc)ippiMean_32f_C3R : - type == CV_32FC4 ? (ippiMeanFunc)ippiMean_32f_C4R : - 0; - if( ippFunc ) - { - Ipp64f res[4]; - if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 ) - { - Scalar sc; - for( int i = 0; i < cn; i++ ) - { - sc[i] = res[i]; - } - return sc; - } - } - } - } + size_t total_size = src.total(); + int rows = src.size[0], cols = (int)(total_size/rows); + if( src.dims == 2 || (src.isContinuous() && mask.isContinuous() && cols > 0 && (size_t)rows*cols == total_size) ) + { + IppiSize sz = { cols, rows }; + int type = src.type(); + if( !mask.empty() ) + { + typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *); + ippiMaskMeanFuncC1 ippFuncC1 = + type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR : + type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR : + type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR : + 0; + if( ippFuncC1 ) + { + Ipp64f res; + if( ippFuncC1(src.data, src.step[0], mask.data, mask.step[0], sz, &res) >= 0 ) + { + return Scalar(res); + } + } + typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *); + ippiMaskMeanFuncC3 ippFuncC3 = + type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR : + type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR : + type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR : + 0; + if( ippFuncC3 ) + { + Ipp64f res1, res2, res3; + if( ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 1, &res1) >= 0 && + ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 2, &res2) >= 0 && + ippFuncC3(src.data, src.step[0], mask.data, mask.step[0], sz, 3, &res3) >= 0 ) + { + return Scalar(res1, res2, res3); + } + } + } + else + { + typedef IppStatus (CV_STDCALL* ippiMeanFunc)(const void*, int, IppiSize, double *, int); + ippiMeanFunc ippFunc = + type == CV_8UC1 ? (ippiMeanFunc)ippiMean_8u_C1R : + type == CV_8UC3 ? (ippiMeanFunc)ippiMean_8u_C3R : + type == CV_8UC4 ? (ippiMeanFunc)ippiMean_8u_C4R : + type == CV_16UC1 ? (ippiMeanFunc)ippiMean_16u_C1R : + type == CV_16UC3 ? (ippiMeanFunc)ippiMean_16u_C3R : + type == CV_16UC4 ? (ippiMeanFunc)ippiMean_16u_C4R : + type == CV_16SC1 ? (ippiMeanFunc)ippiMean_16s_C1R : + type == CV_16SC3 ? (ippiMeanFunc)ippiMean_16s_C3R : + type == CV_16SC4 ? (ippiMeanFunc)ippiMean_16s_C4R : + type == CV_32FC1 ? (ippiMeanFunc)ippiMean_32f_C1R : + type == CV_32FC3 ? (ippiMeanFunc)ippiMean_32f_C3R : + type == CV_32FC4 ? (ippiMeanFunc)ippiMean_32f_C4R : + 0; + if( ippFunc ) + { + Ipp64f res[4]; + if( ippFunc(src.data, src.step[0], sz, res, ippAlgHintAccurate) >= 0 ) + { + Scalar sc; + for( int i = 0; i < cn; i++ ) + { + sc[i] = res[i]; + } + return sc; + } + } + } + } #endif SumFunc func = getSumFunc(depth); diff --git a/modules/highgui/src/cap_ffmpeg.cpp b/modules/highgui/src/cap_ffmpeg.cpp index 54a8529ba..74c3e18cf 100644 --- a/modules/highgui/src/cap_ffmpeg.cpp +++ b/modules/highgui/src/cap_ffmpeg.cpp @@ -161,7 +161,7 @@ private: class CvCapture_FFMPEG_proxy : - public CvCapture + public CvCapture { public: CvCapture_FFMPEG_proxy() { ffmpegCapture = 0; } @@ -186,7 +186,7 @@ public: if (!ffmpegCapture || !icvRetrieveFrame_FFMPEG_p(ffmpegCapture, &data, &step, &width, &height, &cn)) - return 0; + return 0; cvInitImageHeader(&frame, cvSize(width, height), 8, cn); cvSetData(&frame, data, step); return &frame; @@ -225,7 +225,7 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename) } class CvVideoWriter_FFMPEG_proxy : - public CvVideoWriter + public CvVideoWriter { public: CvVideoWriter_FFMPEG_proxy() { ffmpegWriter = 0; } diff --git a/modules/highgui/src/cap_ffmpeg_impl.hpp b/modules/highgui/src/cap_ffmpeg_impl.hpp index ee6ba84a1..2d8ad2223 100644 --- a/modules/highgui/src/cap_ffmpeg_impl.hpp +++ b/modules/highgui/src/cap_ffmpeg_impl.hpp @@ -343,8 +343,8 @@ void CvCapture_FFMPEG::close() class ImplMutex { public: - ImplMutex() { init(); } - ~ImplMutex() { destroy(); } + ImplMutex() { init(); } + ~ImplMutex() { destroy(); } void init(); void destroy(); @@ -447,14 +447,14 @@ struct ImplMutex::Impl void ImplMutex::init() { - impl = (Impl*)malloc(sizeof(Impl)); - impl->init(); + impl = (Impl*)malloc(sizeof(Impl)); + impl->init(); } void ImplMutex::destroy() { - impl->destroy(); - free(impl); - impl = NULL; + impl->destroy(); + free(impl); + impl = NULL; } void ImplMutex::lock() { impl->lock(); } void ImplMutex::unlock() { impl->unlock(); } diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 40be8cd3d..55bb0c064 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1139,134 +1139,134 @@ private: #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kernel, const Point &anchor) { - int type = src.type(); - const Mat* _src = &src; - Mat temp; - if( src.data == dst.data ) - { - src.copyTo(temp); - _src = &temp; - } - //DEPRECATED. Allocates and initializes morphology state structure for erosion or dilation operation. - typedef IppStatus (CV_STDCALL* ippiMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **); - ippiMorphologyInitAllocFunc ippInitAllocFunc = - type == CV_8UC1 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C1R : - type == CV_8UC3 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C3R : - type == CV_8UC4 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C4R : - type == CV_32FC1 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C1R : - type == CV_32FC3 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C3R : - type == CV_32FC4 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C4R : - 0; - typedef IppStatus (CV_STDCALL* ippiMorphologyBorderReplicateFunc)(const void*, int, void *, int, IppiSize, IppiBorderType, IppiMorphState *); - ippiMorphologyBorderReplicateFunc ippFunc = 0; - switch( op ) - { - case MORPH_DILATE: - { - ippFunc = - type == CV_8UC1 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C1R : - type == CV_8UC3 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C3R : - type == CV_8UC4 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C4R : - type == CV_32FC1 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C1R : - type == CV_32FC3 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C3R : - type == CV_32FC4 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C4R : - 0; - break; - } - case MORPH_ERODE: - { - ippFunc = - type == CV_8UC1 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C1R : - type == CV_8UC3 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C3R : - type == CV_8UC4 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C4R : - type == CV_32FC1 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C1R : - type == CV_32FC3 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C3R : - type == CV_32FC4 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C4R : - 0; - break; - } - } - if( ippFunc && ippInitAllocFunc) - { - IppiMorphState* pState; - IppiSize roiSize = {src.cols, src.rows}; - IppiSize kernelSize = {kernel.cols, kernel.rows}; - IppiPoint point = {anchor.x, anchor.y}; - if( ippInitAllocFunc( roiSize.width, kernel.data, kernelSize, point, &pState ) < 0 ) - return false; - bool is_ok = ippFunc( _src->data, _src->step[0], dst.data, dst.step[0], roiSize, ippBorderRepl, pState ) >= 0; - ippiMorphologyFree(pState); - return is_ok; - } - return false; + int type = src.type(); + const Mat* _src = &src; + Mat temp; + if( src.data == dst.data ) + { + src.copyTo(temp); + _src = &temp; + } + //DEPRECATED. Allocates and initializes morphology state structure for erosion or dilation operation. + typedef IppStatus (CV_STDCALL* ippiMorphologyInitAllocFunc)(int, const void*, IppiSize, IppiPoint, IppiMorphState **); + ippiMorphologyInitAllocFunc ippInitAllocFunc = + type == CV_8UC1 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C1R : + type == CV_8UC3 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C3R : + type == CV_8UC4 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_8u_C4R : + type == CV_32FC1 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C1R : + type == CV_32FC3 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C3R : + type == CV_32FC4 ? (ippiMorphologyInitAllocFunc)ippiMorphologyInitAlloc_32f_C4R : + 0; + typedef IppStatus (CV_STDCALL* ippiMorphologyBorderReplicateFunc)(const void*, int, void *, int, IppiSize, IppiBorderType, IppiMorphState *); + ippiMorphologyBorderReplicateFunc ippFunc = 0; + switch( op ) + { + case MORPH_DILATE: + { + ippFunc = + type == CV_8UC1 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C1R : + type == CV_8UC3 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C3R : + type == CV_8UC4 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_8u_C4R : + type == CV_32FC1 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C1R : + type == CV_32FC3 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C3R : + type == CV_32FC4 ? (ippiMorphologyBorderReplicateFunc)ippiDilateBorderReplicate_32f_C4R : + 0; + break; + } + case MORPH_ERODE: + { + ippFunc = + type == CV_8UC1 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C1R : + type == CV_8UC3 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C3R : + type == CV_8UC4 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_8u_C4R : + type == CV_32FC1 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C1R : + type == CV_32FC3 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C3R : + type == CV_32FC4 ? (ippiMorphologyBorderReplicateFunc)ippiErodeBorderReplicate_32f_C4R : + 0; + break; + } + } + if( ippFunc && ippInitAllocFunc) + { + IppiMorphState* pState; + IppiSize roiSize = {src.cols, src.rows}; + IppiSize kernelSize = {kernel.cols, kernel.rows}; + IppiPoint point = {anchor.x, anchor.y}; + if( ippInitAllocFunc( roiSize.width, kernel.data, kernelSize, point, &pState ) < 0 ) + return false; + bool is_ok = ippFunc( _src->data, _src->step[0], dst.data, dst.step[0], roiSize, ippBorderRepl, pState ) >= 0; + ippiMorphologyFree(pState); + return is_ok; + } + return false; } static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst, - InputArray _kernel, - const Point &anchor, int iterations, - int borderType, const Scalar &borderValue) + InputArray _kernel, + const Point &anchor, int iterations, + int borderType, const Scalar &borderValue) { - Mat src = _src.getMat(), kernel = _kernel.getMat(); - if( !( src.depth() == CV_8U || src.depth() == CV_32F ) || ( iterations > 1 ) || - !( borderType == cv::BORDER_REPLICATE || (borderType == cv::BORDER_CONSTANT && borderValue == morphologyDefaultBorderValue()) ) - || !( op == MORPH_DILATE || op == MORPH_ERODE) ) - return false; - if( borderType == cv::BORDER_CONSTANT ) - { - int x, y; - for( y = 0; y < kernel.rows; y++ ) - { - if( kernel.at(y, anchor.x) != 0 ) - continue; - for( x = 0; x < kernel.cols; x++ ) - { - if( kernel.at(y,x) != 0 ) - return false; - } - } - for( x = 0; y < kernel.cols; x++ ) - { - if( kernel.at(anchor.y, x) != 0 ) - continue; - for( y = 0; y < kernel.rows; y++ ) - { - if( kernel.at(y,x) != 0 ) - return false; - } - } + Mat src = _src.getMat(), kernel = _kernel.getMat(); + if( !( src.depth() == CV_8U || src.depth() == CV_32F ) || ( iterations > 1 ) || + !( borderType == cv::BORDER_REPLICATE || (borderType == cv::BORDER_CONSTANT && borderValue == morphologyDefaultBorderValue()) ) + || !( op == MORPH_DILATE || op == MORPH_ERODE) ) + return false; + if( borderType == cv::BORDER_CONSTANT ) + { + int x, y; + for( y = 0; y < kernel.rows; y++ ) + { + if( kernel.at(y, anchor.x) != 0 ) + continue; + for( x = 0; x < kernel.cols; x++ ) + { + if( kernel.at(y,x) != 0 ) + return false; + } + } + for( x = 0; y < kernel.cols; x++ ) + { + if( kernel.at(anchor.y, x) != 0 ) + continue; + for( y = 0; y < kernel.rows; y++ ) + { + if( kernel.at(y,x) != 0 ) + return false; + } + } - } - Size ksize = kernel.data ? kernel.size() : Size(3,3); - Point normanchor = normalizeAnchor(anchor, ksize); + } + Size ksize = kernel.data ? kernel.size() : Size(3,3); + Point normanchor = normalizeAnchor(anchor, ksize); - CV_Assert( normanchor.inside(Rect(0, 0, ksize.width, ksize.height)) ); + CV_Assert( normanchor.inside(Rect(0, 0, ksize.width, ksize.height)) ); - _dst.create( src.size(), src.type() ); - Mat dst = _dst.getMat(); + _dst.create( src.size(), src.type() ); + Mat dst = _dst.getMat(); - if( iterations == 0 || kernel.rows*kernel.cols == 1 ) - { - src.copyTo(dst); - return true; - } + if( iterations == 0 || kernel.rows*kernel.cols == 1 ) + { + src.copyTo(dst); + return true; + } - if( !kernel.data ) - { - kernel = getStructuringElement(MORPH_RECT, Size(1+iterations*2,1+iterations*2)); - normanchor = Point(iterations, iterations); - iterations = 1; - } - else if( iterations > 1 && countNonZero(kernel) == kernel.rows*kernel.cols ) - { - normanchor = Point(normanchor.x*iterations, normanchor.y*iterations); - kernel = getStructuringElement(MORPH_RECT, - Size(ksize.width + (iterations-1)*(ksize.width-1), - ksize.height + (iterations-1)*(ksize.height-1)), - normanchor); - iterations = 1; - } + if( !kernel.data ) + { + kernel = getStructuringElement(MORPH_RECT, Size(1+iterations*2,1+iterations*2)); + normanchor = Point(iterations, iterations); + iterations = 1; + } + else if( iterations > 1 && countNonZero(kernel) == kernel.rows*kernel.cols ) + { + normanchor = Point(normanchor.x*iterations, normanchor.y*iterations); + kernel = getStructuringElement(MORPH_RECT, + Size(ksize.width + (iterations-1)*(ksize.width-1), + ksize.height + (iterations-1)*(ksize.height-1)), + normanchor); + iterations = 1; + } - return IPPMorphReplicate( op, src, dst, kernel, normanchor ); + return IPPMorphReplicate( op, src, dst, kernel, normanchor ); } #endif @@ -1277,8 +1277,8 @@ static void morphOp( int op, InputArray _src, OutputArray _dst, { #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - if( IPPMorphOp(op, _src, _dst, _kernel, anchor, iterations, borderType, borderValue) ) - return; + if( IPPMorphOp(op, _src, _dst, _kernel, anchor, iterations, borderType, borderValue) ) + return; #endif Mat src = _src.getMat(), kernel = _kernel.getMat(); diff --git a/modules/imgproc/src/sumpixels.cpp b/modules/imgproc/src/sumpixels.cpp index 4ee941762..229bbcb8c 100644 --- a/modules/imgproc/src/sumpixels.cpp +++ b/modules/imgproc/src/sumpixels.cpp @@ -239,49 +239,49 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output sdepth = CV_MAT_DEPTH(sdepth); #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7) - if( ( depth == CV_8U ) && ( !_tilted.needed() ) ) - { - if( sdepth == CV_32F ) - { - if( cn == 1 ) - { - IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); - _sum.create( isize, CV_MAKETYPE( sdepth, cn ) ); - sum = _sum.getMat(); - if( _sqsum.needed() ) - { - _sqsum.create( isize, CV_MAKETYPE( CV_64F, cn ) ); - sqsum = _sqsum.getMat(); - ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32f*)sum.data, sum.step, (Ipp64f*)sqsum.data, sqsum.step, srcRoiSize, 0, 0 ); - } - else - { - ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32f*)sum.data, sum.step, srcRoiSize, 0 ); - } - return; - } - } - if( sdepth == CV_32S ) - { - if( cn == 1 ) - { - IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); - _sum.create( isize, CV_MAKETYPE( sdepth, cn ) ); - sum = _sum.getMat(); - if( _sqsum.needed() ) - { - _sqsum.create( isize, CV_MAKETYPE( CV_64F, cn ) ); - sqsum = _sqsum.getMat(); - ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32s*)sum.data, sum.step, (Ipp64f*)sqsum.data, sqsum.step, srcRoiSize, 0, 0 ); - } - else - { - ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, src.step, (Ipp32s*)sum.data, sum.step, srcRoiSize, 0 ); - } - return; - } - } - } + if( ( depth == CV_8U ) && ( !_tilted.needed() ) ) + { + if( sdepth == CV_32F ) + { + if( cn == 1 ) + { + IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); + _sum.create( isize, CV_MAKETYPE( sdepth, cn ) ); + sum = _sum.getMat(); + if( _sqsum.needed() ) + { + _sqsum.create( isize, CV_MAKETYPE( CV_64F, cn ) ); + sqsum = _sqsum.getMat(); + ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32f*)sum.data, sum.step, (Ipp64f*)sqsum.data, sqsum.step, srcRoiSize, 0, 0 ); + } + else + { + ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32f*)sum.data, sum.step, srcRoiSize, 0 ); + } + return; + } + } + if( sdepth == CV_32S ) + { + if( cn == 1 ) + { + IppiSize srcRoiSize = ippiSize( src.cols, src.rows ); + _sum.create( isize, CV_MAKETYPE( sdepth, cn ) ); + sum = _sum.getMat(); + if( _sqsum.needed() ) + { + _sqsum.create( isize, CV_MAKETYPE( CV_64F, cn ) ); + sqsum = _sqsum.getMat(); + ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32s*)sum.data, sum.step, (Ipp64f*)sqsum.data, sqsum.step, srcRoiSize, 0, 0 ); + } + else + { + ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, src.step, (Ipp32s*)sum.data, sum.step, srcRoiSize, 0 ); + } + return; + } + } + } #endif _sum.create( isize, CV_MAKETYPE(sdepth, cn) ); diff --git a/modules/java/android_test/AndroidManifest.xml b/modules/java/android_test/AndroidManifest.xml index e261e2d70..dfe25fff0 100644 --- a/modules/java/android_test/AndroidManifest.xml +++ b/modules/java/android_test/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionCode="1" android:versionName="1.0"> - +