Deleted all trailing whitespace.
authorRoman Donchenko <roman.donchenko@itseez.com>
Wed, 21 Aug 2013 12:44:09 +0000 (16:44 +0400)
committerRoman Donchenko <roman.donchenko@itseez.com>
Wed, 21 Aug 2013 14:59:24 +0000 (18:59 +0400)
193 files changed:
3rdparty/ffmpeg/readme.txt
3rdparty/readme.txt
cmake/OpenCVFindIPP.cmake
cmake/OpenCVFindXimea.cmake
doc/_static/insertIframe.js
doc/packaging.txt
doc/tutorials/calib3d/camera_calibration/camera_calibration.rst
doc/tutorials/calib3d/camera_calibration_square_chess/camera_calibration_square_chess.rst
doc/tutorials/calib3d/table_of_content_calib3d/table_of_content_calib3d.rst
doc/tutorials/core/adding_images/adding_images.rst
doc/tutorials/core/basic_linear_transform/basic_linear_transform.rst
doc/tutorials/core/discrete_fourier_transform/discrete_fourier_transform.rst
doc/tutorials/core/file_input_output_with_xml_yml/file_input_output_with_xml_yml.rst
doc/tutorials/core/how_to_scan_images/how_to_scan_images.rst
doc/tutorials/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.rst
doc/tutorials/core/mat-mask-operations/mat-mask-operations.rst
doc/tutorials/core/mat_the_basic_image_container/mat_the_basic_image_container.rst
doc/tutorials/core/table_of_content_core/table_of_content_core.rst
doc/tutorials/definitions/tocDefinitions.rst
doc/tutorials/features2d/detection_of_planar_objects/detection_of_planar_objects.rst
doc/tutorials/features2d/table_of_content_features2d/table_of_content_features2d.rst
doc/tutorials/gpu/table_of_content_gpu/table_of_content_gpu.rst
doc/tutorials/highgui/table_of_content_highgui/table_of_content_highgui.rst
doc/tutorials/highgui/trackbar/trackbar.rst
doc/tutorials/highgui/video-input-psnr-ssim/video-input-psnr-ssim.rst
doc/tutorials/imgproc/table_of_content_imgproc/table_of_content_imgproc.rst
doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.rst
doc/tutorials/introduction/ios_install/ios_install.rst
doc/tutorials/introduction/linux_eclipse/linux_eclipse.rst
doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.rst
doc/tutorials/introduction/linux_install/linux_install.rst
doc/tutorials/introduction/load_save_image/load_save_image.rst
doc/tutorials/introduction/windows_install/windows_install.rst
doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.rst
doc/tutorials/introduction/windows_visual_studio_image_watch/windows_visual_studio_image_watch.rst
doc/tutorials/ios/hello/hello.rst
doc/tutorials/ios/image_manipulation/image_manipulation.rst
doc/tutorials/ios/table_of_content_ios/table_of_content_ios.rst
doc/tutorials/ios/video_processing/video_processing.rst
doc/tutorials/ml/introduction_to_svm/introduction_to_svm.rst
doc/tutorials/ml/table_of_content_ml/table_of_content_ml.rst
doc/tutorials/objdetect/table_of_content_objdetect/table_of_content_objdetect.rst
doc/tutorials/video/table_of_content_video/table_of_content_video.rst
doc/user_guide/ug_features2d.rst
doc/user_guide/ug_mat.rst
doc/user_guide/ug_traincascade.rst
modules/calib3d/doc/camera_calibration_and_3d_reconstruction.rst
modules/contrib/doc/facerec/facerec_changelog.rst
modules/contrib/doc/facerec/facerec_tutorial.rst
modules/contrib/doc/facerec/tutorial/facerec_save_load.rst
modules/contrib/doc/facerec/tutorial/facerec_video_recognition.rst
modules/contrib/src/facerec.cpp
modules/core/doc/basic_structures.rst
modules/core/doc/clustering.rst
modules/core/doc/drawing_functions.rst
modules/core/doc/intro.rst
modules/core/include/opencv2/core/operations.hpp
modules/core/src/arithm.cpp
modules/core/src/stat.cpp
modules/core/test/test_io.cpp
modules/core/test/test_math.cpp
modules/features2d/doc/object_categorization.rst
modules/features2d/src/bagofwords.cpp
modules/features2d/src/evaluation.cpp
modules/flann/doc/flann_fast_approximate_nearest_neighbor_search.rst
modules/gpu/CMakeLists.txt
modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst
modules/gpu/doc/video.rst
modules/highgui/doc/reading_and_writing_images_and_video.rst
modules/highgui/src/cap_ffmpeg.cpp
modules/highgui/src/cap_ffmpeg_impl.hpp
modules/highgui/src/cap_ios_video_camera.mm
modules/highgui/src/cap_libv4l.cpp
modules/highgui/src/cap_msmf.cpp
modules/highgui/src/cap_qtkit.mm
modules/highgui/src/cap_v4l.cpp
modules/highgui/src/cap_ximea.cpp
modules/highgui/src/files_Qt/Milky/README.txt
modules/highgui/src/ios_conversions.mm
modules/highgui/src/window_QT.cpp
modules/imgproc/doc/histograms.rst
modules/imgproc/include/opencv2/imgproc/types_c.h
modules/imgproc/src/color.cpp
modules/imgproc/src/morph.cpp
modules/imgproc/test/test_cvtyuv.cpp
modules/java/generator/src/cpp/Mat.cpp
modules/ml/doc/gradient_boosted_trees.rst
modules/ml/doc/k_nearest_neighbors.rst
modules/ml/doc/mldata.rst
modules/ml/src/knearest.cpp
modules/nonfree/src/opencl/surf.cl
modules/nonfree/src/precomp.hpp
modules/objdetect/src/haar.cpp
modules/objdetect/test/test_cascadeandhog.cpp
modules/ocl/doc/introduction.rst
modules/ocl/doc/operations_on_matrices.rst
modules/ocl/include/opencv2/ocl/ocl.hpp
modules/ocl/include/opencv2/ocl/private/util.hpp
modules/ocl/perf/main.cpp
modules/ocl/perf/perf_calib3d.cpp
modules/ocl/perf/perf_filters.cpp
modules/ocl/perf/perf_gftt.cpp
modules/ocl/perf/perf_hog.cpp
modules/ocl/perf/perf_imgproc.cpp
modules/ocl/perf/perf_norm.cpp
modules/ocl/perf/perf_precomp.cpp
modules/ocl/perf/perf_split_merge.cpp
modules/ocl/src/arithm.cpp
modules/ocl/src/filtering.cpp
modules/ocl/src/gftt.cpp
modules/ocl/src/haar.cpp
modules/ocl/src/hog.cpp
modules/ocl/src/imgproc.cpp
modules/ocl/src/initialization.cpp
modules/ocl/src/match_template.cpp
modules/ocl/src/matrix_operations.cpp
modules/ocl/src/mcwutil.cpp
modules/ocl/src/moments.cpp
modules/ocl/src/opencl/arithm_absdiff.cl
modules/ocl/src/opencl/arithm_addWeighted.cl
modules/ocl/src/opencl/arithm_add_scalar.cl
modules/ocl/src/opencl/arithm_add_scalar_mask.cl
modules/ocl/src/opencl/arithm_bitwise_binary.cl
modules/ocl/src/opencl/arithm_bitwise_binary_mask.cl
modules/ocl/src/opencl/arithm_bitwise_binary_scalar.cl
modules/ocl/src/opencl/arithm_bitwise_binary_scalar_mask.cl
modules/ocl/src/opencl/arithm_bitwise_not.cl
modules/ocl/src/opencl/arithm_compare_eq.cl
modules/ocl/src/opencl/arithm_compare_ne.cl
modules/ocl/src/opencl/arithm_div.cl
modules/ocl/src/opencl/arithm_flip.cl
modules/ocl/src/opencl/arithm_mul.cl
modules/ocl/src/opencl/brute_force_match.cl
modules/ocl/src/opencl/filter_sep_row.cl
modules/ocl/src/opencl/filtering_boxFilter.cl
modules/ocl/src/opencl/haarobjectdetect.cl
modules/ocl/src/opencl/haarobjectdetect_scaled2.cl
modules/ocl/src/opencl/imgproc_clahe.cl
modules/ocl/src/opencl/imgproc_gftt.cl
modules/ocl/src/opencl/imgproc_warpAffine.cl
modules/ocl/src/opencl/imgproc_warpPerspective.cl
modules/ocl/src/opencl/kernel_radix_sort_by_key.cl
modules/ocl/src/opencl/kernel_sort_by_key.cl
modules/ocl/src/opencl/objdetect_hog.cl
modules/ocl/src/opencl/stereobm.cl
modules/ocl/src/opencl/stereobp.cl
modules/ocl/src/opencl/stereocsbp.cl
modules/ocl/src/opencl/tvl1flow.cl
modules/ocl/src/pyrlk.cpp
modules/ocl/src/sort_by_key.cpp
modules/ocl/src/stereo_csbp.cpp
modules/ocl/src/stereobp.cpp
modules/ocl/src/tvl1flow.cpp
modules/ocl/test/test_arithm.cpp
modules/ocl/test/test_brute_force_matcher.cpp
modules/ocl/test/test_filters.cpp
modules/ocl/test/test_imgproc.cpp
modules/ocl/test/test_kmeans.cpp
modules/ocl/test/test_objdetect.cpp
modules/ocl/test/test_optflow.cpp
modules/ocl/test/test_pyramids.cpp
modules/ocl/test/test_sort.cpp
modules/ocl/test/utility.cpp
modules/photo/doc/photo.rst
modules/python/src2/cv2.cpp
modules/python/test/test2.py
modules/stitching/doc/camera.rst
modules/stitching/doc/high_level.rst
modules/stitching/doc/seam_estimation.rst
modules/stitching/doc/stitching.rst
modules/superres/src/btv_l1_ocl.cpp
modules/superres/src/opencl/superres_btvl1.cl
modules/superres/test/test_superres.cpp
modules/world/CMakeLists.txt
samples/MacOSX/FaceTracker/README.txt
samples/c/build_all.sh
samples/c/example_cmake/README.txt
samples/gpu/CMakeLists.txt
samples/gpu/super_resolution.cpp
samples/ocl/clahe.cpp
samples/ocl/facedetect.cpp
samples/python2/dft.py
samples/python2/grabcut.py
samples/winrt/ImageManipulations/App.xaml
samples/winrt/ImageManipulations/MainPage.xaml
samples/winrt/ImageManipulations/MediaExtensions/Common/AsyncCB.h
samples/winrt/ImageManipulations/MediaExtensions/Common/CritSec.h
samples/winrt/ImageManipulations/MediaExtensions/Common/LinkList.h
samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvImageManipulations.idl
samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.cpp
samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/dllmain.cpp
samples/winrt/ImageManipulations/common/StandardStyles.xaml
samples/winrt/ImageManipulations/sample-utils/SampleTemplateStyles.xaml

index 1089ee2..1928a53 100644 (file)
@@ -16,7 +16,7 @@ How to update opencv_ffmpeg.dll and opencv_ffmpeg_64.dll when a new version of F
 2. Install 64-bit MinGW. http://mingw-w64.sourceforge.net/
    Let's assume, it's installed in C:\MSYS64
 3. Copy C:\MSYS32\msys to C:\MSYS64\msys. Edit C:\MSYS64\msys\etc\fstab, change C:\MSYS32 to C:\MSYS64.
-   
+
 4. Now you have working MSYS32 and MSYS64 environments.
    Launch, one by one, C:\MSYS32\msys\msys.bat and C:\MSYS64\msys\msys.bat to create your home directories.
 
index 6d2aeec..ca46fbd 100644 (file)
@@ -45,13 +45,13 @@ jasper-1.900.1    -   JasPer is a collection of software
                       and manipulation of images.  This software can handle image data in a
                       variety of formats.  One such format supported by JasPer is the JPEG-2000
                       format defined in ISO/IEC 15444-1.
-             
+
                       Copyright (c) 1999-2000 Image Power, Inc.
                       Copyright (c) 1999-2000 The University of British Columbia
                       Copyright (c) 2001-2003 Michael David Adams
 
                       The JasPer license can be found in src/libjasper.
-             
+
                       OpenCV on Windows uses pre-built libjasper library
                       (lib/libjasper*). To get the latest source code,
                       please, visit the project homepage:
index 9f74d94..afa0da9 100644 (file)
@@ -140,7 +140,7 @@ endfunction()
 # ------------------------------------------------------------------------
 function(set_ipp_new_libraries _LATEST_VERSION)
     set(IPP_PREFIX "ipp")
-    
+
     if(${_LATEST_VERSION} VERSION_LESS "8.0")
         set(IPP_SUFFIX "_l")        # static not threaded libs suffix IPP 7.x
     else()
index 27e2a78..20dc9e8 100644 (file)
@@ -19,7 +19,7 @@ set(XIMEA_LIBRARY_DIR)
 if(WIN32)
   # Try to find the XIMEA API path in registry.
   GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
+
   if(EXISTS ${XIMEA_PATH})
     set(XIMEA_FOUND 1)
     # set LIB folders
index 904ff36..ba46424 100644 (file)
@@ -1,4 +1,4 @@
-function insertIframe (elementId, iframeSrc) 
+function insertIframe (elementId, iframeSrc)
 {
   var iframe;
   if (document.createElement && (iframe = document.createElement('iframe')))
index a4d3dc2..e8dd769 100644 (file)
@@ -4,14 +4,14 @@ INSTRUCTIONS TO BUILD WIN32 PACKAGES WITH CMAKE+CPACK
 
 - Install NSIS.
 - Generate OpenCV solutions for MSVC using CMake as usual.
-- In cmake-gui: 
+- In cmake-gui:
        - Mark BUILD_PACKAGE
        - Mark BUILD_EXAMPLES (If examples are desired to be shipped as binaries...)
        - Unmark ENABLE_OPENMP, since this feature seems to have some issues yet...
        - Mark INSTALL_*_EXAMPLES
 - Open the OpenCV solution and build ALL in Debug and Release.
-- Build PACKAGE, from the Release configuration. An NSIS installer package will be 
+- Build PACKAGE, from the Release configuration. An NSIS installer package will be
   created with both release and debug LIBs and DLLs.
 
-  
+
 Jose Luis Blanco, 2009/JUL/29
index 0e2c764..2cf00f4 100644 (file)
@@ -3,30 +3,30 @@
 Camera calibration With OpenCV
 ******************************
 
-Cameras have been around for a long-long time. However, with the introduction of the cheap *pinhole* cameras in the late 20th century, they became a common occurrence in our everyday life. Unfortunately, this cheapness comes with its price: significant distortion. Luckily, these are constants and with a calibration and some remapping we can correct this. Furthermore, with calibration you may also determine the relation between the camera's natural units (pixels) and the real world units (for example millimeters). 
+Cameras have been around for a long-long time. However, with the introduction of the cheap *pinhole* cameras in the late 20th century, they became a common occurrence in our everyday life. Unfortunately, this cheapness comes with its price: significant distortion. Luckily, these are constants and with a calibration and some remapping we can correct this. Furthermore, with calibration you may also determine the relation between the camera's natural units (pixels) and the real world units (for example millimeters).
 
 Theory
 ======
 
-For the distortion OpenCV takes into account the radial and tangential factors. For the radial factor one uses the following formula: 
+For the distortion OpenCV takes into account the radial and tangential factors. For the radial factor one uses the following formula:
 
-.. math:: 
+.. math::
 
    x_{corrected} = x( 1 + k_1 r^2 + k_2 r^4 + k_3 r^6) \\
    y_{corrected} = y( 1 + k_1 r^2 + k_2 r^4 + k_3 r^6)
 
-So for an old pixel point at :math:`(x,y)` coordinates in the input image, its position on the corrected output image will be :math:`(x_{corrected} y_{corrected})`. The presence of the radial distortion manifests in form of the "barrel" or "fish-eye" effect. 
+So for an old pixel point at :math:`(x,y)` coordinates in the input image, its position on the corrected output image will be :math:`(x_{corrected} y_{corrected})`. The presence of the radial distortion manifests in form of the "barrel" or "fish-eye" effect.
 
-Tangential distortion occurs because the image taking lenses are not perfectly parallel to the imaging plane. It can be corrected via the formulas: 
+Tangential distortion occurs because the image taking lenses are not perfectly parallel to the imaging plane. It can be corrected via the formulas:
 
-.. math:: 
+.. math::
 
    x_{corrected} = x + [ 2p_1xy + p_2(r^2+2x^2)] \\
    y_{corrected} = y + [ p_1(r^2+ 2y^2)+ 2p_2xy]
 
-So we have five distortion parameters which in OpenCV are presented as one row matrix with 5 columns: 
+So we have five distortion parameters which in OpenCV are presented as one row matrix with 5 columns:
 
-.. math:: 
+.. math::
 
   Distortion_{coefficients}=(k_1 \hspace{10pt} k_2 \hspace{10pt} p_1 \hspace{10pt} p_2 \hspace{10pt} k_3)
 
@@ -38,7 +38,7 @@ Now for the unit conversion we use the following formula:
 
 Here the presence of :math:`w` is explained by the use of homography coordinate system (and :math:`w=Z`). The unknown parameters are :math:`f_x` and :math:`f_y` (camera focal lengths) and :math:`(c_x, c_y)` which are the optical centers expressed in pixels coordinates. If for both axes a common focal length is used with a given :math:`a` aspect ratio (usually 1), then :math:`f_y=f_x*a` and in the upper formula we will have a single focal length :math:`f`. The matrix containing these four parameters is referred to as the *camera matrix*. While the distortion coefficients are the same regardless of the camera resolutions used, these should be scaled along with the current resolution from the calibrated resolution.
 
-The process of determining these two matrices is the calibration. Calculation of these parameters is done through basic geometrical equations. The equations used depend on the chosen calibrating objects. Currently OpenCV supports three types of objects for calibration: 
+The process of determining these two matrices is the calibration. Calculation of these parameters is done through basic geometrical equations. The equations used depend on the chosen calibrating objects. Currently OpenCV supports three types of objects for calibration:
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -51,7 +51,7 @@ Basically, you need to take snapshots of these patterns with your camera and let
 Goal
 ====
 
-The sample application will: 
+The sample application will:
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -67,7 +67,7 @@ Source code
 
 You may also find the source code in the :file:`samples/cpp/tutorial_code/calib3d/camera_calibration/` folder of the OpenCV source library or :download:`download it from here <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp>`. The program has a single argument: the name of its configuration file. If none is given then it will try to open the one named "default.xml". :download:`Here's a sample configuration file <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/in_VID5.xml>` in XML format. In the configuration file you may choose to use camera as an input, a video file or an image list. If you opt for the last one, you will need to create a configuration file where you enumerate the images to use. Here's :download:`an example of this <../../../../samples/cpp/tutorial_code/calib3d/camera_calibration/VID5.xml>`. The important part to remember is that the images need to be specified using the absolute path or the relative one from your application's working directory. You may find all this in the samples directory mentioned above.
 
-The application starts up with reading the settings from the configuration file. Although, this is an important part of it, it has nothing to do with the subject of this tutorial: *camera calibration*. Therefore, I've chosen not to post the code for that part here. Technical background on how to do this you can find in the :ref:`fileInputOutputXMLYAML` tutorial. 
+The application starts up with reading the settings from the configuration file. Although, this is an important part of it, it has nothing to do with the subject of this tutorial: *camera calibration*. Therefore, I've chosen not to post the code for that part here. Technical background on how to do this you can find in the :ref:`fileInputOutputXMLYAML` tutorial.
 
 Explanation
 ===========
@@ -76,15 +76,15 @@ Explanation
 
    .. code-block:: cpp
 
-      Settings s; 
+      Settings s;
       const string inputSettingsFile = argc > 1 ? argv[1] : "default.xml";
       FileStorage fs(inputSettingsFile, FileStorage::READ); // Read the settings
       if (!fs.isOpened())
       {
-            cout << "Could not open the configuration file: \"" << inputSettingsFile << "\"" << endl; 
+            cout << "Could not open the configuration file: \"" << inputSettingsFile << "\"" << endl;
             return -1;
       }
-      fs["Settings"] >> s; 
+      fs["Settings"] >> s;
       fs.release();                                         // close Settings file
 
       if (!s.goodInput)
@@ -95,7 +95,7 @@ Explanation
 
    For this I've used simple OpenCV class input operation. After reading the file I've an additional post-processing function that checks validity of the input. Only if all inputs are good then *goodInput* variable will be true.
 
-#. **Get next input, if it fails or we have enough of them - calibrate**. After this we have a big loop where we do the following operations: get the next image from the image list, camera or video file. If this fails or we have enough images then we run the calibration process. In case of image we step out of the loop and otherwise the remaining frames will be undistorted (if the option is set) via changing from *DETECTION* mode to the *CALIBRATED* one. 
+#. **Get next input, if it fails or we have enough of them - calibrate**. After this we have a big loop where we do the following operations: get the next image from the image list, camera or video file. If this fails or we have enough images then we run the calibration process. In case of image we step out of the loop and otherwise the remaining frames will be undistorted (if the option is set) via changing from *DETECTION* mode to the *CALIBRATED* one.
 
    .. code-block:: cpp
 
@@ -123,7 +123,7 @@ Explanation
         if( s.flipVertical )    flip( view, view, 0 );
         }
 
-   For some cameras we may need to flip the input image. Here we do this too. 
+   For some cameras we may need to flip the input image. Here we do this too.
 
 #. **Find the pattern in the current input**. The formation of the equations I mentioned above aims to finding major patterns in the input: in case of the chessboard this are corners of the squares and for the circles, well, the circles themselves. The position of these will form the result which will be written into the *pointBuf* vector.
 
@@ -146,19 +146,19 @@ Explanation
         break;
       }
 
-   Depending on the type of the input pattern you use either the :calib3d:`findChessboardCorners <findchessboardcorners>` or the :calib3d:`findCirclesGrid <findcirclesgrid>` function. For both of them you pass the current image and the size of the board and you'll get the positions of the patterns. Furthermore, they return a boolean variable which states if the pattern was found in the input (we only need to take into account those images where this is true!). 
+   Depending on the type of the input pattern you use either the :calib3d:`findChessboardCorners <findchessboardcorners>` or the :calib3d:`findCirclesGrid <findcirclesgrid>` function. For both of them you pass the current image and the size of the board and you'll get the positions of the patterns. Furthermore, they return a boolean variable which states if the pattern was found in the input (we only need to take into account those images where this is true!).
 
-   Then again in case of cameras we only take camera images when an input delay time is passed. This is done in order to allow user moving the chessboard around and getting different images. Similar images result in similar equations, and similar equations at the calibration step will form an ill-posed problem, so the calibration will fail. For square images the positions of the corners are only approximate. We may improve this by calling the :feature2d:`cornerSubPix <cornersubpix>` function. It will produce better calibration result. After this we add a valid inputs result to the *imagePoints* vector to collect all of the equations into a single container. Finally, for visualization feedback purposes we will draw the found points on the input image using :calib3d:`findChessboardCorners <drawchessboardcorners>` function. 
+   Then again in case of cameras we only take camera images when an input delay time is passed. This is done in order to allow user moving the chessboard around and getting different images. Similar images result in similar equations, and similar equations at the calibration step will form an ill-posed problem, so the calibration will fail. For square images the positions of the corners are only approximate. We may improve this by calling the :feature2d:`cornerSubPix <cornersubpix>` function. It will produce better calibration result. After this we add a valid inputs result to the *imagePoints* vector to collect all of the equations into a single container. Finally, for visualization feedback purposes we will draw the found points on the input image using :calib3d:`findChessboardCorners <drawchessboardcorners>` function.
 
    .. code-block:: cpp
 
-      if ( found)                // If done with success, 
+      if ( found)                // If done with success,
         {
             // improve the found corners' coordinate accuracy for chessboard
-              if( s.calibrationPattern == Settings::CHESSBOARD) 
+              if( s.calibrationPattern == Settings::CHESSBOARD)
               {
                   Mat viewGray;
-                  cvtColor(view, viewGray, CV_BGR2GRAY); 
+                  cvtColor(view, viewGray, CV_BGR2GRAY);
                   cornerSubPix( viewGray, pointBuf, Size(11,11),
                     Size(-1,-1), TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 ));
               }
@@ -171,11 +171,11 @@ Explanation
                   blinkOutput = s.inputCapture.isOpened();
               }
 
-              // Draw the corners. 
+              // Draw the corners.
               drawChessboardCorners( view, s.boardSize, Mat(pointBuf), found );
         }
 
-#. **Show state and result to the user, plus command line control of the application**. This  part shows text output on the image. 
+#. **Show state and result to the user, plus command line control of the application**. This  part shows text output on the image.
 
    .. code-block:: cpp
 
@@ -183,7 +183,7 @@ Explanation
       string msg = (mode == CAPTURING) ? "100/100" :
                 mode == CALIBRATED ? "Calibrated" : "Press 'g' to start";
       int baseLine = 0;
-      Size textSize = getTextSize(msg, 1, 1, 1, &baseLine);        
+      Size textSize = getTextSize(msg, 1, 1, 1, &baseLine);
       Point textOrigin(view.cols - 2*textSize.width - 10, view.rows - 2*baseLine - 10);
 
       if( mode == CAPTURING )
@@ -199,7 +199,7 @@ Explanation
       if( blinkOutput )
          bitwise_not(view, view);
 
-   If we ran calibration and got camera's matrix with the distortion coefficients we may want to correct the image using :imgproc_geometric:`undistort <undistort>` function: 
+   If we ran calibration and got camera's matrix with the distortion coefficients we may want to correct the image using :imgproc_geometric:`undistort <undistort>` function:
 
    .. code-block:: cpp
 
@@ -229,7 +229,7 @@ Explanation
         imagePoints.clear();
       }
 
-#. **Show the distortion removal for the images too**. When you work with an image list it is not possible to remove the distortion inside the loop. Therefore, you must do this after the loop. Taking advantage of this now I'll expand the :imgproc_geometric:`undistort <undistort>` function, which is in fact first calls :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` to find transformation matrices and then performs transformation using :imgproc_geometric:`remap <remap>` function. Because, after successful calibration map calculation needs to be done only once, by using this expanded form you may speed up your application: 
+#. **Show the distortion removal for the images too**. When you work with an image list it is not possible to remove the distortion inside the loop. Therefore, you must do this after the loop. Taking advantage of this now I'll expand the :imgproc_geometric:`undistort <undistort>` function, which is in fact first calls :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` to find transformation matrices and then performs transformation using :imgproc_geometric:`remap <remap>` function. Because, after successful calibration map calculation needs to be done only once, by using this expanded form you may speed up your application:
 
    .. code-block:: cpp
 
@@ -256,9 +256,9 @@ Explanation
 The calibration and save
 ========================
 
-Because the calibration needs to be done only once per camera, it makes sense to save it after a successful calibration. This way later on you can just load these values into your program. Due to this we first make the calibration, and if it succeeds we save the result into an OpenCV style XML or YAML file, depending on the extension you give in the configuration file. 
+Because the calibration needs to be done only once per camera, it makes sense to save it after a successful calibration. This way later on you can just load these values into your program. Due to this we first make the calibration, and if it succeeds we save the result into an OpenCV style XML or YAML file, depending on the extension you give in the configuration file.
 
-Therefore in the first function we just split up these two processes. Because we want to save many of the calibration variables we'll create these variables here and pass on both of them to the calibration and saving function. Again, I'll not show the saving part as that has little in common with the calibration. Explore the source file in order to find out how and what: 
+Therefore in the first function we just split up these two processes. Because we want to save many of the calibration variables we'll create these variables here and pass on both of them to the calibration and saving function. Again, I'll not show the saving part as that has little in common with the calibration. Explore the source file in order to find out how and what:
 
 .. code-block:: cpp
 
@@ -269,10 +269,10 @@ Therefore in the first function we just split up these two processes. Because we
     vector<float> reprojErrs;
     double totalAvgErr = 0;
 
-    bool ok = runCalibration(s,imageSize, cameraMatrix, distCoeffs, imagePoints, rvecs, tvecs, 
+    bool ok = runCalibration(s,imageSize, cameraMatrix, distCoeffs, imagePoints, rvecs, tvecs,
                              reprojErrs, totalAvgErr);
     cout << (ok ? "Calibration succeeded" : "Calibration failed")
-        << ". avg re projection error = "  << totalAvgErr ; 
+        << ". avg re projection error = "  << totalAvgErr ;
 
     if( ok )   // save only if the calibration was done with success
         saveCameraParams( s, imageSize, cameraMatrix, distCoeffs, rvecs ,tvecs, reprojErrs,
@@ -280,15 +280,15 @@ Therefore in the first function we just split up these two processes. Because we
     return ok;
    }
 
-We do the calibration with the help of the :calib3d:`calibrateCamera <calibratecamera>` function. It has the following parameters: 
+We do the calibration with the help of the :calib3d:`calibrateCamera <calibratecamera>` function. It has the following parameters:
 
 .. container:: enumeratevisibleitemswithsquare
 
-   + The object points. This is a vector of *Point3f* vector that for each input image describes how should the pattern look. If we have a planar pattern (like a chessboard) then we can simply set all Z coordinates to zero. This is a collection of the points where these important points are present. Because, we use a single pattern for all the input images we can calculate this just once and multiply it for all the other input views. We calculate the corner points with the *calcBoardCornerPositions* function as: 
+   + The object points. This is a vector of *Point3f* vector that for each input image describes how should the pattern look. If we have a planar pattern (like a chessboard) then we can simply set all Z coordinates to zero. This is a collection of the points where these important points are present. Because, we use a single pattern for all the input images we can calculate this just once and multiply it for all the other input views. We calculate the corner points with the *calcBoardCornerPositions* function as:
 
      .. code-block:: cpp
 
-        void calcBoardCornerPositions(Size boardSize, float squareSize, vector<Point3f>& corners, 
+        void calcBoardCornerPositions(Size boardSize, float squareSize, vector<Point3f>& corners,
                           Settings::Pattern patternType /*= Settings::CHESSBOARD*/)
         {
         corners.clear();
@@ -310,19 +310,19 @@ We do the calibration with the help of the :calib3d:`calibrateCamera <calibratec
         }
         }
 
-     And then multiply it as: 
+     And then multiply it as:
 
-     .. code-block:: cpp 
+     .. code-block:: cpp
 
         vector<vector<Point3f> > objectPoints(1);
         calcBoardCornerPositions(s.boardSize, s.squareSize, objectPoints[0], s.calibrationPattern);
-        objectPoints.resize(imagePoints.size(),objectPoints[0]); 
+        objectPoints.resize(imagePoints.size(),objectPoints[0]);
 
-   + The image points. This is a vector of *Point2f* vector which for each input image contains coordinates of the important points (corners for chessboard and centers of the circles for the circle pattern). We have already collected this from :calib3d:`findChessboardCorners <findchessboardcorners>` or :calib3d:`findCirclesGrid <findcirclesgrid>` function. We just need to pass it on. 
+   + The image points. This is a vector of *Point2f* vector which for each input image contains coordinates of the important points (corners for chessboard and centers of the circles for the circle pattern). We have already collected this from :calib3d:`findChessboardCorners <findchessboardcorners>` or :calib3d:`findCirclesGrid <findcirclesgrid>` function. We just need to pass it on.
 
-   + The size of the image acquired from the camera, video file or the images. 
+   + The size of the image acquired from the camera, video file or the images.
 
-   + The camera matrix. If we used the fixed aspect ratio option we need to set the :math:`f_x` to zero: 
+   + The camera matrix. If we used the fixed aspect ratio option we need to set the :math:`f_x` to zero:
 
      .. code-block:: cpp
 
@@ -330,24 +330,24 @@ We do the calibration with the help of the :calib3d:`calibrateCamera <calibratec
         if( s.flag & CV_CALIB_FIX_ASPECT_RATIO )
              cameraMatrix.at<double>(0,0) = 1.0;
 
-   + The distortion coefficient matrix. Initialize with zero. 
+   + The distortion coefficient matrix. Initialize with zero.
 
      .. code-block:: cpp
 
         distCoeffs = Mat::zeros(8, 1, CV_64F);
 
-   + For all the views the function will calculate rotation and translation vectors which transform the object points (given in the model coordinate space) to the image points (given in the world coordinate space). The 7-th and 8-th parameters are the output vector of matrices containing in the i-th position the rotation and translation vector for the i-th object point to the i-th image point. 
+   + For all the views the function will calculate rotation and translation vectors which transform the object points (given in the model coordinate space) to the image points (given in the world coordinate space). The 7-th and 8-th parameters are the output vector of matrices containing in the i-th position the rotation and translation vector for the i-th object point to the i-th image point.
 
-   + The final argument is the flag. You need to specify here options like fix the aspect ratio for the focal length, assume zero tangential distortion or to fix the principal point. 
+   + The final argument is the flag. You need to specify here options like fix the aspect ratio for the focal length, assume zero tangential distortion or to fix the principal point.
 
    .. code-block:: cpp
 
      double rms = calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix,
                                  distCoeffs, rvecs, tvecs, s.flag|CV_CALIB_FIX_K4|CV_CALIB_FIX_K5);
 
-   + The function returns the average re-projection error. This number gives a good estimation of precision of the found parameters. This should be as close to zero as possible. Given the intrinsic, distortion, rotation and translation matrices we may calculate the error for one view by using the :calib3d:`projectPoints <projectpoints>` to first transform the object point to image point. Then we calculate the absolute norm between what we got with our transformation and the corner/circle finding algorithm. To find the average error we calculate the arithmetical mean of the errors calculated for all the calibration images. 
+   + The function returns the average re-projection error. This number gives a good estimation of precision of the found parameters. This should be as close to zero as possible. Given the intrinsic, distortion, rotation and translation matrices we may calculate the error for one view by using the :calib3d:`projectPoints <projectpoints>` to first transform the object point to image point. Then we calculate the absolute norm between what we got with our transformation and the corner/circle finding algorithm. To find the average error we calculate the arithmetical mean of the errors calculated for all the calibration images.
 
-     .. code-block:: cpp 
+     .. code-block:: cpp
 
         double computeReprojectionErrors( const vector<vector<Point3f> >& objectPoints,
                                   const vector<vector<Point2f> >& imagePoints,
@@ -378,7 +378,7 @@ We do the calibration with the help of the :calib3d:`calibrateCamera <calibratec
 Results
 =======
 
-Let there be :download:`this input chessboard pattern <../../../pattern.png>` which has a size of 9 X 6. I've used an AXIS IP camera to create a couple of snapshots of the board and saved it into VID5 directory. I've put this inside the :file:`images/CameraCalibration` folder of my working directory and created the following :file:`VID5.XML` file that describes which images to use: 
+Let there be :download:`this input chessboard pattern <../../../pattern.png>` which has a size of 9 X 6. I've used an AXIS IP camera to create a couple of snapshots of the board and saved it into VID5 directory. I've put this inside the :file:`images/CameraCalibration` folder of my working directory and created the following :file:`VID5.XML` file that describes which images to use:
 
 .. code-block:: xml
 
@@ -396,25 +396,25 @@ Let there be :download:`this input chessboard pattern <../../../pattern.png>` wh
    </images>
    </opencv_storage>
 
-Then passed :file:`images/CameraCalibration/VID5/VID5.XML` as an input in the configuration file. Here's a chessboard pattern found during the runtime of the application: 
+Then passed :file:`images/CameraCalibration/VID5/VID5.XML` as an input in the configuration file. Here's a chessboard pattern found during the runtime of the application:
 
-.. image:: images/fileListImage.jpg 
+.. image:: images/fileListImage.jpg
    :alt: A found chessboard
    :align: center
 
-After applying the distortion removal we get: 
+After applying the distortion removal we get:
 
-.. image:: images/fileListImageUnDist.jpg 
+.. image:: images/fileListImageUnDist.jpg
    :alt: Distortion removal for File List
    :align: center
 
-The same works for :download:`this asymmetrical circle pattern <../../../acircles_pattern.png>` by setting the input width to 4 and height to 11. This time I've used a live camera feed by specifying its ID ("1") for the input. Here's, how a detected pattern should look: 
+The same works for :download:`this asymmetrical circle pattern <../../../acircles_pattern.png>` by setting the input width to 4 and height to 11. This time I've used a live camera feed by specifying its ID ("1") for the input. Here's, how a detected pattern should look:
 
-.. image:: images/asymetricalPattern.jpg 
+.. image:: images/asymetricalPattern.jpg
    :alt: Asymmetrical circle detection
    :align: center
 
-In both cases in the specified output XML/YAML file you'll find the camera and distortion coefficients matrices: 
+In both cases in the specified output XML/YAML file you'll find the camera and distortion coefficients matrices:
 
 .. code-block:: cpp
 
@@ -433,9 +433,9 @@ In both cases in the specified output XML/YAML file you'll find the camera and d
     -4.1802327176423804e-001 5.0715244063187526e-001 0. 0.
     -5.7843597214487474e-001</data></Distortion_Coefficients>
 
-Add these values as constants to your program, call the :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` and the :imgproc_geometric:`remap <remap>` function to remove distortion and enjoy distortion free inputs for cheap and low quality cameras. 
+Add these values as constants to your program, call the :imgproc_geometric:`initUndistortRectifyMap <initundistortrectifymap>` and the :imgproc_geometric:`remap <remap>` function to remove distortion and enjoy distortion free inputs for cheap and low quality cameras.
 
-You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=ViPN810E0SU>`_. 
+You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=ViPN810E0SU>`_.
 
 .. raw:: html
 
index ec7354b..4eff264 100644 (file)
@@ -7,16 +7,16 @@ Camera calibration with square chessboard
 
 The goal of this tutorial is to learn how to calibrate a camera given a set of chessboard images.
 
-*Test data*: use images in your data/chess folder. 
+*Test data*: use images in your data/chess folder.
 
 #.
-    Compile opencv with samples by setting ``BUILD_EXAMPLES`` to ``ON`` in cmake configuration. 
+    Compile opencv with samples by setting ``BUILD_EXAMPLES`` to ``ON`` in cmake configuration.
 
 #.
     Go to ``bin`` folder and use ``imagelist_creator`` to create an ``XML/YAML`` list of your images.
-    
+
 #.
-    Then, run ``calibration`` sample to get camera parameters. Use square size equal to 3cm. 
+    Then, run ``calibration`` sample to get camera parameters. Use square size equal to 3cm.
 
 Pose estimation
 ===============
@@ -57,6 +57,6 @@ Now, let us write a code that detects a chessboard in a new image and finds its
                              distCoeffs, rvec, tvec, false);
 
 #.
-    Calculate reprojection error like it is done in ``calibration`` sample (see ``opencv/samples/cpp/calibration.cpp``, function ``computeReprojectionErrors``). 
+    Calculate reprojection error like it is done in ``calibration`` sample (see ``opencv/samples/cpp/calibration.cpp``, function ``computeReprojectionErrors``).
 
-Question: how to calculate the distance from the camera origin to any of the corners? 
\ No newline at end of file
+Question: how to calculate the distance from the camera origin to any of the corners?
\ No newline at end of file
index 3d45664..91f80b7 100644 (file)
@@ -3,11 +3,11 @@
 *calib3d* module. Camera calibration and 3D reconstruction
 -----------------------------------------------------------
 
-Although we got most of our images in a 2D format they do come from a 3D world. Here you will learn how to find out from the 2D images information about the 3D world. 
+Although we got most of our images in a 2D format they do come from a 3D world. Here you will learn how to find out from the 2D images information about the 3D world.
 
-.. include:: ../../definitions/tocDefinitions.rst 
+.. include:: ../../definitions/tocDefinitions.rst
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
@@ -26,7 +26,7 @@ Although we got most of our images in a 2D format they do come from a 3D world.
      :height: 90pt
      :width:  90pt
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
index 13e4063..e313569 100644 (file)
@@ -18,7 +18,7 @@ Theory
 
 .. note::
 
-   The explanation below belongs to the book `Computer Vision: Algorithms and Applications <http://szeliski.org/Book/>`_  by Richard Szeliski 
+   The explanation below belongs to the book `Computer Vision: Algorithms and Applications <http://szeliski.org/Book/>`_  by Richard Szeliski
 
 From our previous tutorial, we know already a bit of *Pixel operators*. An interesting dyadic (two-input) operator is the *linear blend operator*:
 
@@ -43,7 +43,7 @@ As usual, after the not-so-lengthy explanation, let's go to the code:
 
    int main( int argc, char** argv )
    {
-    double alpha = 0.5; double beta; double input; 
+    double alpha = 0.5; double beta; double input;
 
     Mat src1, src2, dst;
 
@@ -69,7 +69,7 @@ As usual, after the not-so-lengthy explanation, let's go to the code:
 
     beta = ( 1.0 - alpha );
     addWeighted( src1, alpha, src2, beta, 0.0, dst);
-  
+
     imshow( "Linear Blend", dst );
 
     waitKey(0);
@@ -99,10 +99,10 @@ Explanation
 #. Now we need to generate the :math:`g(x)` image. For this, the function :add_weighted:`addWeighted <>` comes quite handy:
 
    .. code-block:: cpp
-   
+
       beta = ( 1.0 - alpha );
       addWeighted( src1, alpha, src2, beta, 0.0, dst);
+
    since :add_weighted:`addWeighted <>` produces:
 
    .. math::
@@ -110,12 +110,12 @@ Explanation
       dst = \alpha \cdot src1 + \beta \cdot src2 + \gamma
 
    In this case, :math:`\gamma` is the argument :math:`0.0` in the code above.
-#. Create windows, show the images and wait for the user to end the program. 
+
+#. Create windows, show the images and wait for the user to end the program.
 
 Result
 =======
 
 .. image:: images/Adding_Images_Tutorial_Result_0.jpg
    :alt: Blending Images Tutorial - Final Result
-   :align: center 
+   :align: center
index 097e79e..613f4e1 100644 (file)
@@ -10,7 +10,7 @@ In this tutorial you will learn how to:
 
 .. container:: enumeratevisibleitemswithsquare
 
-   + Access pixel values 
+   + Access pixel values
 
    + Initialize a matrix with zeros
 
@@ -20,16 +20,16 @@ In this tutorial you will learn how to:
 
 Theory
 =======
+
 .. note::
-   The explanation below belongs to the book `Computer Vision: Algorithms and Applications <http://szeliski.org/Book/>`_  by Richard Szeliski 
+   The explanation below belongs to the book `Computer Vision: Algorithms and Applications <http://szeliski.org/Book/>`_  by Richard Szeliski
 
 Image Processing
 --------------------
 
 .. container:: enumeratevisibleitemswithsquare
 
-   * A general image processing operator is a function that takes one or more input images and produces an output image. 
+   * A general image processing operator is a function that takes one or more input images and produces an output image.
 
    * Image transforms can be seen as:
 
@@ -54,18 +54,18 @@ Brightness and contrast adjustments
    * Two commonly used point processes are *multiplication* and *addition* with a constant:
 
      .. math::
+
         g(x) = \alpha f(x) + \beta
-  
+
    * The parameters :math:`\alpha > 0` and :math:`\beta` are often called the *gain* and *bias* parameters; sometimes these parameters are said to control *contrast* and *brightness* respectively.
 
    * You can think of :math:`f(x)` as the source image pixels and :math:`g(x)` as the output image pixels. Then, more conveniently we can write the expression as:
 
      .. math::
-   
+
         g(i,j) = \alpha \cdot f(i,j) + \beta
-  
-     where :math:`i` and :math:`j` indicates that the pixel is located in the *i-th* row and *j-th* column. 
+
+     where :math:`i` and :math:`j` indicates that the pixel is located in the *i-th* row and *j-th* column.
 
 Code
 =====
@@ -91,7 +91,7 @@ Code
     Mat image = imread( argv[1] );
     Mat new_image = Mat::zeros( image.size(), image.type() );
 
-    /// Initialize values 
+    /// Initialize values
     std::cout<<" Basic Linear Transforms "<<std::endl;
     std::cout<<"-------------------------"<<std::endl;
     std::cout<<"* Enter the alpha value [1.0-3.0]: ";std::cin>>alpha;
@@ -102,7 +102,7 @@ Code
        { for( int x = 0; x < image.cols; x++ )
             { for( int c = 0; c < 3; c++ )
                  {
-         new_image.at<Vec3b>(y,x)[c] = 
+         new_image.at<Vec3b>(y,x)[c] =
             saturate_cast<uchar>( alpha*( image.at<Vec3b>(y,x)[c] ) + beta );
                 }
        }
@@ -133,41 +133,41 @@ Explanation
 
 
 #. We load an image using :imread:`imread <>` and save it in a Mat object:
-   
+
    .. code-block:: cpp
 
       Mat image = imread( argv[1] );
 
 #. Now, since we will make some transformations to this image, we need a new Mat object to store it. Also, we want this to have the following features:
-   
+
    .. container:: enumeratevisibleitemswithsquare
 
       * Initial pixel values equal to zero
       * Same size and type as the original image
+
    .. code-block:: cpp
 
-      Mat new_image = Mat::zeros( image.size(), image.type() ); 
-   We observe that :mat_zeros:`Mat::zeros <>` returns a Matlab-style zero initializer based on *image.size()* and *image.type()*  
+      Mat new_image = Mat::zeros( image.size(), image.type() );
+
+   We observe that :mat_zeros:`Mat::zeros <>` returns a Matlab-style zero initializer based on *image.size()* and *image.type()*
 
 #. Now, to perform the operation :math:`g(i,j) = \alpha \cdot f(i,j) + \beta` we will access to each pixel in image. Since we are operating with RGB images, we will have three values per pixel (R, G and B), so we will also access them separately. Here is the piece of code:
 
    .. code-block:: cpp
+
       for( int y = 0; y < image.rows; y++ )
          { for( int x = 0; x < image.cols; x++ )
               { for( int c = 0; c < 3; c++ )
-                   { new_image.at<Vec3b>(y,x)[c] = 
+                   { new_image.at<Vec3b>(y,x)[c] =
                                saturate_cast<uchar>( alpha*( image.at<Vec3b>(y,x)[c] ) + beta ); }
          }
          }
+
    Notice the following:
 
    .. container:: enumeratevisibleitemswithsquare
 
-      * To access each pixel in the images we are using this syntax: *image.at<Vec3b>(y,x)[c]* where *y* is the row, *x* is the column and *c* is R, G or B (0, 1 or 2). 
+      * To access each pixel in the images we are using this syntax: *image.at<Vec3b>(y,x)[c]* where *y* is the row, *x* is the column and *c* is R, G or B (0, 1 or 2).
 
       * Since the operation :math:`\alpha \cdot p(i,j) + \beta` can give values out of range or not integers (if :math:`\alpha` is float), we use :saturate_cast:`saturate_cast <>` to make sure the values are valid.
 
@@ -175,7 +175,7 @@ Explanation
 #. Finally, we create windows and show the images, the usual way.
 
    .. code-block:: cpp
-   
+
       namedWindow("Original Image", 1);
       namedWindow("New Image", 1);
 
@@ -185,9 +185,9 @@ Explanation
       waitKey(0);
 
 .. note::
-  
+
    Instead of using the **for** loops to access each pixel, we could have simply used this command:
-  
+
    .. code-block:: cpp
 
       image.convertTo(new_image, -1, alpha, beta);
@@ -211,4 +211,4 @@ Result
 
 .. image:: images/Basic_Linear_Transform_Tutorial_Result_0.jpg
    :alt: Basic Linear Transform - Final Result
-   :align: center 
+   :align: center
index b5f8e77..b7cf446 100644 (file)
@@ -4,22 +4,22 @@ Discrete Fourier Transform
 **************************
 
 Goal
-==== 
+====
 
-We'll seek answers for the following questions: 
+We'll seek answers for the following questions:
 
 .. container:: enumeratevisibleitemswithsquare
 
-   + What is a Fourier transform and why use it? 
-   + How to do it in OpenCV? 
+   + What is a Fourier transform and why use it?
+   + How to do it in OpenCV?
    + Usage of functions such as: :imgprocfilter:`copyMakeBorder() <copymakeborder>`, :operationsonarrays:`merge() <merge>`, :operationsonarrays:`dft() <dft>`, :operationsonarrays:`getOptimalDFTSize() <getoptimaldftsize>`, :operationsonarrays:`log() <log>` and :operationsonarrays:`normalize() <normalize>` .
 
 Source code
 ===========
 
-You can :download:`download this from here <../../../../samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp>` or find it in the :file:`samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp` of the OpenCV source code library. 
+You can :download:`download this from here <../../../../samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp>` or find it in the :file:`samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp` of the OpenCV source code library.
 
-Here's a sample usage of :operationsonarrays:`dft() <dft>` : 
+Here's a sample usage of :operationsonarrays:`dft() <dft>` :
 
 .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/discrete_fourier_transform/discrete_fourier_transform.cpp
    :language: cpp
@@ -30,11 +30,11 @@ Here's a sample usage of :operationsonarrays:`dft() <dft>` :
 Explanation
 ===========
 
-The Fourier Transform will decompose an image into its sinus and cosines components. In other words, it will transform an image from its spatial domain to its frequency domain. The idea is that any function may be approximated exactly with the sum of infinite sinus and cosines functions. The Fourier Transform is a way how to do this. Mathematically a two dimensional images Fourier transform is: 
+The Fourier Transform will decompose an image into its sinus and cosines components. In other words, it will transform an image from its spatial domain to its frequency domain. The idea is that any function may be approximated exactly with the sum of infinite sinus and cosines functions. The Fourier Transform is a way how to do this. Mathematically a two dimensional images Fourier transform is:
 
 .. math::
 
-   F(k,l) = \displaystyle\sum\limits_{i=0}^{N-1}\sum\limits_{j=0}^{N-1} f(i,j)e^{-i2\pi(\frac{ki}{N}+\frac{lj}{N})} 
+   F(k,l) = \displaystyle\sum\limits_{i=0}^{N-1}\sum\limits_{j=0}^{N-1} f(i,j)e^{-i2\pi(\frac{ki}{N}+\frac{lj}{N})}
 
    e^{ix} = \cos{x} + i\sin {x}
 
@@ -44,65 +44,65 @@ In this sample I'll show how to calculate and show the *magnitude* image of a Fo
 
 1. **Expand the image to an optimal size**. The performance of a DFT is dependent of the image size. It tends to be the fastest for image sizes that are multiple of the numbers two, three and five. Therefore, to achieve maximal performance it is generally a good idea to pad border values to the image to get a size with such traits. The :operationsonarrays:`getOptimalDFTSize() <getoptimaldftsize>` returns this optimal size and we can use the :imgprocfilter:`copyMakeBorder() <copymakeborder>` function to expand the borders of an image:
 
-   .. code-block:: cpp 
+   .. code-block:: cpp
 
       Mat padded;                            //expand input image to optimal size
       int m = getOptimalDFTSize( I.rows );
       int n = getOptimalDFTSize( I.cols ); // on the border add zero pixels
       copyMakeBorder(I, padded, 0, m - I.rows, 0, n - I.cols, BORDER_CONSTANT, Scalar::all(0));
 
-   The appended pixels are initialized with zero. 
+   The appended pixels are initialized with zero.
 
 2. **Make place for both the complex and the real values**. The result of a Fourier Transform is complex. This implies that for each image value the result is two image values (one per component). Moreover, the frequency domains range is much larger than its spatial counterpart. Therefore, we store these usually at least in a *float* format. Therefore we'll convert our input image to this type and expand it with another channel to hold the complex values:
 
-   .. code-block:: cpp 
+   .. code-block:: cpp
 
        Mat planes[] = {Mat_<float>(padded), Mat::zeros(padded.size(), CV_32F)};
        Mat complexI;
        merge(planes, 2, complexI);         // Add to the expanded another plane with zeros
 
-3. **Make the Discrete Fourier Transform**. It's possible an in-place calculation (same input as output): 
+3. **Make the Discrete Fourier Transform**. It's possible an in-place calculation (same input as output):
 
-   .. code-block:: cpp 
+   .. code-block:: cpp
 
       dft(complexI, complexI);            // this way the result may fit in the source matrix
 
-4. **Transform the real and complex values to magnitude**. A complex number has a real (*Re*) and a complex (imaginary - *Im*) part. The results of a DFT are complex numbers. The magnitude of a DFT is: 
+4. **Transform the real and complex values to magnitude**. A complex number has a real (*Re*) and a complex (imaginary - *Im*) part. The results of a DFT are complex numbers. The magnitude of a DFT is:
 
    .. math::
 
       M = \sqrt[2]{ {Re(DFT(I))}^2 + {Im(DFT(I))}^2}
 
-   Translated to OpenCV code: 
+   Translated to OpenCV code:
 
-   .. code-block:: cpp 
+   .. code-block:: cpp
 
       split(complexI, planes);                   // planes[0] = Re(DFT(I), planes[1] = Im(DFT(I))
-      magnitude(planes[0], planes[1], planes[0]);// planes[0] = magnitude  
+      magnitude(planes[0], planes[1], planes[0]);// planes[0] = magnitude
       Mat magI = planes[0];
 
-5. **Switch to a logarithmic scale**. It turns out that the dynamic range of the Fourier coefficients is too large to be displayed on the screen. We have some small and some high changing values that we can't observe like this. Therefore the high values will all turn out as white points, while the small ones as black. To use the gray scale values to for visualization we can transform our linear scale to a logarithmic one: 
+5. **Switch to a logarithmic scale**. It turns out that the dynamic range of the Fourier coefficients is too large to be displayed on the screen. We have some small and some high changing values that we can't observe like this. Therefore the high values will all turn out as white points, while the small ones as black. To use the gray scale values to for visualization we can transform our linear scale to a logarithmic one:
 
    .. math::
 
       M_1 = \log{(1 + M)}
 
-   Translated to OpenCV code: 
+   Translated to OpenCV code:
 
-   .. code-block:: cpp 
+   .. code-block:: cpp
 
       magI += Scalar::all(1);                    // switch to logarithmic scale
       log(magI, magI);
 
-6. **Crop and rearrange**. Remember, that at the first step, we expanded the image? Well, it's time to throw away the newly introduced values. For visualization purposes we may also rearrange the quadrants of the result, so that the origin (zero, zero) corresponds with the image center. 
+6. **Crop and rearrange**. Remember, that at the first step, we expanded the image? Well, it's time to throw away the newly introduced values. For visualization purposes we may also rearrange the quadrants of the result, so that the origin (zero, zero) corresponds with the image center.
 
-   .. code-block:: cpp 
+   .. code-block:: cpp
 
       magI = magI(Rect(0, 0, magI.cols & -2, magI.rows & -2));
       int cx = magI.cols/2;
       int cy = magI.rows/2;
 
-      Mat q0(magI, Rect(0, 0, cx, cy));   // Top-Left - Create a ROI per quadrant 
+      Mat q0(magI, Rect(0, 0, cx, cy));   // Top-Left - Create a ROI per quadrant
       Mat q1(magI, Rect(cx, 0, cx, cy));  // Top-Right
       Mat q2(magI, Rect(0, cy, cx, cy));  // Bottom-Left
       Mat q3(magI, Rect(cx, cy, cx, cy)); // Bottom-Right
@@ -116,25 +116,25 @@ In this sample I'll show how to calculate and show the *magnitude* image of a Fo
       q2.copyTo(q1);
       tmp.copyTo(q2);
 
-7.  **Normalize**. This is done again for visualization purposes. We now have the magnitudes, however this are still out of our image display range of zero to one. We normalize our values to this range using the :operationsonarrays:`normalize() <normalize>` function. 
+7.  **Normalize**. This is done again for visualization purposes. We now have the magnitudes, however this are still out of our image display range of zero to one. We normalize our values to this range using the :operationsonarrays:`normalize() <normalize>` function.
 
-   .. code-block:: cpp 
+   .. code-block:: cpp
 
-      normalize(magI, magI, 0, 1, CV_MINMAX); // Transform the matrix with float values into a 
+      normalize(magI, magI, 0, 1, CV_MINMAX); // Transform the matrix with float values into a
                                               // viewable image form (float between values 0 and 1).
 
 Result
 ======
 
-An application idea would be to determine the geometrical orientation present in the image. For example, let us find out if a text is horizontal or not? Looking at some text you'll notice that the text lines sort of form also horizontal lines and the letters form sort of vertical lines. These two main components of a text snippet may be also seen in case of the Fourier transform. Let us use :download:`this horizontal <../../../../samples/cpp/tutorial_code/images/imageTextN.png>` and :download:`this rotated<../../../../samples/cpp/tutorial_code/images/imageTextR.png>` image about a text. 
+An application idea would be to determine the geometrical orientation present in the image. For example, let us find out if a text is horizontal or not? Looking at some text you'll notice that the text lines sort of form also horizontal lines and the letters form sort of vertical lines. These two main components of a text snippet may be also seen in case of the Fourier transform. Let us use :download:`this horizontal <../../../../samples/cpp/tutorial_code/images/imageTextN.png>` and :download:`this rotated<../../../../samples/cpp/tutorial_code/images/imageTextR.png>` image about a text.
 
-In case of the horizontal text: 
+In case of the horizontal text:
 
 .. image:: images/result_normal.jpg
    :alt: In case of normal text
    :align: center
 
-In case of a rotated text: 
+In case of a rotated text:
 
 .. image:: images/result_rotated.jpg
    :alt: In case of rotated text
index 44eed2e..87166b7 100644 (file)
@@ -4,9 +4,9 @@ File Input and Output using XML and YAML files
 **********************************************
 
 Goal
-==== 
+====
 
-You'll find answers for the following questions: 
+You'll find answers for the following questions:
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -18,7 +18,7 @@ You'll find answers for the following questions:
 Source code
 ===========
 
-You can :download:`download this from here <../../../../samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp>` or find it in the :file:`samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp` of the OpenCV source code library. 
+You can :download:`download this from here <../../../../samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp>` or find it in the :file:`samples/cpp/tutorial_code/core/file_input_output/file_input_output.cpp` of the OpenCV source code library.
 
 Here's a sample code of how to achieve all the stuff enumerated at the goal list.
 
@@ -31,9 +31,9 @@ Here's a sample code of how to achieve all the stuff enumerated at the goal list
 Explanation
 ===========
 
-Here we talk only about XML and YAML file inputs. Your output (and its respective input) file may have only one of these extensions and the structure coming from this. They are two kinds of data structures you may serialize: *mappings* (like the STL map) and *element sequence* (like the STL vector>. The difference between these is that in a map every element has a unique name through what you may access it. For sequences you need to go through them to query a specific item. 
+Here we talk only about XML and YAML file inputs. Your output (and its respective input) file may have only one of these extensions and the structure coming from this. They are two kinds of data structures you may serialize: *mappings* (like the STL map) and *element sequence* (like the STL vector>. The difference between these is that in a map every element has a unique name through what you may access it. For sequences you need to go through them to query a specific item.
 
-1. **XML\\YAML File Open and Close.** Before you write any content to such file you need to open it and at the end to close it. The XML\YAML data structure in OpenCV is :xmlymlpers:`FileStorage <filestorage>`. To specify that this structure to which file binds on your hard drive you can use either its constructor or the *open()* function of this: 
+1. **XML\\YAML File Open and Close.** Before you write any content to such file you need to open it and at the end to close it. The XML\YAML data structure in OpenCV is :xmlymlpers:`FileStorage <filestorage>`. To specify that this structure to which file binds on your hard drive you can use either its constructor or the *open()* function of this:
 
    .. code-block:: cpp
 
@@ -42,29 +42,29 @@ Here we talk only about XML and YAML file inputs. Your output (and its respectiv
       \\...
       fs.open(filename, FileStorage::READ);
 
-   Either one of this you use the second argument is a constant specifying the type of operations you'll be able to on them: WRITE, READ or APPEND. The extension specified in the file name also determinates the output format that will be used. The output may be even compressed if you specify an extension such as *.xml.gz*. 
+   Either one of this you use the second argument is a constant specifying the type of operations you'll be able to on them: WRITE, READ or APPEND. The extension specified in the file name also determinates the output format that will be used. The output may be even compressed if you specify an extension such as *.xml.gz*.
+
+   The file automatically closes when the :xmlymlpers:`FileStorage <filestorage>` objects is destroyed. However, you may explicitly call for this by using the *release* function:
 
-   The file automatically closes when the :xmlymlpers:`FileStorage <filestorage>` objects is destroyed. However, you may explicitly call for this by using the *release* function: 
-   
    .. code-block:: cpp
 
       fs.release();                                       // explicit close
 
-#. **Input and Output of text and numbers.** The data structure uses the same << output operator that the STL library. For outputting any type of data structure we need first to specify its name. We do this by just simply printing out the name of this. For basic types you may follow this with the print of the value : 
+#. **Input and Output of text and numbers.** The data structure uses the same << output operator that the STL library. For outputting any type of data structure we need first to specify its name. We do this by just simply printing out the name of this. For basic types you may follow this with the print of the value :
 
    .. code-block:: cpp
 
       fs << "iterationNr" << 100;
 
-   Reading in is a simple addressing (via the [] operator) and casting operation or a read via the >> operator : 
+   Reading in is a simple addressing (via the [] operator) and casting operation or a read via the >> operator :
 
    .. code-block:: cpp
 
-      int itNr; 
+      int itNr;
       fs["iterationNr"] >> itNr;
       itNr = (int) fs["iterationNr"];
 
-#. **Input\\Output of OpenCV Data structures.** Well these behave exactly just as the basic C++ types: 
+#. **Input\\Output of OpenCV Data structures.** Well these behave exactly just as the basic C++ types:
 
    .. code-block:: cpp
 
@@ -77,7 +77,7 @@ Here we talk only about XML and YAML file inputs. Your output (and its respectiv
       fs["R"] >> R;                                      // Read cv::Mat
       fs["T"] >> T;
 
-#. **Input\\Output of vectors (arrays) and associative maps.** As I mentioned beforehand we can output maps and sequences (array, vector) too. Again we first print the name of the variable and then we have to specify if our output is either a sequence or map. 
+#. **Input\\Output of vectors (arrays) and associative maps.** As I mentioned beforehand we can output maps and sequences (array, vector) too. Again we first print the name of the variable and then we have to specify if our output is either a sequence or map.
 
    For sequence before the first element print the "[" character and after the last one the "]" character:
 
@@ -95,7 +95,7 @@ Here we talk only about XML and YAML file inputs. Your output (and its respectiv
         fs << "{" << "One" << 1;
         fs <<        "Two" << 2 << "}";
 
-   To read from these we use the :xmlymlpers:`FileNode <filenode>` and the :xmlymlpers:`FileNodeIterator <filenodeiterator>` data structures. The [] operator of the :xmlymlpers:`FileStorage <filestorage>` class returns a :xmlymlpers:`FileNode <filenode>` data type. If the node is sequential we can use the :xmlymlpers:`FileNodeIterator <filenodeiterator>` to iterate through the items: 
+   To read from these we use the :xmlymlpers:`FileNode <filenode>` and the :xmlymlpers:`FileNodeIterator <filenodeiterator>` data structures. The [] operator of the :xmlymlpers:`FileStorage <filestorage>` class returns a :xmlymlpers:`FileNode <filenode>` data type. If the node is sequential we can use the :xmlymlpers:`FileNodeIterator <filenodeiterator>` to iterate through the items:
 
    .. code-block:: cpp
 
@@ -115,8 +115,8 @@ Here we talk only about XML and YAML file inputs. Your output (and its respectiv
    .. code-block:: cpp
 
       n = fs["Mapping"];                                // Read mappings from a sequence
-      cout << "Two  " << (int)(n["Two"]) << "; "; 
-      cout << "One  " << (int)(n["One"]) << endl << endl; 
+      cout << "Two  " << (int)(n["Two"]) << "; ";
+      cout << "One  " << (int)(n["One"]) << endl << endl;
 
 #. **Read and write your own data structures.** Suppose you have a data structure such as:
 
@@ -148,7 +148,7 @@ Here we talk only about XML and YAML file inputs. Your output (and its respectiv
         id = (string)node["id"];
       }
 
-   Then you need to add the following functions definitions outside the class: 
+   Then you need to add the following functions definitions outside the class:
 
    .. code-block:: cpp
 
@@ -175,17 +175,17 @@ Here we talk only about XML and YAML file inputs. Your output (and its respectiv
       fs << "MyData" << m;                                // your own data structures
       fs["MyData"] >> m;                                 // Read your own structure_
 
-   Or to try out reading a non-existing read: 
+   Or to try out reading a non-existing read:
 
    .. code-block:: cpp
 
-      fs["NonExisting"] >> m;   // Do not add a fs << "NonExisting" << m command for this to work 
+      fs["NonExisting"] >> m;   // Do not add a fs << "NonExisting" << m command for this to work
       cout << endl << "NonExisting = " << endl << m << endl;
 
 Result
 ======
 
-Well mostly we just print out the defined numbers. On the screen of your console you could see: 
+Well mostly we just print out the defined numbers. On the screen of your console you could see:
 
 .. code-block:: bash
 
@@ -212,7 +212,7 @@ Well mostly we just print out the defined numbers. On the screen of your console
 
    Tip: Open up output.xml with a text editor to see the serialized data.
 
-Nevertheless, it's much more interesting what you may see in the output xml file: 
+Nevertheless, it's much more interesting what you may see in the output xml file:
 
 .. code-block:: xml
 
@@ -242,7 +242,7 @@ Nevertheless, it's much more interesting what you may see in the output xml file
      <id>mydata1234</id></MyData>
    </opencv_storage>
 
-Or the YAML file: 
+Or the YAML file:
 
 .. code-block:: yaml
 
index eba0cae..ef0f864 100644 (file)
@@ -4,9 +4,9 @@ How to scan images, lookup tables and time measurement with OpenCV
 *******************************************************************
 
 Goal
-==== 
+====
 
-We'll seek answers for the following questions: 
+We'll seek answers for the following questions:
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -18,11 +18,11 @@ We'll seek answers for the following questions:
 Our test case
 =============
 
-Let us consider a simple color reduction method. Using the unsigned char C and C++ type for matrix item storing a channel of pixel may have up to 256 different values. For a three channel image this can allow the formation of way too many colors (16 million to be exact). Working with so many color shades may give a heavy blow to our algorithm performance. However, sometimes it is enough to work with a lot less of them to get the same final result. 
+Let us consider a simple color reduction method. Using the unsigned char C and C++ type for matrix item storing a channel of pixel may have up to 256 different values. For a three channel image this can allow the formation of way too many colors (16 million to be exact). Working with so many color shades may give a heavy blow to our algorithm performance. However, sometimes it is enough to work with a lot less of them to get the same final result.
 
-In this cases it's common that we make a *color space reduction*. This means that we divide the color space current value with a new input value to end up with fewer colors. For instance every value between zero and nine takes the new value zero, every value between ten and nineteen the value ten and so on. 
+In this cases it's common that we make a *color space reduction*. This means that we divide the color space current value with a new input value to end up with fewer colors. For instance every value between zero and nine takes the new value zero, every value between ten and nineteen the value ten and so on.
 
-When you divide an *uchar* (unsigned char - aka values between zero and 255) value with an *int* value the result will be also *char*. These values may only be char values. Therefore, any fraction will be rounded down. Taking advantage of this fact the upper operation in the *uchar* domain may be expressed as: 
+When you divide an *uchar* (unsigned char - aka values between zero and 255) value with an *int* value the result will be also *char*. These values may only be char values. Therefore, any fraction will be rounded down. Taking advantage of this fact the upper operation in the *uchar* domain may be expressed as:
 
 .. math::
 
@@ -30,11 +30,11 @@ When you divide an *uchar* (unsigned char - aka values between zero and 255) val
 
 A simple color space reduction algorithm would consist of just passing through every pixel of an image matrix and applying this formula. It's worth noting that we do a divide and a multiplication operation. These operations are bloody expensive for a system. If possible it's worth avoiding them by using cheaper operations such as a few subtractions, addition or in best case a simple assignment. Furthermore, note that we only have a limited number of input values for the upper operation. In case of the *uchar* system this is 256 to be exact.
 
-Therefore, for larger images it would be wise to calculate all possible values beforehand and during the assignment just make the assignment, by using a lookup table. Lookup tables are simple arrays (having one or more dimensions) that for a given input value variation holds the final output value. Its strength lies that we do not need to make the calculation, we just need to read the result. 
+Therefore, for larger images it would be wise to calculate all possible values beforehand and during the assignment just make the assignment, by using a lookup table. Lookup tables are simple arrays (having one or more dimensions) that for a given input value variation holds the final output value. Its strength lies that we do not need to make the calculation, we just need to read the result.
 
-Our test case program (and the sample presented here) will do the following: read in a console line argument image (that may be either color or gray scale - console line argument too) and apply the reduction with the given console line argument integer value. In OpenCV, at the moment they are three major ways of going through an image pixel by pixel. To make things a little more interesting will make the scanning for each image using all of these methods, and print out how long it took. 
+Our test case program (and the sample presented here) will do the following: read in a console line argument image (that may be either color or gray scale - console line argument too) and apply the reduction with the given console line argument integer value. In OpenCV, at the moment they are three major ways of going through an image pixel by pixel. To make things a little more interesting will make the scanning for each image using all of these methods, and print out how long it took.
 
-You can download the full source code :download:`here <../../../../samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp>` or look it up in the samples directory of OpenCV at the cpp tutorial code for the core section. Its basic usage is: 
+You can download the full source code :download:`here <../../../../samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp>` or look it up in the samples directory of OpenCV at the cpp tutorial code for the core section. Its basic usage is:
 
 .. code-block:: bash
 
@@ -45,25 +45,25 @@ The final argument is optional. If given the image will be loaded in gray scale
 .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp
    :language: cpp
    :tab-width: 4
-   :lines: 48-60 
+   :lines: 48-60
 
 Here we first use the C++ *stringstream* class to convert the third command line argument from text to an integer format. Then we use a simple look and the upper formula to calculate the lookup table. No OpenCV specific stuff here.
 
-Another issue is how do we measure time? Well OpenCV offers two simple functions to achieve this :UtilitySystemFunctions:`getTickCount() <gettickcount>` and :UtilitySystemFunctions:`getTickFrequency() <gettickfrequency>`. The first returns the number of ticks of your systems CPU from a certain event (like since you booted your system). The second returns how many times your CPU emits a tick during a second. So to measure in seconds the number of time elapsed between two operations is easy as: 
+Another issue is how do we measure time? Well OpenCV offers two simple functions to achieve this :UtilitySystemFunctions:`getTickCount() <gettickcount>` and :UtilitySystemFunctions:`getTickFrequency() <gettickfrequency>`. The first returns the number of ticks of your systems CPU from a certain event (like since you booted your system). The second returns how many times your CPU emits a tick during a second. So to measure in seconds the number of time elapsed between two operations is easy as:
 
 .. code-block:: cpp
 
    double t = (double)getTickCount();
    // do something ...
-   t = ((double)getTickCount() - t)/getTickFrequency(); 
+   t = ((double)getTickCount() - t)/getTickFrequency();
    cout << "Times passed in seconds: " << t << endl;
 
-.. _How_Image_Stored_Memory: 
+.. _How_Image_Stored_Memory:
 
 How the image matrix is stored in the memory?
 =============================================
 
-As you could already read in my :ref:`matTheBasicImageContainer` tutorial the size of the matrix depends of the color system used. More accurately, it depends from the number of channels used. In case of a gray scale image we have something like: 
+As you could already read in my :ref:`matTheBasicImageContainer` tutorial the size of the matrix depends of the color system used. More accurately, it depends from the number of channels used. In case of a gray scale image we have something like:
 
 .. math::
 
@@ -94,14 +94,14 @@ Note that the order of the channels is inverse: BGR instead of RGB. Because in m
 The efficient way
 =================
 
-When it comes to performance you cannot beat the classic C style operator[] (pointer) access. Therefore, the most efficient method we can recommend for making the assignment is: 
+When it comes to performance you cannot beat the classic C style operator[] (pointer) access. Therefore, the most efficient method we can recommend for making the assignment is:
 
 .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp
    :language: cpp
    :tab-width: 4
    :lines: 125-152
 
-Here we basically just acquire a pointer to the start of each row and go through it until it ends. In the special case that the matrix is stored in a continues manner we only need to request the pointer a single time and go all the way to the end. We need to look out for color images: we have three channels so we need to pass through three times more items in each row. 
+Here we basically just acquire a pointer to the start of each row and go through it until it ends. In the special case that the matrix is stored in a continues manner we only need to request the pointer a single time and go all the way to the end. We need to look out for color images: we have three channels so we need to pass through three times more items in each row.
 
 There's another way of this. The *data* data member of a *Mat* object returns the pointer to the first row, first column. If this pointer is null you have no valid input in that object. Checking this is the simplest method to check if your image loading was a success. In case the storage is continues we can use this to go through the whole data pointer. In case of a gray scale image this would look like:
 
@@ -114,17 +114,17 @@ There's another way of this. The *data* data member of a *Mat* object returns th
 
 You would get the same result. However, this code is a lot harder to read later on. It gets even harder if you have some more advanced technique there. Moreover, in practice I've observed you'll get the same performance result (as most of the modern compilers will probably make this small optimization trick automatically for you).
 
-The iterator (safe) method 
+The iterator (safe) method
 ==========================
 
-In case of the efficient way making sure that you pass through the right amount of *uchar* fields and to skip the gaps that may occur between the rows was your responsibility. The iterator method is considered a safer way as it takes over these tasks from the user. All you need to do is ask the begin and the end of the image matrix and then just increase the begin iterator until you reach the end. To acquire the value *pointed* by the iterator use the * operator (add it before it). 
+In case of the efficient way making sure that you pass through the right amount of *uchar* fields and to skip the gaps that may occur between the rows was your responsibility. The iterator method is considered a safer way as it takes over these tasks from the user. All you need to do is ask the begin and the end of the image matrix and then just increase the begin iterator until you reach the end. To acquire the value *pointed* by the iterator use the * operator (add it before it).
 
 .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp
    :language: cpp
    :tab-width: 4
    :lines: 154-182
 
-In case of color images we have three uchar items per column. This may be considered a short vector of uchar items, that has been baptized in OpenCV with the *Vec3b* name. To access the n-th sub column we use simple operator[] access. It's important to remember that OpenCV iterators go through the columns and automatically skip to the next row. Therefore in case of color images if you use a simple *uchar* iterator you'll be able to access only the blue channel values. 
+In case of color images we have three uchar items per column. This may be considered a short vector of uchar items, that has been baptized in OpenCV with the *Vec3b* name. To access the n-th sub column we use simple operator[] access. It's important to remember that OpenCV iterators go through the columns and automatically skip to the next row. Therefore in case of color images if you use a simple *uchar* iterator you'll be able to access only the blue channel values.
 
 On-the-fly address calculation with reference returning
 =======================================================
@@ -136,7 +136,7 @@ The final method isn't recommended for scanning. It was made to acquire or modif
    :tab-width: 4
    :lines: 184-216
 
-The functions takes your input type and coordinates and calculates on the fly the address of the queried item. Then returns a reference to that. This may be a constant when you *get* the value and non-constant when you *set* the value. As a safety step in **debug mode only*** there is performed a check that your input coordinates are valid and does exist. If this isn't the case you'll get a nice output message of this on the standard error output stream. Compared to the efficient way in release mode the only difference in using this is that for every element of the image you'll get a new row pointer for what we use the C operator[] to acquire the column element. 
+The functions takes your input type and coordinates and calculates on the fly the address of the queried item. Then returns a reference to that. This may be a constant when you *get* the value and non-constant when you *set* the value. As a safety step in **debug mode only*** there is performed a check that your input coordinates are valid and does exist. If this isn't the case you'll get a nice output message of this on the standard error output stream. Compared to the efficient way in release mode the only difference in using this is that for every element of the image you'll get a new row pointer for what we use the C operator[] to acquire the column element.
 
 If you need to multiple lookups using this method for an image it may be troublesome and time consuming to enter the type and the at keyword for each of the accesses. To solve this problem OpenCV has a :basicstructures:`Mat_ <id3>` data type. It's the same as Mat with the extra need that at definition you need to specify the data type through what to look at the data matrix, however in return you can use the operator() for fast access of items. To make things even better this is easily convertible from and to the usual :basicstructures:`Mat <id3>` data type. A sample usage of this you can see in case of the color images of the upper function. Nevertheless, it's important to note that the same operation (with the same runtime speed) could have been done with the :basicstructures:`at() <mat-at>` function. It's just a less to write for the lazy programmer trick.
 
index 938e504..9340a7c 100644 (file)
@@ -6,7 +6,7 @@ Interoperability with OpenCV 1
 Goal
 ====
 
-For the OpenCV developer team it's important to constantly improve the library. We are constantly thinking about methods that will ease your work process, while still maintain the libraries flexibility. The new C++ interface is a development of us that serves this goal. Nevertheless, backward compatibility remains important. We do not want to break your code written for earlier version of the OpenCV library. Therefore, we made sure that we add some functions that deal with this. In the following you'll learn: 
+For the OpenCV developer team it's important to constantly improve the library. We are constantly thinking about methods that will ease your work process, while still maintain the libraries flexibility. The new C++ interface is a development of us that serves this goal. Nevertheless, backward compatibility remains important. We do not want to break your code written for earlier version of the OpenCV library. Therefore, we made sure that we add some functions that deal with this. In the following you'll learn:
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -17,9 +17,9 @@ For the OpenCV developer team it's important to constantly improve the library.
 General
 =======
 
-When making the switch you first need to learn some about the new data structure for images: :ref:`matTheBasicImageContainer`, this replaces the old *CvMat* and *IplImage* ones. Switching to the new functions is easier. You just need to remember a couple of new things. 
+When making the switch you first need to learn some about the new data structure for images: :ref:`matTheBasicImageContainer`, this replaces the old *CvMat* and *IplImage* ones. Switching to the new functions is easier. You just need to remember a couple of new things.
 
-OpenCV 2 received reorganization. No longer are all the functions crammed into a single library. We have many modules, each of them containing data structures and functions relevant to certain tasks. This way you do not need to ship a large library if you use just a subset of OpenCV. This means that you should also include only those headers you will use. For example: 
+OpenCV 2 received reorganization. No longer are all the functions crammed into a single library. We have many modules, each of them containing data structures and functions relevant to certain tasks. This way you do not need to ship a large library if you use just a subset of OpenCV. This means that you should also include only those headers you will use. For example:
 
 .. code-block:: cpp
 
@@ -28,13 +28,13 @@ OpenCV 2 received reorganization. No longer are all the functions crammed into a
    #include <opencv2/highgui/highgui.hpp>
 
 
-All the OpenCV related stuff is put into the *cv* namespace to avoid name conflicts with other libraries data structures and functions. Therefore, either you need to prepend the *cv::* keyword before everything that comes from OpenCV or after the includes, you just add a directive to use this: 
+All the OpenCV related stuff is put into the *cv* namespace to avoid name conflicts with other libraries data structures and functions. Therefore, either you need to prepend the *cv::* keyword before everything that comes from OpenCV or after the includes, you just add a directive to use this:
 
 .. code-block:: cpp
 
    using namespace cv;  // The new C++ interface API is inside this namespace. Import it.
 
-Because the functions are already in a namespace there is no need for them to contain the *cv* prefix in their name. As such all the new C++ compatible functions don't have this and they follow the camel case naming rule. This means the first letter is small (unless it's a name, like Canny) and the subsequent words start with a capital letter (like *copyMakeBorder*). 
+Because the functions are already in a namespace there is no need for them to contain the *cv* prefix in their name. As such all the new C++ compatible functions don't have this and they follow the camel case naming rule. This means the first letter is small (unless it's a name, like Canny) and the subsequent words start with a capital letter (like *copyMakeBorder*).
 
 Now, remember that you need to link to your application all the modules you use, and in case you are on Windows using the *DLL* system you will need to add, again, to the path all the binaries. For more in-depth information if you're on Windows read :ref:`Windows_Visual_Studio_How_To` and for Linux an example usage is explained in :ref:`Linux_Eclipse_Usage`.
 
@@ -42,7 +42,7 @@ Now for converting the *Mat* object you can use either the *IplImage* or the *Cv
 
 .. code-block:: cpp
 
-   Mat I; 
+   Mat I;
    IplImage pI = I;
    CvMat    mI = I;
 
@@ -50,9 +50,9 @@ Now if you want pointers the conversion gets just a little more complicated. The
 
 .. code-block:: cpp
 
-   Mat I; 
-   IplImage* pI     = &I.operator IplImage(); 
-   CvMat* mI        =  &I.operator CvMat(); 
+   Mat I;
+   IplImage* pI     = &I.operator IplImage();
+   CvMat* mI        =  &I.operator CvMat();
 
 One of the biggest complaints of the C interface is that it leaves all the memory management to you. You need to figure out when it is safe to release your unused objects and make sure you do so before the program finishes or you could have troublesome memory leeks. To work around this issue in OpenCV there is introduced a sort of smart pointer. This will automatically release the object when it's no longer in use. To use this declare the pointers as a specialization of the *Ptr* :
 
@@ -60,11 +60,11 @@ One of the biggest complaints of the C interface is that it leaves all the memor
 
    Ptr<IplImage> piI = &I.operator IplImage();
 
-Converting from the C data structures to the *Mat* is done by passing these inside its constructor. For example: 
+Converting from the C data structures to the *Mat* is done by passing these inside its constructor. For example:
 
 .. code-block:: cpp
 
-   Mat K(piL), L; 
+   Mat K(piL), L;
    L = Mat(pI);
 
 A case study
@@ -79,7 +79,7 @@ Now that you have the basics done :download:`here's <../../../../samples/cpp/tut
    :tab-width: 4
    :lines: 1-9, 22-25, 27-44
 
-Here you can observe that with the new structure we have no pointer problems, although it is possible to use the old functions and in the end just transform the result to a *Mat* object. 
+Here you can observe that with the new structure we have no pointer problems, although it is possible to use the old functions and in the end just transform the result to a *Mat* object.
 
 .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp
    :language: cpp
@@ -87,7 +87,7 @@ Here you can observe that with the new structure we have no pointer problems, al
    :tab-width: 4
    :lines: 46-51
 
-Because, we want to mess around with the images luma component we first convert from the default RGB to the YUV color space and then split the result up into separate planes. Here the program splits: in the first example it processes each plane using one of the three major image scanning algorithms in OpenCV (C [] operator, iterator, individual element access). In a second variant we add to the image some Gaussian noise and then mix together the channels according to some formula. 
+Because, we want to mess around with the images luma component we first convert from the default RGB to the YUV color space and then split the result up into separate planes. Here the program splits: in the first example it processes each plane using one of the three major image scanning algorithms in OpenCV (C [] operator, iterator, individual element access). In a second variant we add to the image some Gaussian noise and then mix together the channels according to some formula.
 
 The scanning version looks like:
 
@@ -97,7 +97,7 @@ The scanning version looks like:
    :tab-width: 4
    :lines: 55-75
 
-Here you can observe that we may go through all the pixels of an image in three fashions: an iterator, a C pointer and an individual element access style. You can read a more in-depth description of these in the :ref:`howToScanImagesOpenCV` tutorial. Converting from the old function names is easy. Just remove the cv prefix and use the new *Mat* data structure. Here's an example of this by using the weighted addition function: 
+Here you can observe that we may go through all the pixels of an image in three fashions: an iterator, a C pointer and an individual element access style. You can read a more in-depth description of these in the :ref:`howToScanImagesOpenCV` tutorial. Converting from the old function names is easy. Just remove the cv prefix and use the new *Mat* data structure. Here's an example of this by using the weighted addition function:
 
 .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp
    :language: cpp
@@ -105,7 +105,7 @@ Here you can observe that we may go through all the pixels of an image in three
    :tab-width: 4
    :lines: 79-112
 
-As you may observe the *planes* variable is of type *Mat*. However, converting from *Mat* to *IplImage* is easy and made automatically with a simple assignment operator. 
+As you may observe the *planes* variable is of type *Mat*. However, converting from *Mat* to *IplImage* is easy and made automatically with a simple assignment operator.
 
 .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp
    :language: cpp
@@ -113,14 +113,14 @@ As you may observe the *planes* variable is of type *Mat*. However, converting f
    :tab-width: 4
    :lines: 115-127
 
-The new *imshow* highgui function accepts both the *Mat* and *IplImage* data structures. Compile and run the program and if the first image below is your input you may get either the first or second as output: 
+The new *imshow* highgui function accepts both the *Mat* and *IplImage* data structures. Compile and run the program and if the first image below is your input you may get either the first or second as output:
 
 .. image:: images/outputInteropOpenCV1.jpg
    :alt: The output of the sample
    :align: center
 
 
-You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=qckm-zvo31w>`_ and you can :download:`download the source code from here <../../../../samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp>` or find it in the :file:`samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp` of the OpenCV source code library. 
+You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=qckm-zvo31w>`_ and you can :download:`download the source code from here <../../../../samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp>` or find it in the :file:`samples/cpp/tutorial_code/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.cpp` of the OpenCV source code library.
 
 .. raw:: html
 
index f5bacbf..0549a9c 100644 (file)
@@ -8,11 +8,11 @@ Mask operations on matrices are quite simple. The idea is that we recalculate ea
 Our test case
 =============
 
-Let us consider the issue of an image contrast enhancement method. Basically we want to apply for every pixel of the image the following formula: 
+Let us consider the issue of an image contrast enhancement method. Basically we want to apply for every pixel of the image the following formula:
 
 .. math::
 
-   I(i,j) = 5*I(i,j) - [ I(i-1,j) + I(i+1,j) + I(i,j-1) + I(i,j+1)] 
+   I(i,j) = 5*I(i,j) - [ I(i-1,j) + I(i+1,j) + I(i,j-1) + I(i,j+1)]
 
    \iff I(i,j)*M, \text{where }
    M = \bordermatrix{ _i\backslash ^j  & -1 &  0 & +1 \cr
@@ -23,12 +23,12 @@ Let us consider the issue of an image contrast enhancement method. Basically we
 
 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 <filter2d>` function. 
+Now let us see how we can make this happen by using the basic pixel access method or by using the :filtering:`filter2D <filter2d>` function.
 
 The Basic Method
 ================
 
-Here's a function that will do this: 
+Here's a function that will do this:
 
 .. code-block:: cpp
 
@@ -49,7 +49,7 @@ Here's a function that will do this:
 
            for(int i= nChannels;i < nChannels*(myImage.cols-1); ++i)
            {
-               *output++ = saturate_cast<uchar>(5*current[i] 
+               *output++ = saturate_cast<uchar>(5*current[i]
                             -current[i-nChannels] - current[i+nChannels] - previous[i] - next[i]);
            }
        }
@@ -87,7 +87,7 @@ We'll use the plain C [] operator to access pixels. Because we need to access mu
 
        for(int i= nChannels;i < nChannels*(myImage.cols-1); ++i)
        {
-           *output++ = saturate_cast<uchar>(5*current[i] 
+           *output++ = saturate_cast<uchar>(5*current[i]
                         -current[i-nChannels] - current[i+nChannels] - previous[i] - next[i]);
        }
    }
@@ -96,7 +96,7 @@ On the borders of the image the upper notation results inexistent pixel location
 
 .. code-block:: cpp
 
-   Result.row(0).setTo(Scalar(0));             // The top row 
+   Result.row(0).setTo(Scalar(0));             // The top row
    Result.row(Result.rows-1).setTo(Scalar(0)); // The bottom row
    Result.col(0).setTo(Scalar(0));             // The left column
    Result.col(Result.cols-1).setTo(Scalar(0)); // The right column
@@ -108,19 +108,19 @@ Applying such filters are so common in image processing that in OpenCV there exi
 
 .. code-block:: cpp
 
-   Mat kern = (Mat_<char>(3,3) <<  0, -1,  0, 
+   Mat kern = (Mat_<char>(3,3) <<  0, -1,  0,
                                   -1,  5, -1,
                                    0, -1,  0);
 
-Then call the :filtering:`filter2D <filter2d>` function specifying the input, the output image and the kernell to use: 
+Then call the :filtering:`filter2D <filter2d>` function specifying the input, the output image and the kernell to use:
 
 .. code-block:: cpp
 
-   filter2D(I, K, I.depth(), kern ); 
+   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 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: 
+For example:
 
 .. image:: images/resultMatMaskFilter2D.png
    :alt: A sample output of the program
@@ -128,7 +128,7 @@ For example:
 
 You can download this source code from :download:`here <../../../../samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp>` or look in the OpenCV source code libraries sample directory at :file:`samples/cpp/tutorial_code/core/mat_mask_operations/mat_mask_operations.cpp`.
 
-Check out an instance of running the program on our `YouTube channel <http://www.youtube.com/watch?v=7PF1tAU9se4>`_ . 
+Check out an instance of running the program on our `YouTube channel <http://www.youtube.com/watch?v=7PF1tAU9se4>`_ .
 
 .. raw:: html
 
index 7b3f860..03d82bb 100644 (file)
@@ -19,15 +19,15 @@ For example in the above image you can see that the mirror of the car is nothing
 
 OpenCV has been around since 2001. In those days the library was built around a *C* interface and to store the image in the memory they used a C structure called *IplImage*. This is the one you'll see in most of the older tutorials and educational materials. The problem with this is that it brings to the table all the minuses of the C language. The biggest issue is the manual memory management. It builds on the assumption that the user is responsible for taking care of memory allocation and deallocation. While this is not a problem with smaller programs, once your code base grows it will be more of a struggle to handle all this rather than focusing on solving your development goal.
 
-Luckily C++ came around and introduced the concept of classes making easier for the user through automatic memory management (more or less). The good news is that C++ is fully compatible with C so no compatibility issues can arise from making the change. Therefore, OpenCV 2.0 introduced a new C++ interface which offered a new way of doing things which means you do not need to fiddle with memory management, making your code concise (less to write, to achieve more). The main downside of the C++ interface is that many embedded development systems at the moment support only C. Therefore, unless you are targeting embedded platforms, there's no point to using the *old* methods (unless you're a masochist programmer and you're asking for trouble). 
+Luckily C++ came around and introduced the concept of classes making easier for the user through automatic memory management (more or less). The good news is that C++ is fully compatible with C so no compatibility issues can arise from making the change. Therefore, OpenCV 2.0 introduced a new C++ interface which offered a new way of doing things which means you do not need to fiddle with memory management, making your code concise (less to write, to achieve more). The main downside of the C++ interface is that many embedded development systems at the moment support only C. Therefore, unless you are targeting embedded platforms, there's no point to using the *old* methods (unless you're a masochist programmer and you're asking for trouble).
 
 The first thing you need to know about *Mat* is that you no longer need to manually allocate its memory and release it as soon as you do not need it. While doing this is still a possibility, most of the OpenCV functions will allocate its output data manually. As a nice bonus if you pass on an already existing *Mat* object, which has already  allocated the required space for the matrix, this will be reused. In other words we use at all times only as much memory as we need to perform the task.
 
-*Mat* is basically a class with two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on) and a pointer to the matrix containing the pixel values (taking any dimensionality depending on the method chosen for storing) . The matrix header size is constant, however the size of the matrix itself may vary from image to image and usually is larger by orders of magnitude. 
+*Mat* is basically a class with two data parts: the matrix header (containing information such as the size of the matrix, the method used for storing, at which address is the matrix stored, and so on) and a pointer to the matrix containing the pixel values (taking any dimensionality depending on the method chosen for storing) . The matrix header size is constant, however the size of the matrix itself may vary from image to image and usually is larger by orders of magnitude.
 
 OpenCV is an image processing library. It contains a large collection of image processing functions. To solve a computational challenge, most of the time you will end up using multiple functions of the library. Because of this, passing images to functions is a common practice. We should not forget that we are talking about image processing algorithms, which tend to be quite computational heavy. The last thing we want to do is  further decrease the speed of your program by making unnecessary copies of potentially *large* images.
 
-To tackle this issue OpenCV uses a reference counting system. The idea is that each *Mat* object has its own header, however the matrix may be shared between two instance of them by having their matrix pointers point to the same address. Moreover, the copy operators **will only copy the headers** and the pointer to the large matrix, not the data itself. 
+To tackle this issue OpenCV uses a reference counting system. The idea is that each *Mat* object has its own header, however the matrix may be shared between two instance of them by having their matrix pointers point to the same address. Moreover, the copy operators **will only copy the headers** and the pointer to the large matrix, not the data itself.
 
 .. code-block:: cpp
    :linenos:
@@ -39,21 +39,21 @@ To tackle this issue OpenCV uses a reference counting system. The idea is that e
 
    C = A;                                    // Assignment operator
 
-All the above objects, in the end, point to the same single data matrix. Their headers are different, however, and making a modification using any of them will affect all the other ones as well. In practice the different objects just provide different access method to the same underlying data. Nevertheless, their header parts are different. The real interesting part is that you can create headers which refer to only a subsection of the full data. For example, to create a region of interest (*ROI*) in an image you just create a new header with the new boundaries: 
+All the above objects, in the end, point to the same single data matrix. Their headers are different, however, and making a modification using any of them will affect all the other ones as well. In practice the different objects just provide different access method to the same underlying data. Nevertheless, their header parts are different. The real interesting part is that you can create headers which refer to only a subsection of the full data. For example, to create a region of interest (*ROI*) in an image you just create a new header with the new boundaries:
 
 .. code-block:: cpp
    :linenos:
 
    Mat D (A, Rect(10, 10, 100, 100) ); // using a rectangle
-   Mat E = A(Range:all(), Range(1,3)); // using row and column boundaries 
+   Mat E = A(Range:all(), Range(1,3)); // using row and column boundaries
 
 Now you may ask if the matrix itself may belong to multiple *Mat* objects who takes responsibility for cleaning it up when it's no longer needed. The short answer is: the last object that used it. This is handled by using a reference counting mechanism. Whenever somebody copies a header of a *Mat* object, a counter is increased for the matrix. Whenever a header is cleaned this counter is decreased. When the counter reaches zero the matrix too is freed. Sometimes you will want to copy the matrix itself too, so OpenCV provides the :basicstructures:`clone() <mat-clone>` and :basicstructures:`copyTo() <mat-copyto>` functions.
 
 .. code-block:: cpp
    :linenos:
 
-   Mat F = A.clone(); 
-   Mat G; 
+   Mat F = A.clone();
+   Mat G;
    A.copyTo(G);
 
 Now modifying *F* or *G* will not affect the matrix pointed by the *Mat* header. What you need to remember from all this is that:
@@ -66,19 +66,19 @@ Now modifying *F* or *G* will not affect the matrix pointed by the *Mat* header.
    * The underlying matrix of an image may be copied using the :basicstructures:`clone()<mat-clone>` and :basicstructures:`copyTo() <mat-copyto>` functions.
 
 *Storing* methods
-================= 
+=================
 
-This is about how you store the pixel values. You can select the color space and the data type used. The color space refers to how we combine color components in order to code a given color. The simplest one is the gray scale where the colors at our disposal are black and white. The combination of these allows us to create many shades of gray. 
+This is about how you store the pixel values. You can select the color space and the data type used. The color space refers to how we combine color components in order to code a given color. The simplest one is the gray scale where the colors at our disposal are black and white. The combination of these allows us to create many shades of gray.
 
-For *colorful* ways we have a lot more methods to choose from. Each of them breaks it down to three or four basic components and we can use the combination of these to create the others. The most popular one is RGB, mainly because this is also how our eye builds up colors. Its base colors are red, green and blue. To code the transparency of a color sometimes a fourth element: alpha (A) is added. 
+For *colorful* ways we have a lot more methods to choose from. Each of them breaks it down to three or four basic components and we can use the combination of these to create the others. The most popular one is RGB, mainly because this is also how our eye builds up colors. Its base colors are red, green and blue. To code the transparency of a color sometimes a fourth element: alpha (A) is added.
 
 There are, however, many other color systems each with their own advantages:
 
 .. container:: enumeratevisibleitemswithsquare
 
    * RGB is the most common as our eyes use something similar, our display systems also compose colors using these.
-   * The HSV and HLS decompose colors into their hue, saturation and value/luminance components, which is a more natural way for us to describe colors.  You might, for example, dismiss the last component, making your algorithm less sensible to the light conditions of the input image. 
-   * YCrCb is used by the popular JPEG image format. 
+   * The HSV and HLS decompose colors into their hue, saturation and value/luminance components, which is a more natural way for us to describe colors.  You might, for example, dismiss the last component, making your algorithm less sensible to the light conditions of the input image.
+   * YCrCb is used by the popular JPEG image format.
    * CIE L*a*b* is a perceptually uniform color space, which comes handy if you need to measure the *distance* of a given color to another color.
 
 Each of the building components has their own valid domains. This leads to the data type used. How we store a component defines the control we have over its domain. The smallest data type possible is *char*, which means one byte or 8 bits. This may be unsigned (so can store values from 0 to 255) or signed (values from -127 to +127). Although in case of three components this already gives 16 million possible colors to represent (like in case of RGB) we may acquire an even finer control by using the float (4 byte = 32 bit) or double (8 byte = 64 bit) data types for each component. Nevertheless, remember that increasing the size of a component also increases the size of the whole picture in the memory.
@@ -86,13 +86,13 @@ Each of the building components has their own valid domains. This leads to the d
 Creating a *Mat* object explicitly
 ==================================
 
-In the :ref:`Load_Save_Image` tutorial you have already learned how to write a matrix to an image file by using the :readWriteImageVideo:` imwrite() <imwrite>` function. However, for debugging purposes it's much more convenient to see the actual values. You can do this using the << operator of *Mat*. Be aware that this only works for two dimensional matrices. 
+In the :ref:`Load_Save_Image` tutorial you have already learned how to write a matrix to an image file by using the :readWriteImageVideo:` imwrite() <imwrite>` function. However, for debugging purposes it's much more convenient to see the actual values. You can do this using the << operator of *Mat*. Be aware that this only works for two dimensional matrices.
 
 Although *Mat* works really well as an image container, it is also a general matrix class. Therefore, it is possible to create and manipulate multidimensional matrices. You can create a Mat object in multiple ways:
 
 .. container:: enumeratevisibleitemswithsquare
 
-   + :basicstructures:`Mat() <mat-mat>` Constructor 
+   + :basicstructures:`Mat() <mat-mat>` Constructor
 
      .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
         :language: cpp
@@ -105,7 +105,7 @@ Although *Mat* works really well as an image container, it is also a general mat
 
     For two dimensional and multichannel images we first define their size: row and column count wise.
 
-    Then we need to specify the data type to use for storing the elements and the number of channels per matrix point. To do this we have multiple definitions constructed according to the following convention: 
+    Then we need to specify the data type to use for storing the elements and the number of channels per matrix point. To do this we have multiple definitions constructed according to the following convention:
 
     .. code-block:: cpp
 
@@ -176,7 +176,7 @@ Although *Mat* works really well as an image container, it is also a general mat
         :alt: Demo image of the matrix output
         :align: center
 
-.. note:: 
+.. note::
 
    You can fill out a matrix with random values using the :operationsOnArrays:`randu() <randu>` function. You need to give the lower and upper value for the random values:
 
@@ -189,11 +189,11 @@ Although *Mat* works really well as an image container, it is also a general mat
 Output formatting
 =================
 
-In the above examples you could see the default formatting option. OpenCV, however, allows you to format your matrix output: 
+In the above examples you could see the default formatting option. OpenCV, however, allows you to format your matrix output:
 
 .. container:: enumeratevisibleitemswithsquare
 
-   + Default 
+   + Default
 
      .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
        :language: cpp
@@ -215,7 +215,7 @@ In the above examples you could see the default formatting option. OpenCV, howev
         :alt: Default Output
         :align: center
 
-   + Comma separated values (CSV) 
+   + Comma separated values (CSV)
 
      .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
        :language: cpp
@@ -255,7 +255,7 @@ OpenCV offers support for output of other common OpenCV data structures too via
 
 .. container:: enumeratevisibleitemswithsquare
 
-   + 2D Point 
+   + 2D Point
 
      .. literalinclude:: ../../../../samples/cpp/tutorial_code/core/mat_the_basic_image_container/mat_the_basic_image_container.cpp
        :language: cpp
index ddd8ef2..b50d976 100644 (file)
@@ -44,7 +44,7 @@ Here you will learn the about the basic building blocks of the library. A must r
   .. |HowScanImag| image:: images/howToScanImages.jpg
                    :height: 90pt
                    :width:  90pt
-                   
+
 
 +
   .. tabularcolumns:: m{100pt} m{300pt}
@@ -193,7 +193,7 @@ Here you will learn the about the basic building blocks of the library. A must r
                   *Author:* |Author_BernatG|
 
                   Did you used OpenCV before its 2.0 version? Do you wanna know what happened with your library with 2.0? Don't you know how to convert your old OpenCV programs to the new C++ interface? Look here to shed light on all this questions.
-                  
+
   =============== ======================================================
 
   .. |InterOOpenCV1| image:: images/interopOpenCV1.png
@@ -208,7 +208,7 @@ Here you will learn the about the basic building blocks of the library. A must r
 
 .. toctree::
    :hidden:
-   
+
    ../mat_the_basic_image_container/mat_the_basic_image_container
    ../how_to_scan_images/how_to_scan_images
    ../mat-mask-operations/mat-mask-operations
index 946dbb0..4695623 100644 (file)
@@ -3,7 +3,7 @@
 .. |Author_AndreyK| unicode:: Andrey U+0020 Kamaev
 .. |Author_LeonidBLB| unicode:: Leonid U+0020 Beynenson
 .. |Author_VsevolodG| unicode:: Vsevolod U+0020 Glumov
-.. |Author_VictorE| unicode:: Victor U+0020 Eruhimov 
+.. |Author_VictorE| unicode:: Victor U+0020 Eruhimov
 .. |Author_ArtemM| unicode:: Artem U+0020 Myagkov
 .. |Author_FernandoI| unicode:: Fernando U+0020 Iglesias U+0020 Garc U+00ED a
 .. |Author_EduardF| unicode:: Eduard U+0020 Feicho
index 48d93ce..009d537 100644 (file)
@@ -5,9 +5,9 @@ Detection of planar objects
 
 .. highlight:: cpp
 
-The goal of this tutorial is to learn how to use *features2d* and *calib3d* modules for detecting known planar objects in scenes. 
+The goal of this tutorial is to learn how to use *features2d* and *calib3d* modules for detecting known planar objects in scenes.
 
-*Test data*: use images in your data folder, for instance, ``box.png`` and ``box_in_scene.png``. 
+*Test data*: use images in your data folder, for instance, ``box.png`` and ``box_in_scene.png``.
 
 #.
     Create a new console project. Read two input images. ::
@@ -22,7 +22,7 @@ The goal of this tutorial is to learn how to use *features2d* and *calib3d* modu
         FastFeatureDetector detector(15);
         vector<KeyPoint> keypoints1;
         detector.detect(img1, keypoints1);
-        
+
         ... // do the same for the second image
 
 #.
@@ -32,7 +32,7 @@ The goal of this tutorial is to learn how to use *features2d* and *calib3d* modu
         SurfDescriptorExtractor extractor;
         Mat descriptors1;
         extractor.compute(img1, keypoints1, descriptors1);
-        
+
         ... // process keypoints from the second image as well
 
 #.
@@ -69,4 +69,4 @@ The goal of this tutorial is to learn how to use *features2d* and *calib3d* modu
         perspectiveTransform(Mat(points1), points1Projected, H);
 
 #.
-    Use ``drawMatches`` for drawing inliers. 
+    Use ``drawMatches`` for drawing inliers.
index be0f515..cc90082 100644 (file)
 
 Learn about how to use the feature points  detectors, descriptors and matching framework found inside OpenCV.
 
-.. include:: ../../definitions/tocDefinitions.rst 
+.. include:: ../../definitions/tocDefinitions.rst
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |Harris|             **Title:** :ref:`harris_detector`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         Why is it a good idea to track corners? We learn to use the Harris method to detect corners
-  
+
   ===================== ==============================================
-  
+
   .. |Harris| image:: images/trackingmotion/Harris_Detector_Cover.jpg
                    :height: 90pt
                    :width:  90pt
-  
 
-+ 
+
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |ShiTomasi|          **Title:** :ref:`good_features_to_track`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         Where we use an improved method to detect corners more accuratelyI
-  
+
   ===================== ==============================================
-  
+
   .. |ShiTomasi| image:: images/trackingmotion/Shi_Tomasi_Detector_Cover.jpg
                       :height: 90pt
                       :width:  90pt
 
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |GenericCorner|      **Title:** :ref:`generic_corner_detector`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         Here you will learn how to use OpenCV functions to make your personalized corner detector!
-  
+
   ===================== ==============================================
-  
+
   .. |GenericCorner| image:: images/trackingmotion/Generic_Corner_Detector_Cover.jpg
                           :height: 90pt
                           :width:  90pt
 
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |Subpixel|           **Title:** :ref:`corner_subpixeles`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         Is pixel resolution enough? Here we learn a simple method to improve our accuracy.
-  
+
   ===================== ==============================================
-  
+
   .. |Subpixel| image:: images/trackingmotion/Corner_Subpixeles_Cover.jpg
                      :height: 90pt
                      :width:  90pt
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |FeatureDetect|      **Title:** :ref:`feature_detection`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         In this tutorial, you will use *features2d* to detect interest points.
-  
+
   ===================== ==============================================
-  
+
   .. |FeatureDetect| image:: images/Feature_Detection_Tutorial_Cover.jpg
                      :height: 90pt
                      :width:  90pt
 
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |FeatureDescript|    **Title:** :ref:`feature_description`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         In this tutorial, you will use *features2d* to calculate feature vectors.
-  
+
   ===================== ==============================================
-  
+
   .. |FeatureDescript| image:: images/Feature_Description_Tutorial_Cover.jpg
                        :height: 90pt
                        :width:  90pt
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |FeatureFlann|       **Title:** :ref:`feature_flann_matcher`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         In this tutorial, you will use the FLANN library to make a fast matching.
-  
+
   ===================== ==============================================
-  
+
   .. |FeatureFlann| image:: images/Feature_Flann_Matcher_Tutorial_Cover.jpg
                     :height: 90pt
                     :width:  90pt
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |FeatureHomo|        **Title:** :ref:`feature_homography`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         In this tutorial, you will use *features2d* and *calib3d* to detect an object in a scene.
-  
+
   ===================== ==============================================
-  
+
   .. |FeatureHomo| image:: images/Feature_Homography_Tutorial_Cover.jpg
                    :height: 90pt
                    :width:  90pt
 
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
@@ -175,7 +175,7 @@ Learn about how to use the feature points  detectors, descriptors and matching f
 
                         *Author:* |Author_VictorE|
 
-                        You will use *features2d* and *calib3d* modules for detecting known planar objects in scenes. 
+                        You will use *features2d* and *calib3d* modules for detecting known planar objects in scenes.
 
   ===================== ==============================================
 
index a3fef43..91b2583 100644 (file)
@@ -7,7 +7,7 @@ Squeeze out every little computation power from your system by using the power o
 
 .. include:: ../../definitions/tocDefinitions.rst
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
@@ -18,7 +18,7 @@ Squeeze out every little computation power from your system by using the power o
 
                   *Author:* |Author_BernatG|
 
-                  This will give a good grasp on how to approach coding on the GPU module, once you already know how to handle the other modules. As a test case it will port the similarity methods from the tutorial :ref:`videoInputPSNRMSSIM` to the GPU. 
+                  This will give a good grasp on how to approach coding on the GPU module, once you already know how to handle the other modules. As a test case it will port the similarity methods from the tutorial :ref:`videoInputPSNRMSSIM` to the GPU.
 
   =============== ======================================================
 
index 36fbc92..0ba7c32 100644 (file)
@@ -3,30 +3,30 @@
 *highgui* module. High Level GUI and Media
 ------------------------------------------
 
-This section contains valuable tutorials about how to read/save your image/video files and how to use the built-in graphical user interface of the library. 
+This section contains valuable tutorials about how to read/save your image/video files and how to use the built-in graphical user interface of the library.
 
 .. include:: ../../definitions/tocDefinitions.rst
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   =============== ======================================================
   |Beginners_5|   *Title:* :ref:`Adding_Trackbars`
-  
+
                   *Compatibility:* > OpenCV 2.0
 
                   *Author:* |Author_AnaH|
-  
+
                   We will learn how to add a Trackbar to our applications
-  
+
   =============== ======================================================
-  
+
   .. |Beginners_5| image:: images/Adding_Trackbars_Tutorial_Cover.jpg
                    :height: 90pt
                    :width:  90pt
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
@@ -34,7 +34,7 @@ This section contains valuable tutorials about how to read/save your image/video
   |hVideoInput|   *Title:* :ref:`videoInputPSNRMSSIM`
 
                   *Compatibility:* > OpenCV 2.0
-                  
+
                   *Author:* |Author_BernatG|
 
                   You will learn how to read video streams, and how to calculate similarity values such as PSNR or SSIM.
@@ -45,7 +45,7 @@ This section contains valuable tutorials about how to read/save your image/video
                    :height: 90pt
                    :width:  90pt
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
index 21f8b36..d6f7202 100644 (file)
@@ -5,11 +5,11 @@ Adding a Trackbar to our applications!
 
 * In the previous tutorials (about *linear blending* and the *brightness and contrast adjustments*) you might have noted that we needed to give some **input** to our programs, such as :math:`\alpha` and :math:`beta`. We accomplished that by entering this data using the Terminal
 
-* Well, it is time to use some fancy GUI tools. OpenCV provides some GUI utilities (*highgui.h*) for you. An example of this is a **Trackbar** 
+* Well, it is time to use some fancy GUI tools. OpenCV provides some GUI utilities (*highgui.h*) for you. An example of this is a **Trackbar**
 
   .. image:: images/Adding_Trackbars_Tutorial_Trackbar.png
      :alt: Trackbar example
-     :align: center 
+     :align: center
 
 * In this tutorial we will just modify our two previous programs so that they get the input information from the trackbar.
 
@@ -19,7 +19,7 @@ Goals
 
 In this tutorial you will learn how to:
 
-* Add a Trackbar in an OpenCV window by using  :create_trackbar:`createTrackbar <>` 
+* Add a Trackbar in an OpenCV window by using  :create_trackbar:`createTrackbar <>`
 
 Code
 =====
@@ -33,13 +33,13 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let
 
    using namespace cv;
 
-   /// Global Variables 
+   /// Global Variables
    const int alpha_slider_max = 100;
-   int alpha_slider; 
+   int alpha_slider;
    double alpha;
-   double beta;  
+   double beta;
 
-   /// Matrices to store images 
+   /// Matrices to store images
    Mat src1;
    Mat src2;
    Mat dst;
@@ -49,12 +49,12 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let
     * @brief Callback for trackbar
     */
    void on_trackbar( int, void* )
-   { 
+   {
     alpha = (double) alpha_slider/alpha_slider_max ;
     beta = ( 1.0 - alpha );
 
     addWeighted( src1, alpha, src2, beta, 0.0, dst);
-  
+
     imshow( "Linear Blend", dst );
    }
 
@@ -67,7 +67,7 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let
     if( !src1.data ) { printf("Error loading src1 \n"); return -1; }
     if( !src2.data ) { printf("Error loading src2 \n"); return -1; }
 
-    /// Initialize values 
+    /// Initialize values
     alpha_slider = 0;
 
     /// Create Windows
@@ -75,13 +75,13 @@ Let's modify the program made in the tutorial :ref:`Adding_Images`. We will let
 
     /// Create Trackbars
     char TrackbarName[50];
-    sprintf( TrackbarName, "Alpha x %d", alpha_slider_max ); 
+    sprintf( TrackbarName, "Alpha x %d", alpha_slider_max );
 
     createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar );
 
     /// Show some stuff
     on_trackbar( alpha_slider, 0 );
-  
+
     /// Wait until user press some key
     waitKey(0);
     return 0;
@@ -113,7 +113,7 @@ We only analyze the code that is related to Trackbar:
       createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar );
 
    Note the following:
-   
+
    * Our Trackbar has a label **TrackbarName**
    * The Trackbar is located in the window named **"Linear Blend"**
    * The Trackbar values will be in the range from :math:`0` to **alpha_slider_max** (the minimum limit is always **zero**).
@@ -125,21 +125,21 @@ We only analyze the code that is related to Trackbar:
    .. code-block:: cpp
 
       void on_trackbar( int, void* )
-      { 
+      {
        alpha = (double) alpha_slider/alpha_slider_max ;
        beta = ( 1.0 - alpha );
 
        addWeighted( src1, alpha, src2, beta, 0.0, dst);
-  
+
        imshow( "Linear Blend", dst );
       }
 
    Note that:
-   * We use the value of **alpha_slider** (integer) to get a double value for **alpha**. 
+
+   * We use the value of **alpha_slider** (integer) to get a double value for **alpha**.
    * **alpha_slider** is updated each time the trackbar is displaced by the user.
    * We define *src1*, *src2*, *dist*, *alpha*, *alpha_slider* and *beta* as global  variables, so they can be used everywhere.
+
 Result
 =======
 
@@ -147,13 +147,13 @@ Result
 
   .. image:: images/Adding_Trackbars_Tutorial_Result_0.jpg
      :alt: Adding Trackbars - Windows Linux
-     :align: center 
+     :align: center
 
 * As a manner of practice, you can also add 02 trackbars for the program made in :ref:`Basic_Linear_Transform`. One trackbar to set :math:`\alpha` and another for :math:`\beta`. The output might look like:
 
   .. image:: images/Adding_Trackbars_Tutorial_Result_1.jpg
      :alt: Adding Trackbars - Lena
-     :align: center 
+     :align: center
 
 
 
index b9c1201..6f5476c 100644 (file)
@@ -64,7 +64,7 @@ Closing the video is automatic when the objects destructor is called. However, i
    captRefrnc >> frameReference;
    captUndTst.open(frameUnderTest);
 
-The upper read operations will leave empty the *Mat* objects if no frame could be acquired (either cause the video stream was closed or you got to the end of the video file). We can check this with a simple if: 
+The upper read operations will leave empty the *Mat* objects if no frame could be acquired (either cause the video stream was closed or you got to the end of the video file). We can check this with a simple if:
 
 .. code-block:: cpp
 
@@ -111,7 +111,7 @@ Then the PSNR is expressed as:
 
    PSNR = 10 \cdot \log_{10} \left( \frac{MAX_I^2}{MSE} \right)
 
-Here the :math:`MAX_I^2` is the maximum valid value for a pixel. In case of the simple single byte image per pixel per channel this is 255. When two images are the same the MSE will give zero, resulting in an invalid divide by zero operation in the PSNR formula. In this case the PSNR is undefined and as we'll need to handle this case separately. The transition to a logarithmic scale is made because the pixel values have a very wide dynamic range. All this translated to OpenCV and a C++ function looks like: 
+Here the :math:`MAX_I^2` is the maximum valid value for a pixel. In case of the simple single byte image per pixel per channel this is 255. When two images are the same the MSE will give zero, resulting in an invalid divide by zero operation in the PSNR formula. In this case the PSNR is undefined and as we'll need to handle this case separately. The transition to a logarithmic scale is made because the pixel values have a very wide dynamic range. All this translated to OpenCV and a C++ function looks like:
 
 .. code-block:: cpp
 
@@ -136,13 +136,13 @@ Here the :math:`MAX_I^2` is the maximum valid value for a pixel. In case of the
     }
    }
 
-Typically result values are anywhere between 30 and 50 for video compression, where higher is better. If the images significantly differ you'll get much lower ones like 15 and so. This similarity check is easy and fast to calculate, however in practice it may turn out somewhat inconsistent with human eye perception. The **structural similarity** algorithm aims to correct this. 
+Typically result values are anywhere between 30 and 50 for video compression, where higher is better. If the images significantly differ you'll get much lower ones like 15 and so. This similarity check is easy and fast to calculate, however in practice it may turn out somewhat inconsistent with human eye perception. The **structural similarity** algorithm aims to correct this.
 
-Describing the methods goes well beyond the purpose of this tutorial. For that I invite you to read the article introducing it. Nevertheless, you can get a good image of it by looking at the OpenCV implementation below. 
+Describing the methods goes well beyond the purpose of this tutorial. For that I invite you to read the article introducing it. Nevertheless, you can get a good image of it by looking at the OpenCV implementation below.
 
 .. seealso::
 
-   SSIM is described more in-depth in the: "Z. Wang, A. C. Bovik, H. R. Sheikh and E. P. Simoncelli, "Image quality assessment: From error visibility to structural similarity," IEEE Transactions on Image Processing, vol. 13, no. 4, pp. 600-612, Apr. 2004." article. 
+   SSIM is described more in-depth in the: "Z. Wang, A. C. Bovik, H. R. Sheikh and E. P. Simoncelli, "Image quality assessment: From error visibility to structural similarity," IEEE Transactions on Image Processing, vol. 13, no. 4, pp. 600-612, Apr. 2004." article.
 
 .. code-block:: cpp
 
@@ -162,7 +162,7 @@ Describing the methods goes well beyond the purpose of this tutorial. For that I
 
     /***********************PRELIMINARY COMPUTING ******************************/
 
-    Mat mu1, mu2;   // 
+    Mat mu1, mu2;   //
     GaussianBlur(I1, mu1, Size(11, 11), 1.5);
     GaussianBlur(I2, mu2, Size(11, 11), 1.5);
 
@@ -199,7 +199,7 @@ Describing the methods goes well beyond the purpose of this tutorial. For that I
     return mssim;
    }
 
-This will return a similarity index for each channel of the image. This value is between zero and one, where one corresponds to perfect fit. Unfortunately, the many Gaussian blurring is quite costly, so while the PSNR may work in a real time like environment (24 frame per second) this will take significantly more than to accomplish similar performance results. 
+This will return a similarity index for each channel of the image. This value is between zero and one, where one corresponds to perfect fit. Unfortunately, the many Gaussian blurring is quite costly, so while the PSNR may work in a real time like environment (24 frame per second) this will take significantly more than to accomplish similar performance results.
 
 Therefore, the source code presented at the start of the tutorial will perform the PSNR measurement for each frame, and the SSIM only for the frames where the PSNR falls below an input value. For visualization purpose we show both images in an OpenCV window and print the PSNR and MSSIM values to the console. Expect to see something like:
 
@@ -207,7 +207,7 @@ Therefore, the source code presented at the start of the tutorial will perform t
    :alt: A sample output
    :align: center
 
-You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=iOcNljutOgg>`_. 
+You may observe a runtime instance of this on the `YouTube here <https://www.youtube.com/watch?v=iOcNljutOgg>`_.
 
 .. raw:: html
 
index 011dedd..1be239c 100644 (file)
@@ -7,502 +7,502 @@ In this section you will learn about the image processing (manipulation) functio
 
 .. include:: ../../definitions/tocDefinitions.rst
 
-+ 
+
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |ImageProcessing_1|  **Title:** :ref:`Smoothing`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         Let's take a look at some basic linear filters!
-  
+
   ===================== ==============================================
-  
+
   .. |ImageProcessing_1| image:: images/Smoothing_Tutorial_Cover.jpg
                          :height: 90pt
                          :width:  90pt
-  
-+ 
+
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |ImageProcessing_2|  **Title:** :ref:`Morphology_1`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         Author: |Author_AnaH|
-  
+
                         Let's *change* the shape of objects!
-  
+
   ===================== ==============================================
-  
+
   .. |ImageProcessing_2| image:: images/Morphology_1_Tutorial_Cover.jpg
                          :height: 90pt
                          :width:  90pt
-     
-+ 
+
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ================= ==================================================
    |Morphology_2|   **Title:** :ref:`Morphology_2`
-  
+
                     *Compatibility:* > OpenCV 2.0
-                    
+
                     *Author:* |Author_AnaH|
-                    
+
                     Here we investigate different morphology operators
-  
+
   ================= ==================================================
-  
+
   .. |Morphology_2| image:: images/Morphology_2_Tutorial_Cover.jpg
                      :height: 90pt
                      :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |Pyramids|           **Title:** :ref:`Pyramids`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         What if I need a bigger/smaller image?
-  
+
   ===================== ==============================================
-  
+
   .. |Pyramids| image:: images/Pyramids_Tutorial_Cover.jpg
                       :height: 90pt
                       :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |Threshold|          **Title:** :ref:`Basic_Threshold`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         After so much processing, it is time to decide which pixels stay!
-  
+
   ===================== ==============================================
-  
+
   .. |Threshold| image:: images/Threshold_Tutorial_Cover.jpg
                       :height: 90pt
                       :width:  90pt
-  
+
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-    
-+ 
+
++
   ===================== ==============================================
    |Filter_2D|          **Title:** :ref:`filter_2d`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn to design our own filters by using OpenCV functions
-  
+
   ===================== ==============================================
-  
+
   .. |Filter_2D| image:: images/imgtrans/Filter_2D_Tutorial_Cover.jpg
                       :height: 90pt
                       :width:  90pt
-  
+
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-    
-+ 
+
++
   ===================== ==============================================
    |CopyMakeBorder|     **Title:** :ref:`copyMakeBorderTutorial`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn how to pad our images!
-  
+
   ===================== ==============================================
-  
+
   .. |CopyMakeBorder| image:: images/imgtrans/CopyMakeBorder_Tutorial_Cover.jpg
                            :height: 90pt
                            :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |SobelDerivatives|   **Title:** :ref:`sobel_derivatives`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn how to calculate gradients and use them to detect edges!
-  
+
   ===================== ==============================================
-  
+
   .. |SobelDerivatives| image:: images/imgtrans/Sobel_Derivatives_Tutorial_Cover.jpg
                              :height: 90pt
                              :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |LaplaceOperator|    **Title:** :ref:`laplace_operator`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn about the *Laplace* operator and how to detect edges with it.
-  
+
   ===================== ==============================================
-  
+
   .. |LaplaceOperator| image:: images/imgtrans/Laplace_Operator_Tutorial_Cover.jpg
                              :height: 90pt
                              :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |CannyDetector|      **Title:** :ref:`canny_detector`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn a sophisticated alternative to detect edges.
-  
+
   ===================== ==============================================
-  
+
   .. |CannyDetector| image:: images/imgtrans/Canny_Detector_Tutorial_Cover.jpg
                            :height: 90pt
                            :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |HoughLines|         **Title:** :ref:`hough_lines`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn how to detect lines
-  
+
   ===================== ==============================================
-  
+
   .. |HoughLines| image:: images/imgtrans/Hough_Lines_Tutorial_Cover.jpg
                         :height: 90pt
                         :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |HoughCircle|        **Title:** :ref:`hough_circle`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn how to detect circles
-  
+
   ===================== ==============================================
-  
+
   .. |HoughCircle| image:: images/imgtrans/Hough_Circle_Tutorial_Cover.jpg
                          :height: 90pt
                          :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |Remap|              **Title:** :ref:`remap`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn how to manipulate pixels locations
-  
+
   ===================== ==============================================
-  
+
   .. |Remap| image:: images/imgtrans/Remap_Tutorial_Cover.jpg
                    :height: 90pt
                    :width:  90pt
-  
-+ 
+
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |WarpAffine|         **Title:** :ref:`warp_affine`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-  
+
                         Where we learn how to rotate, translate and scale our images
-  
+
   ===================== ==============================================
-  
+
   .. |WarpAffine| image:: images/imgtrans/Warp_Affine_Tutorial_Cover.jpg
                         :height: 90pt
                         :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |HistEqualization|   **Title:** :ref:`histogram_equalization`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to improve the contrast in our images
 
   ===================== ==============================================
-  
+
   .. |HistEqualization| image:: images/histograms/Histogram_Equalization_Tutorial_Cover.jpg
                               :height: 90pt
                               :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |HistCalculation|    **Title:** :ref:`histogram_calculation`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to create and generate histograms
 
   ===================== ==============================================
-  
+
   .. |HistCalculation| image:: images/histograms/Histogram_Calculation_Tutorial_Cover.jpg
                              :height: 90pt
                              :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |HistComparison|     **Title:** :ref:`histogram_comparison`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn to calculate metrics between histograms
 
   ===================== ==============================================
-  
+
   .. |HistComparison| image:: images/histograms/Histogram_Comparison_Tutorial_Cover.jpg
                             :height: 90pt
                             :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |BackProjection|     **Title:** :ref:`back_projection`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to use histograms to find similar objects in images
 
   ===================== ==============================================
-  
+
   .. |BackProjection| image:: images/histograms/Back_Projection_Tutorial_Cover.jpg
                             :height: 90pt
                             :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |TemplateMatching|   **Title:** :ref:`template_matching`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to match templates in an image
 
   ===================== ==============================================
-  
+
   .. |TemplateMatching| image:: images/histograms/Template_Matching_Tutorial_Cover.jpg
                               :height: 90pt
                               :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |FindContours|       **Title:** :ref:`find_contours`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to find contours of objects in our image
 
   ===================== ==============================================
-  
+
   .. |FindContours| image:: images/shapedescriptors/Find_Contours_Tutorial_Cover.jpg
                           :height: 90pt
                           :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |Hull|               **Title:** :ref:`hull`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to get hull contours and draw them!
 
   ===================== ==============================================
-  
+
   .. |Hull| image:: images/shapedescriptors/Hull_Tutorial_Cover.jpg
                  :height: 90pt
                  :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
+
   ===================== ==============================================
    |BRC|                **Title:** :ref:`bounding_rects_circles`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to obtain bounding boxes and circles for our contours.
 
   ===================== ==============================================
-  
+
   .. |BRC| image:: images/shapedescriptors/Bounding_Rects_Circles_Tutorial_Cover.jpg
                 :height: 90pt
                 :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
-  
+
+
   ===================== ==============================================
    |BRE|                **Title:** :ref:`bounding_rotated_ellipses`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to obtain rotated bounding boxes and ellipses for our contours.
 
   ===================== ==============================================
-  
+
   .. |BRE| image:: images/shapedescriptors/Bounding_Rotated_Ellipses_Tutorial_Cover.jpg
                 :height: 90pt
                 :width:  90pt
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
-  
+
+
   ===================== ==============================================
    |MU|                 **Title:** :ref:`moments`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn to calculate the moments of an image
 
   ===================== ==============================================
-  
+
   .. |MU| image:: images/shapedescriptors/Moments_Tutorial_Cover.jpg
                :height: 90pt
                :width:  90pt
 
 
-+ 
++
 
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
-  
-  
+
+
   ===================== ==============================================
    |PPT|                **Title:** :ref:`point_polygon_test`
 
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
 
                         Where we learn how to calculate distances from the image to contours
 
   ===================== ==============================================
-  
+
   .. |PPT| image:: images/shapedescriptors/Point_Polygon_Test_Tutorial_Cover.jpg
                 :height: 90pt
                 :width:  90pt
index 368c3b2..243dc35 100644 (file)
@@ -6,7 +6,7 @@ Android Development with OpenCV
 
 This tutorial has been created to help you use OpenCV library within your Android project.
 
-This guide was written with Windows 7 in mind, though it should work with any other OS supported by 
+This guide was written with Windows 7 in mind, though it should work with any other OS supported by
 OpenCV4Android SDK.
 
 This tutorial assumes you have the following installed and configured:
@@ -23,22 +23,22 @@ This tutorial assumes you have the following installed and configured:
 
 If you need help with anything of the above, you may refer to our :ref:`android_dev_intro` guide.
 
-This tutorial also assumes you have OpenCV4Android SDK already installed on your development 
-machine and OpenCV Manager on your testing device correspondingly. If you need help with any of 
+This tutorial also assumes you have OpenCV4Android SDK already installed on your development
+machine and OpenCV Manager on your testing device correspondingly. If you need help with any of
 these, you may consult our :ref:`O4A_SDK` tutorial.
 
-If you encounter any error after thoroughly following these steps, feel free to contact us via 
-`OpenCV4Android <https://groups.google.com/group/android-opencv/>`_ discussion group or OpenCV 
+If you encounter any error after thoroughly following these steps, feel free to contact us via
+`OpenCV4Android <https://groups.google.com/group/android-opencv/>`_ discussion group or OpenCV
 `Q&A forum <http://answers.opencv.org>`_ . We'll do our best to help you out.
 
 
 Using OpenCV Library Within Your Android Project
 ================================================
 
-In this section we will explain how to make some existing project to use OpenCV. 
-Starting with 2.4.2 release for Android, *OpenCV Manager* is used to provide apps with the best 
-available version of OpenCV. 
-You can get more information here: :ref:`Android_OpenCV_Manager` and in these 
+In this section we will explain how to make some existing project to use OpenCV.
+Starting with 2.4.2 release for Android, *OpenCV Manager* is used to provide apps with the best
+available version of OpenCV.
+You can get more information here: :ref:`Android_OpenCV_Manager` and in these
 `slides <https://docs.google.com/a/itseez.com/presentation/d/1EO_1kijgBg_BsjNp2ymk-aarg-0K279_1VZRcPplSuk/present#slide=id.p>`_.
 
 
@@ -48,31 +48,31 @@ Java
 Application Development with Async Initialization
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Using async initialization is a **recommended** way for application development. It uses the OpenCV 
+Using async initialization is a **recommended** way for application development. It uses the OpenCV
 Manager to access OpenCV libraries externally installed in the target system.
 
-#. Add OpenCV library project to your workspace. Use menu 
+#. Add OpenCV library project to your workspace. Use menu
    :guilabel:`File -> Import -> Existing project in your workspace`.
 
-   Press :guilabel:`Browse`  button and locate OpenCV4Android SDK 
+   Press :guilabel:`Browse`  button and locate OpenCV4Android SDK
    (:file:`OpenCV-2.4.6-android-sdk/sdk`).
 
    .. image:: images/eclipse_opencv_dependency0.png
         :alt: Add dependency from OpenCV library
         :align: center
 
-#. In application project add a reference to the OpenCV Java SDK in 
+#. In application project add a reference to the OpenCV Java SDK in
    :guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.6``.
 
    .. image:: images/eclipse_opencv_dependency1.png
         :alt: Add dependency from OpenCV library
         :align: center
 
-In most cases OpenCV Manager may be installed automatically from Google Play. For the case, when 
-Google Play is not available, i.e. emulator, developer board, etc, you can install it manually 
+In most cases OpenCV Manager may be installed automatically from Google Play. For the case, when
+Google Play is not available, i.e. emulator, developer board, etc, you can install it manually
 using adb tool. See :ref:`manager_selection` for details.
 
-There is a very base code snippet implementing the async initialization. It shows basic principles. 
+There is a very base code snippet implementing the async initialization. It shows basic principles.
 See the "15-puzzle" OpenCV sample for details.
 
 .. code-block:: java
@@ -107,47 +107,47 @@ See the "15-puzzle" OpenCV sample for details.
         ...
     }
 
-It this case application works with OpenCV Manager in asynchronous fashion. ``OnManagerConnected`` 
-callback will be called in UI thread, when initialization finishes. Please note, that it is not 
-allowed to use OpenCV calls or load OpenCV-dependent native libs before invoking this callback. 
-Load your own native libraries that depend on OpenCV after the successful OpenCV initialization. 
-Default ``BaseLoaderCallback`` implementation treat application context as Activity and calls 
-``Activity.finish()`` method to exit in case of initialization failure. To override this behavior 
-you need to override ``finish()`` method of ``BaseLoaderCallback`` class and implement your own 
+It this case application works with OpenCV Manager in asynchronous fashion. ``OnManagerConnected``
+callback will be called in UI thread, when initialization finishes. Please note, that it is not
+allowed to use OpenCV calls or load OpenCV-dependent native libs before invoking this callback.
+Load your own native libraries that depend on OpenCV after the successful OpenCV initialization.
+Default ``BaseLoaderCallback`` implementation treat application context as Activity and calls
+``Activity.finish()`` method to exit in case of initialization failure. To override this behavior
+you need to override ``finish()`` method of ``BaseLoaderCallback`` class and implement your own
 finalization method.
 
 
 Application Development with Static Initialization
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-According to this approach all OpenCV binaries are included into your application package. It is 
-designed mostly for development purposes. This approach is deprecated for the production code, 
-release package is recommended to communicate with OpenCV Manager via the async initialization 
+According to this approach all OpenCV binaries are included into your application package. It is
+designed mostly for development purposes. This approach is deprecated for the production code,
+release package is recommended to communicate with OpenCV Manager via the async initialization
 described above.
 
-#. Add the OpenCV library project to your workspace the same way as for the async initialization 
-   above. Use menu :guilabel:`File -> Import -> Existing project in your workspace`, 
-   press :guilabel:`Browse` button and select OpenCV SDK path 
+#. Add the OpenCV library project to your workspace the same way as for the async initialization
+   above. Use menu :guilabel:`File -> Import -> Existing project in your workspace`,
+   press :guilabel:`Browse` button and select OpenCV SDK path
    (:file:`OpenCV-2.4.6-android-sdk/sdk`).
 
    .. image:: images/eclipse_opencv_dependency0.png
         :alt: Add dependency from OpenCV library
         :align: center
 
-#. In the application project add a reference to the OpenCV4Android SDK in 
+#. In the application project add a reference to the OpenCV4Android SDK in
    :guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.6``;
 
    .. image:: images/eclipse_opencv_dependency1.png
        :alt: Add dependency from OpenCV library
        :align: center
 
-#. If your application project **doesn't have a JNI part**, just copy the corresponding OpenCV 
+#. If your application project **doesn't have a JNI part**, just copy the corresponding OpenCV
    native libs from :file:`<OpenCV-2.4.6-android-sdk>/sdk/native/libs/<target_arch>` to your
    project directory to folder :file:`libs/<target_arch>`.
 
-   In case of the application project **with a JNI part**, instead of manual libraries copying you 
+   In case of the application project **with a JNI part**, instead of manual libraries copying you
    need to modify your ``Android.mk`` file:
-   add the following two code lines after the ``"include $(CLEAR_VARS)"`` and before 
+   add the following two code lines after the ``"include $(CLEAR_VARS)"`` and before
    ``"include path_to_OpenCV-2.4.6-android-sdk/sdk/native/jni/OpenCV.mk"``
 
    .. code-block:: make
@@ -168,13 +168,13 @@ described above.
       OPENCV_INSTALL_MODULES:=on
       include ../../sdk/native/jni/OpenCV.mk
 
-   After that the OpenCV libraries will be copied to your application :file:`libs` folder during 
+   After that the OpenCV libraries will be copied to your application :file:`libs` folder during
    the JNI build.v
 
-   Eclipse will automatically include all the libraries from the :file:`libs` folder to the 
-   application package (APK). 
+   Eclipse will automatically include all the libraries from the :file:`libs` folder to the
+   application package (APK).
 
-#. The last step of enabling OpenCV in your application is Java initialization code before calling 
+#. The last step of enabling OpenCV in your application is Java initialization code before calling
    OpenCV API. It can be done, for example, in the static section of the ``Activity`` class:
 
    .. code-block:: java
@@ -186,7 +186,7 @@ described above.
           }
       }
 
-   If you application includes other OpenCV-dependent native libraries you should load them 
+   If you application includes other OpenCV-dependent native libraries you should load them
    **after** OpenCV initialization:
 
    .. code-block:: java
@@ -205,16 +205,16 @@ described above.
 Native/C++
 ----------
 
-To build your own Android application, using OpenCV as native part, the following steps should be 
+To build your own Android application, using OpenCV as native part, the following steps should be
 taken:
 
-#. You can use an environment variable to specify the location of OpenCV package or just hardcode 
+#. You can use an environment variable to specify the location of OpenCV package or just hardcode
    absolute or relative path in the :file:`jni/Android.mk` of your projects.
 
-#.  The file :file:`jni/Android.mk` should be written for the current application using the common 
+#.  The file :file:`jni/Android.mk` should be written for the current application using the common
     rules for this file.
 
-    For detailed information see the Android NDK documentation from the Android NDK archive, in the 
+    For detailed information see the Android NDK documentation from the Android NDK archive, in the
     file :file:`<path_where_NDK_is_placed>/docs/ANDROID-MK.html`.
 
 #. The following line:
@@ -229,7 +229,7 @@ taken:
 
       include $(CLEAR_VARS)
 
-#. Several variables can be used to customize OpenCV stuff, but you **don't need** to use them when 
+#. Several variables can be used to customize OpenCV stuff, but you **don't need** to use them when
    your application uses the `async initialization` via the `OpenCV Manager` API.
 
    .. note:: These variables should be set **before**  the ``"include .../OpenCV.mk"`` line:
@@ -238,7 +238,7 @@ taken:
 
                 OPENCV_INSTALL_MODULES:=on
 
-   Copies necessary OpenCV dynamic libs to the project ``libs`` folder in order to include them 
+   Copies necessary OpenCV dynamic libs to the project ``libs`` folder in order to include them
    into the APK.
 
    .. code-block:: make
@@ -251,7 +251,7 @@ taken:
 
       OPENCV_LIB_TYPE:=STATIC
 
-   Perform static linking with OpenCV. By default dynamic link is used and the project JNI lib 
+   Perform static linking with OpenCV. By default dynamic link is used and the project JNI lib
    depends on ``libopencv_java.so``.
 
 #. The file :file:`Application.mk` should exist and should contain lines:
@@ -269,8 +269,8 @@ taken:
 
    Should specify the application target platforms.
 
-   In some cases a linkage error (like ``"In function 'cv::toUtf16(std::basic_string<...>... 
-   undefined reference to 'mbstowcs'"``) happens when building an application JNI library, 
+   In some cases a linkage error (like ``"In function 'cv::toUtf16(std::basic_string<...>...
+   undefined reference to 'mbstowcs'"``) happens when building an application JNI library,
    depending on OpenCV. The following line in the :file:`Application.mk` usually fixes it:
 
    .. code-block:: make
@@ -278,19 +278,19 @@ taken:
       APP_PLATFORM := android-9
 
 
-#. Either use :ref:`manual <NDK_build_cli>` ``ndk-build`` invocation or 
-   :ref:`setup Eclipse CDT Builder <CDT_Builder>` to build native JNI lib before (re)building the Java 
+#. Either use :ref:`manual <NDK_build_cli>` ``ndk-build`` invocation or
+   :ref:`setup Eclipse CDT Builder <CDT_Builder>` to build native JNI lib before (re)building the Java
    part and creating an APK.
 
 
 Hello OpenCV Sample
 ===================
 
-Here are basic steps to guide you trough the process of creating a simple OpenCV-centric 
-application. It will be capable of accessing camera output, processing it and displaying the 
+Here are basic steps to guide you trough the process of creating a simple OpenCV-centric
+application. It will be capable of accessing camera output, processing it and displaying the
 result.
 
-#. Open Eclipse IDE, create a new clean workspace, create a new Android project 
+#. Open Eclipse IDE, create a new clean workspace, create a new Android project
    :menuselection:`File --> New --> Android Project`
 
 #. Set name, target, package and ``minSDKVersion`` accordingly. The minimal SDK version for build
index 8d117a0..2973b7e 100644 (file)
@@ -20,7 +20,7 @@ In MacOS it can be done using the following command in Terminal:
 
    cd ~/<my_working _directory>
    git clone https://github.com/Itseez/opencv.git
+
 
 Building OpenCV from Source, using CMake and Command Line
 =========================================================
@@ -28,10 +28,10 @@ Building OpenCV from Source, using CMake and Command Line
 #. Make symbolic link for Xcode to let OpenCV build scripts find the compiler, header files etc.
 
     .. code-block:: bash
-    
+
        cd /
        sudo ln -s /Applications/Xcode.app/Contents/Developer Developer
-       
+
 #. Build OpenCV framework:
 
     .. code-block:: bash
index 41c161c..dc68445 100644 (file)
@@ -11,7 +11,7 @@ Prerequisites
 
 1. Having installed `Eclipse <http://www.eclipse.org/>`_ in your workstation (only the CDT plugin for C/C++ is needed). You can follow the following steps:
 
-   * Go to the Eclipse site  
+   * Go to the Eclipse site
 
    * Download `Eclipse IDE for C/C++ Developers <http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/heliossr2>`_ . Choose the link according to your workstation.
 
@@ -20,7 +20,7 @@ Prerequisites
 Making a project
 =================
 
-1. Start Eclipse. Just run the executable that comes in the folder. 
+1. Start Eclipse. Just run the executable that comes in the folder.
 
 #. Go to **File -> New -> C/C++ Project**
 
@@ -28,13 +28,13 @@ Making a project
       :alt: Eclipse Tutorial Screenshot 0
       :align: center
 
-#. Choose a name for your project (i.e. DisplayImage). An **Empty Project** should be okay for this example. 
+#. Choose a name for your project (i.e. DisplayImage). An **Empty Project** should be okay for this example.
 
    .. image:: images/a1.png
       :alt: Eclipse Tutorial Screenshot 1
       :align: center
 
-#. Leave everything else by default. Press **Finish**. 
+#. Leave everything else by default. Press **Finish**.
 
 #. Your project (in this case DisplayImage) should appear in the **Project Navigator** (usually at the left side of your window).
 
@@ -45,7 +45,7 @@ Making a project
 
 #. Now, let's add a source file using OpenCV:
 
-   * Right click on **DisplayImage** (in the Navigator). **New -> Folder** . 
+   * Right click on **DisplayImage** (in the Navigator). **New -> Folder** .
 
      .. image:: images/a4.png
         :alt: Eclipse Tutorial Screenshot 4
@@ -76,9 +76,9 @@ Making a project
         image = imread( argv[1], 1 );
 
         if( argc != 2 || !image.data )
-          { 
+          {
             printf( "No image data \n" );
-            return -1; 
+            return -1;
           }
 
         namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
@@ -102,7 +102,7 @@ Making a project
             :align: center
 
          .. note::
-            If you do not know where your opencv files are, open the **Terminal** and type: 
+            If you do not know where your opencv files are, open the **Terminal** and type:
 
             .. code-block:: bash
 
@@ -112,56 +112,56 @@ Making a project
 
             .. code-block:: bash
 
-               -I/usr/local/include/opencv -I/usr/local/include 
+               -I/usr/local/include/opencv -I/usr/local/include
 
 
       b. Now go to **GCC C++ Linker**,there you have to fill two spaces:
 
          First in **Library search path (-L)** you have to write the path to where the opencv libraries reside, in my case the path is:
          ::
-          
+
             /usr/local/lib
-          
+
          Then in **Libraries(-l)** add the OpenCV libraries that you may need. Usually just the 3 first on the list below are enough (for simple applications) . In my case, I am putting all of them since I plan to use the whole bunch:
 
 
-         opencv_core      
-         opencv_imgproc     
+         opencv_core
+         opencv_imgproc
          opencv_highgui
-         opencv_ml       
-         opencv_video      
+         opencv_ml
+         opencv_video
          opencv_features2d
-         opencv_calib3d   
-         opencv_objdetect   
+         opencv_calib3d
+         opencv_objdetect
          opencv_contrib
-         opencv_legacy    
+         opencv_legacy
          opencv_flann
 
          .. image:: images/a10.png
              :alt: Eclipse Tutorial Screenshot 10
-             :align: center 
-             
+             :align: center
+
          If you don't know where your libraries are (or you are just psychotic and want to make sure the path is fine), type in **Terminal**:
 
          .. code-block:: bash
-         
+
             pkg-config --libs opencv
 
 
          My output (in case you want to check) was:
          .. code-block:: bash
-            
-            -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann  
+
+            -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
 
          Now you are done. Click **OK**
 
-    * Your project should be ready to be built. For this, go to **Project->Build all**   
+    * Your project should be ready to be built. For this, go to **Project->Build all**
 
-      In the Console you should get something like 
+      In the Console you should get something like
 
       .. image:: images/a12.png
          :alt: Eclipse Tutorial Screenshot 12
-         :align: center 
+         :align: center
 
       If you check in your folder, there should be an executable there.
 
@@ -179,21 +179,21 @@ So, now we have an executable ready to run. If we were to use the Terminal, we w
 Assuming that the image to use as the argument would be located in <DisplayImage_directory>/images/HappyLittleFish.png. We can still do this, but let's do it from Eclipse:
 
 
-#. Go to **Run->Run Configurations** 
+#. Go to **Run->Run Configurations**
 
-#. Under C/C++ Application you will see the name of your executable + Debug (if not, click over C/C++ Application a couple of times). Select the name (in this case **DisplayImage Debug**). 
+#. Under C/C++ Application you will see the name of your executable + Debug (if not, click over C/C++ Application a couple of times). Select the name (in this case **DisplayImage Debug**).
 
 #. Now, in the right side of the window, choose the **Arguments** Tab. Write the path of the image file we want to open (path relative to the workspace/DisplayImage folder). Let's use **HappyLittleFish.png**:
 
    .. image:: images/a14.png
       :alt: Eclipse Tutorial Screenshot 14
-      :align: center 
+      :align: center
 
 #. Click on the **Apply** button and then in Run. An OpenCV window should pop up with the fish image (or whatever you used).
 
    .. image:: images/a15.jpg
       :alt: Eclipse Tutorial Screenshot 15
-      :align: center 
+      :align: center
 
 #. Congratulations! You are ready to have fun with OpenCV using Eclipse.
 
@@ -236,7 +236,7 @@ Say you have or create a new file, *helloworld.cpp* in a directory called *foo*:
    ADD_EXECUTABLE( helloworld helloworld.cxx )
    TARGET_LINK_LIBRARIES( helloworld ${OpenCV_LIBS} )
 
-#. Run: ``cmake-gui ..`` and make sure you fill in where opencv was built. 
+#. Run: ``cmake-gui ..`` and make sure you fill in where opencv was built.
 
 #. Then click ``configure`` and then ``generate``. If it's OK, **quit cmake-gui**
 
index e603e5c..f582d32 100644 (file)
@@ -11,7 +11,7 @@ Using OpenCV with gcc and CMake
    * The easiest way of using OpenCV in your code is to use `CMake <http://www.cmake.org/>`_. A few advantages (taken from the Wiki):
 
      #. No need to change anything when porting between Linux and Windows
-     #. Can easily be combined with other tools by CMake( i.e. Qt, ITK and VTK ) 
+     #. Can easily be combined with other tools by CMake( i.e. Qt, ITK and VTK )
 
    * If you are not familiar with CMake, checkout the `tutorial <http://www.cmake.org/cmake/help/cmake_tutorial.html>`_ on its website.
 
@@ -21,7 +21,7 @@ Steps
 Create a program using OpenCV
 -------------------------------
 
-Let's use a simple program such as DisplayImage.cpp shown below. 
+Let's use a simple program such as DisplayImage.cpp shown below.
 
 .. code-block:: cpp
 
@@ -36,9 +36,9 @@ Let's use a simple program such as DisplayImage.cpp shown below.
      image = imread( argv[1], 1 );
 
      if( argc != 2 || !image.data )
-       { 
+       {
          printf( "No image data \n" );
-         return -1; 
+         return -1;
        }
 
      namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
index e3039ca..e8b96da 100644 (file)
@@ -11,8 +11,8 @@ Required Packages
 
     .. code-block:: bash
 
-       sudo apt-get install build-essential 
+       sudo apt-get install build-essential
+
   * CMake 2.6 or higher;
   * Git;
   * GTK+2.x or higher, including headers (libgtk2.0-dev);
@@ -48,7 +48,7 @@ In Linux it can be achieved with the following command in Terminal:
 
    cd ~/<my_working _directory>
    git clone https://github.com/Itseez/opencv.git
+
 
 Building OpenCV from Source Using CMake, Using the Command Line
 ===============================================================
@@ -58,26 +58,26 @@ Building OpenCV from Source Using CMake, Using the Command Line
 #. Enter the <cmake_binary_dir> and type
 
    .. code-block:: bash
-     
+
       cmake [<some optional parameters>] <path to the OpenCV source directory>
 
    For example
 
    .. code-block:: bash
-       
+
       cd ~/opencv
       mkdir release
       cd release
       cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
-       
+
 #. Enter the created temporary directory (<cmake_binary_dir>) and proceed with:
 
    .. code-block:: bash
-      
+
       make
       sudo make install
 
 .. note::
-  
+
    If the size of the created library is a critical issue (like in case of an Android build) you can use the ``install/strip`` command to get the smallest size as possible. The *stripped* version appears to be twice as small. However, we do not recommend using this unless those extra megabytes do really matter.
 
index 1a757cf..50fb9ea 100644 (file)
@@ -5,8 +5,8 @@ Load, Modify, and Save an Image
 
 .. note::
 
-   We assume that by now you know how to load an image using :imread:`imread <>` and to display it in a window (using :imshow:`imshow <>`). Read the :ref:`Display_Image` tutorial otherwise. 
+   We assume that by now you know how to load an image using :imread:`imread <>` and to display it in a window (using :imshow:`imshow <>`). Read the :ref:`Display_Image` tutorial otherwise.
+
 Goals
 ======
 
@@ -35,9 +35,9 @@ Here it is:
    {
     char* imageName = argv[1];
 
-    Mat image; 
+    Mat image;
     image = imread( imageName, 1 );
-  
+
     if( argc != 2 || !image.data )
     {
       printf( " No image data \n " );
@@ -53,7 +53,7 @@ Here it is:
     namedWindow( "Gray image", CV_WINDOW_AUTOSIZE );
 
     imshow( imageName, image );
-    imshow( "Gray image", gray_image ); 
+    imshow( "Gray image", gray_image );
 
     waitKey(0);
 
@@ -67,18 +67,18 @@ Explanation
 
    * Creating a Mat object to store the image information
    * Load an image using :imread:`imread <>`, located in the path given by *imageName*. Fort this example, assume you are loading a RGB image.
-   
-#. Now we are going to convert our image from BGR to Grayscale format. OpenCV has a really nice function to do this kind of transformations: 
+
+#. Now we are going to convert our image from BGR to Grayscale format. OpenCV has a really nice function to do this kind of transformations:
 
    .. code-block:: cpp
-     
+
       cvtColor( image, gray_image, CV_BGR2GRAY );
 
    As you can see, :cvt_color:`cvtColor <>` takes as arguments:
 
    .. container:: enumeratevisibleitemswithsquare
 
-      * a source image (*image*) 
+      * a source image (*image*)
       * a destination image (*gray_image*), in which we will save the converted image.
       * an additional parameter that indicates what kind of transformation will be performed. In this case we use **CV_BGR2GRAY** (because of :imread:`imread <>` has BGR default channel order in case of color images).
 
@@ -86,7 +86,7 @@ Explanation
 
    .. code-block:: cpp
 
-      imwrite( "../../images/Gray_Image.jpg", gray_image );   
+      imwrite( "../../images/Gray_Image.jpg", gray_image );
 
    Which will save our *gray_image* as *Gray_Image.jpg* in the folder *images* located two levels up of my current location.
 
index 8ed8419..c29c13a 100644 (file)
@@ -126,7 +126,7 @@ Building the library
 
 #. Install |TortoiseGit|_. Choose the 32 or 64 bit version according to the type of OS you work in. While installing, locate your msysgit (if it doesn't do that automatically). Follow the wizard -- the default options are OK for the most part.
 
-#. Choose a directory in your file system, where you will download the OpenCV libraries to. I recommend creating a new one that has short path and no special charachters in it, for example :file:`D:/OpenCV`. For this tutorial I'll suggest you do so. If you use your own path and know, what you're doing -- it's OK. 
+#. Choose a directory in your file system, where you will download the OpenCV libraries to. I recommend creating a new one that has short path and no special charachters in it, for example :file:`D:/OpenCV`. For this tutorial I'll suggest you do so. If you use your own path and know, what you're doing -- it's OK.
 
    a) Clone the repository to the selected directory. After clicking *Clone* button, a window will appear where you can select from what repository you want to download source files (https://github.com/Itseez/opencv.git) and to what directory (:file:`D:/OpenCV`).
 
@@ -314,10 +314,10 @@ First we set an enviroment variable to make easier our work. This will hold the
 
    setx -m OPENCV_DIR D:\OpenCV\Build\x86\vc10     (suggested for Visual Studio 2010 - 32 bit Windows)
    setx -m OPENCV_DIR D:\OpenCV\Build\x64\vc10     (suggested for Visual Studio 2010 - 64 bit Windows)
-   
+
    setx -m OPENCV_DIR D:\OpenCV\Build\x86\vc11     (suggested for Visual Studio 2012 - 32 bit Windows)
    setx -m OPENCV_DIR D:\OpenCV\Build\x64\vc11     (suggested for Visual Studio 2012 - 64 bit Windows)
-   
+
 Here the directory is where you have your OpenCV binaries (*extracted* or *built*). You can have different platform (e.g. x64 instead of x86) or compiler type, so substitute appropriate value. Inside this you should have two folders called *lib* and *bin*. The -m should be added if you wish to make the settings computer wise, instead of user wise.
 
 If you built static libraries then you are done. Otherwise, you need to add the *bin* folders path to the systems path. This is cause you will use the OpenCV library in form of *\"Dynamic-link libraries\"* (also known as **DLL**). Inside these are stored all the algorithms and information the OpenCV library contains. The operating system will load them only on demand, during runtime. However, to do this he needs to know where they are. The systems **PATH** contains a list of folders where DLLs can be found. Add the OpenCV library path to this and the OS will know where to look if he ever needs the OpenCV binaries. Otherwise, you will need to copy the used DLLs right beside the applications executable file (*exe*) for the OS to find it, which is highly unpleasent if you work on many projects. To do this start up again the |PathEditor|_ and add the following new entry (right click in the application to bring up the menu):
index ccf35eb..f3058a7 100644 (file)
@@ -10,16 +10,16 @@ I start out from the assumption that you have read and completed with success th
    :alt: You should have a folder looking like this.
    :align: center
 
-The OpenCV libraries, distributed by us, on the Microsoft Windows operating system are in a **D**\ ynamic **L**\ inked **L**\ ibraries (*DLL*). These have the advantage that all the content of the library are loaded only at runtime, on demand, and that countless programs may use the same library file. This means that if you have ten applications using the OpenCV library, no need to have around a version for each one of them. Of course you need to have the *dll* of the OpenCV on all systems where you want to run your application. 
+The OpenCV libraries, distributed by us, on the Microsoft Windows operating system are in a **D**\ ynamic **L**\ inked **L**\ ibraries (*DLL*). These have the advantage that all the content of the library are loaded only at runtime, on demand, and that countless programs may use the same library file. This means that if you have ten applications using the OpenCV library, no need to have around a version for each one of them. Of course you need to have the *dll* of the OpenCV on all systems where you want to run your application.
 
 Another approach is to use static libraries that have *lib* extensions. You may build these by using our source files as described in the :ref:`Windows_Installation` tutorial. When you use this the library will be built-in inside your *exe* file.  So there is no chance that the user deletes them, for some reason. As a drawback your application will be larger one and as, it will take more time to load it during its startup.
 
-To build an application with OpenCV you need to do two things: 
+To build an application with OpenCV you need to do two things:
 
 .. container:: enumeratevisibleitemswithsquare
 
-  + *Tell* to the compiler how the OpenCV library *looks*. You do this by *showing* it the header files. 
-  + *Tell* to the linker from where to get the functions or data structures of OpenCV, when they are needed. 
+  + *Tell* to the compiler how the OpenCV library *looks*. You do this by *showing* it the header files.
+  + *Tell* to the linker from where to get the functions or data structures of OpenCV, when they are needed.
 
     If you use the *lib* system you must set the path where the library files are and specify in which one of them to look. During the build the linker will look into these libraries and add the definitions and implementation of all *used* functions and data structures to the executable file.
 
@@ -27,7 +27,7 @@ To build an application with OpenCV you need to do two things:
 
 To pass on all this information to the Visual Studio IDE you can either do it globally (so all your future projects will get these information) or locally (so only for you current project). The advantage of the global one is that you only need to do it once; however, it may be undesirable to clump all your projects all the time with all these information. In case of the global one how you do it depends on the Microsoft Visual Studio you use. There is a **2008 and previous versions** and a **2010 way** of doing it. Inside the global section of this tutorial I'll show what the main differences are.
 
-The base item of a project in Visual Studio is a solution. A solution may contain multiple projects. Projects are the building blocks of an application. Every project will realize something and you will have a main project in which you can put together this project puzzle. In case of the many simple applications (like many of the tutorials will be) you do not need to break down the application into modules. In these cases your main project will be the only existing one. Now go create a new solution inside Visual studio by going through the :menuselection:`File --> New --> Project` menu selection. Choose *Win32 Console Application* as type. Enter its name and select the path where to create it. Then in the upcoming dialog make sure you create an empty project. 
+The base item of a project in Visual Studio is a solution. A solution may contain multiple projects. Projects are the building blocks of an application. Every project will realize something and you will have a main project in which you can put together this project puzzle. In case of the many simple applications (like many of the tutorials will be) you do not need to break down the application into modules. In these cases your main project will be the only existing one. Now go create a new solution inside Visual studio by going through the :menuselection:`File --> New --> Project` menu selection. Choose *Win32 Console Application* as type. Enter its name and select the path where to create it. Then in the upcoming dialog make sure you create an empty project.
 
 .. image:: images/NewProjectVisualStudio.jpg
    :alt: Which options to select
@@ -36,7 +36,7 @@ The base item of a project in Visual Studio is a solution. A solution may contai
 The *local* method
 ==================
 
-Every project is built separately from the others. Due to this every project has its own rule package. Inside this rule packages are stored all the information the *IDE* needs to know to build your project. For any application there are at least two build modes: a *Release* and a *Debug* one. The *Debug* has many features that exist so you can find and resolve easier bugs inside your application. In contrast the *Release* is an optimized version, where the goal is to make the application run as fast as possible or to be as small as possible. You may figure that these modes also require different rules to use during build. Therefore, there exist different rule packages for each of your build modes. These rule packages are called inside the IDE as *project properties* and you can view and modify them by using the *Property Manger*. You can bring up this with :menuselection:`View --> Property Pages`. Expand it and you can see the existing rule packages (called *Proporty Sheets*). 
+Every project is built separately from the others. Due to this every project has its own rule package. Inside this rule packages are stored all the information the *IDE* needs to know to build your project. For any application there are at least two build modes: a *Release* and a *Debug* one. The *Debug* has many features that exist so you can find and resolve easier bugs inside your application. In contrast the *Release* is an optimized version, where the goal is to make the application run as fast as possible or to be as small as possible. You may figure that these modes also require different rules to use during build. Therefore, there exist different rule packages for each of your build modes. These rule packages are called inside the IDE as *project properties* and you can view and modify them by using the *Property Manger*. You can bring up this with :menuselection:`View --> Property Pages`. Expand it and you can see the existing rule packages (called *Proporty Sheets*).
 
 .. image:: images/PropertyPageExample.jpg
    :alt: An example of Property Sheet
@@ -55,10 +55,10 @@ Use for example the *OpenCV_Debug* name. Then by selecting the sheet :menuselect
    $(OPENCV_DIR)\..\..\include
 
 .. image:: images/PropertySheetOpenCVInclude.jpg
-   :alt: Add the include dir like this. 
+   :alt: Add the include dir like this.
    :align: center
 
-When adding third party libraries settings it is generally a good idea to use the power behind the environment variables. The full location of the OpenCV library may change on each system. Moreover, you may even end up yourself with moving the install directory for some reason. If you would give explicit paths inside your property sheet your project will end up not working when you pass it further to someone else who has a different OpenCV install path. Moreover, fixing this would require to manually modifying every explicit path. A more elegant solution is to use the environment variables. Anything that you put inside a parenthesis started with a dollar sign will be replaced at runtime with the current environment variables value. Here comes in play the environment variable setting we already made in our :ref:`previous tutorial <WindowsSetPathAndEnviromentVariable>`. 
+When adding third party libraries settings it is generally a good idea to use the power behind the environment variables. The full location of the OpenCV library may change on each system. Moreover, you may even end up yourself with moving the install directory for some reason. If you would give explicit paths inside your property sheet your project will end up not working when you pass it further to someone else who has a different OpenCV install path. Moreover, fixing this would require to manually modifying every explicit path. A more elegant solution is to use the environment variables. Anything that you put inside a parenthesis started with a dollar sign will be replaced at runtime with the current environment variables value. Here comes in play the environment variable setting we already made in our :ref:`previous tutorial <WindowsSetPathAndEnviromentVariable>`.
 
 Next go to the :menuselection:`Linker --> General` and under the *"Additional Library Directories"* add the libs directory:
 
@@ -67,7 +67,7 @@ Next go to the :menuselection:`Linker --> General` and under the *"Additional Li
    $(OPENCV_DIR)\lib
 
 .. image:: images/PropertySheetOpenCVLib.jpg
-   :alt: Add the library folder like this. 
+   :alt: Add the library folder like this.
    :align: center
 
 Then you need to specify the libraries in which the linker should look into. To do this go to the :menuselection:`Linker --> Input` and under the *"Additional Dependencies"* entry add the name of all modules which you want to use:
@@ -77,7 +77,7 @@ Then you need to specify the libraries in which the linker should look into. To
    :align: center
 
 .. image:: images/PropertySheetOpenCVLibrariesDebug.jpg
-   :alt: Like this. 
+   :alt: Like this.
    :align: center
 
 The names of the libraries are as follow:
@@ -105,33 +105,33 @@ A full list, for the latest version would contain:
 The letter *d* at the end just indicates that these are the libraries required for the debug. Now click ok to save and do the same with a new property inside the Release rule section. Make sure to omit the *d* letters from the library names and to save the property sheets with the save icon above them.
 
 .. image:: images/PropertySheetOpenCVLibrariesRelease.jpg
-   :alt: And the release ones. 
+   :alt: And the release ones.
    :align: center
 
-You can find your property sheets inside your projects directory. At this point it is a wise decision to back them up into some special directory, to always have them at hand in the future, whenever you create an OpenCV project. Note that for Visual Studio 2010 the file extension is *props*, while for 2008 this is *vsprops*. 
+You can find your property sheets inside your projects directory. At this point it is a wise decision to back them up into some special directory, to always have them at hand in the future, whenever you create an OpenCV project. Note that for Visual Studio 2010 the file extension is *props*, while for 2008 this is *vsprops*.
 
 .. image:: images/PropertySheetInsideFolder.jpg
-   :alt: And the release ones. 
+   :alt: And the release ones.
    :align: center
 
-Next time when you make a new OpenCV project just use the "Add Existing Property Sheet..." menu entry inside the Property Manager to easily add the OpenCV build rules. 
+Next time when you make a new OpenCV project just use the "Add Existing Property Sheet..." menu entry inside the Property Manager to easily add the OpenCV build rules.
 
 .. image:: images/PropertyPageAddExisting.jpg
-   :alt: Use this option. 
+   :alt: Use this option.
    :align: center
 
 The *global* method
 ===================
 
-In case you find to troublesome to add the property pages to each and every one of your projects you can also add this rules to a *"global property page"*. However, this applies only to the additional include and library directories. The name of the libraries to use you still need to specify manually by using for instance: a Property page. 
+In case you find to troublesome to add the property pages to each and every one of your projects you can also add this rules to a *"global property page"*. However, this applies only to the additional include and library directories. The name of the libraries to use you still need to specify manually by using for instance: a Property page.
 
-In Visual Studio 2008 you can find this under the:  :menuselection:`Tools --> Options --> Projects and Solutions --> VC++ Directories`. 
+In Visual Studio 2008 you can find this under the:  :menuselection:`Tools --> Options --> Projects and Solutions --> VC++ Directories`.
 
 .. image:: images/VCDirectories2008.jpg
    :alt: VC++ Directories in VS 2008.
    :align: center
 
-In Visual Studio 2010 this has been moved to a global property sheet which is automatically added to every project you create: 
+In Visual Studio 2010 this has been moved to a global property sheet which is automatically added to every project you create:
 
 .. image:: images/VCDirectories2010.jpg
    :alt: VC++ Directories in VS 2010.
@@ -153,10 +153,10 @@ You can start a Visual Studio build from two places. Either inside from the *IDE
 
 .. |voila| unicode:: voil U+00E1
 
-This is important to remember when you code inside the code open and save commands. You're resources will be saved ( and queried for at opening!!!) relatively to your working directory. This is unless you give a full, explicit path as parameter for the I/O functions. In the code above we open :download:`this OpenCV logo<../../../../samples/cpp/tutorial_code/images/opencv-logo.png>`. Before starting up the application make sure you place the image file in your current working directory. Modify the image file name inside the code to try it out on other images too. Run it and |voila|: 
+This is important to remember when you code inside the code open and save commands. You're resources will be saved ( and queried for at opening!!!) relatively to your working directory. This is unless you give a full, explicit path as parameter for the I/O functions. In the code above we open :download:`this OpenCV logo<../../../../samples/cpp/tutorial_code/images/opencv-logo.png>`. Before starting up the application make sure you place the image file in your current working directory. Modify the image file name inside the code to try it out on other images too. Run it and |voila|:
 
 .. image:: images/SuccessVisualStudioWindows.jpg
-   :alt: You should have this. 
+   :alt: You should have this.
    :align: center
 
 Command line arguments with Visual Studio
@@ -167,11 +167,11 @@ Throughout some of our future tutorials you'll see that the programs main input
 .. code-block:: bash
    :linenos:
 
-   D: 
+   D:
    CD OpenCV\MySolutionName\Release
    MySolutionName.exe exampleImage.jpg
 
-Here I first changed my drive (if your project isn't on the OS local drive), navigated to my project and start it with an example image argument. While under Linux system it is common to fiddle around with the console window on the Microsoft Windows many people come to use it almost never. Besides, adding the same argument again and again while you are testing your application is, somewhat, a cumbersome task. Luckily, in the Visual Studio there is a menu to automate all this: 
+Here I first changed my drive (if your project isn't on the OS local drive), navigated to my project and start it with an example image argument. While under Linux system it is common to fiddle around with the console window on the Microsoft Windows many people come to use it almost never. Besides, adding the same argument again and again while you are testing your application is, somewhat, a cumbersome task. Luckily, in the Visual Studio there is a menu to automate all this:
 
 .. image:: images/VisualStudioCommandLineArguments.jpg
    :alt: Visual Studio Command Line Arguments
index 7b201b9..e15a43b 100644 (file)
@@ -114,7 +114,7 @@ Now assume you want to do a visual sanity check of the *cv::Canny()* implementat
 
 .. image:: images/edges_zoom.png
        :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
@@ -124,7 +124,7 @@ The :menuselection:`Link Views` feature keeps the view region fixed when flippin
 
 .. image:: images/input_zoom.png
        :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.
 
 More ...
index 8e6ddb8..8deda33 100644 (file)
@@ -19,7 +19,7 @@ Follow this step by step guide to link OpenCV to iOS.
 
 1. Create a new XCode project.
 
-2. Now we need to link *opencv2.framework* with Xcode. Select the project Navigator in the left hand panel and click on project name.  
+2. Now we need to link *opencv2.framework* with Xcode. Select the project Navigator in the left hand panel and click on project name.
 
 3. Under the TARGETS click on Build Phases. Expand Link Binary With Libraries option.
 
@@ -29,10 +29,10 @@ Follow this step by step guide to link OpenCV to iOS.
 
 .. image:: images/linking_opencv_ios.png
      :alt: OpenCV iOS in Xcode
-     :align: center 
+     :align: center
 
 *Hello OpenCV iOS Application*
-=============================== 
+===============================
 
 Now we will learn how to write a simple Hello World Application in Xcode using OpenCV.
 
@@ -49,7 +49,7 @@ Now we will learn how to write a simple Hello World Application in Xcode using O
 
 .. image:: images/header_directive.png
      :alt: header
-     :align: center 
+     :align: center
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -61,7 +61,7 @@ Now we will learn how to write a simple Hello World Application in Xcode using O
 
 .. image:: images/view_did_load.png
      :alt: view did load
-     :align: center 
+     :align: center
 
 .. container:: enumeratevisibleitemswithsquare
 
@@ -73,4 +73,4 @@ Now we will learn how to write a simple Hello World Application in Xcode using O
 .. image:: images/output.png
      :alt: output
      :align: center
-                
+
index e8d4aad..fd2d9c6 100644 (file)
@@ -21,9 +21,9 @@ In *OpenCV* all the image processing operations are done on *Mat*. iOS uses UIIm
      CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
      CGFloat cols = image.size.width;
      CGFloat rows = image.size.height;
-    
+
      cv::Mat cvMat(rows, cols, CV_8UC4); // 8 bits per component, 4 channels
-    
+
      CGContextRef contextRef = CGBitmapContextCreate(cvMat.data,                 // Pointer to  data
                                                     cols,                       // Width of bitmap
                                                     rows,                       // Height of bitmap
@@ -32,11 +32,11 @@ In *OpenCV* all the image processing operations are done on *Mat*. iOS uses UIIm
                                                     colorSpace,                 // Colorspace
                                                     kCGImageAlphaNoneSkipLast |
                                                     kCGBitmapByteOrderDefault); // Bitmap info flags
-    
+
      CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image.CGImage);
      CGContextRelease(contextRef);
      CGColorSpaceRelease(colorSpace);
-    
+
      return cvMat;
    }
 
@@ -47,9 +47,9 @@ In *OpenCV* all the image processing operations are done on *Mat*. iOS uses UIIm
      CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage);
      CGFloat cols = image.size.width;
      CGFloat rows = image.size.height;
-    
+
      cv::Mat cvMat(rows, cols, CV_8UC1); // 8 bits per component, 1 channels
-    
+
      CGContextRef contextRef = CGBitmapContextCreate(cvMat.data,                 // Pointer to data
                                                     cols,                       // Width of bitmap
                                                     rows,                       // Height of bitmap
@@ -58,11 +58,11 @@ In *OpenCV* all the image processing operations are done on *Mat*. iOS uses UIIm
                                                     colorSpace,                 // Colorspace
                                                     kCGImageAlphaNoneSkipLast |
                                                     kCGBitmapByteOrderDefault); // Bitmap info flags
-    
+
      CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image.CGImage);
      CGContextRelease(contextRef);
      CGColorSpaceRelease(colorSpace);
-    
+
      return cvMat;
     }
 
@@ -81,15 +81,15 @@ After the processing we need to convert it back to UIImage.
    {
      NSData *data = [NSData dataWithBytes:cvMat.data length:cvMat.elemSize()*cvMat.total()];
      CGColorSpaceRef colorSpace;
-    
+
      if (cvMat.elemSize() == 1) {
          colorSpace = CGColorSpaceCreateDeviceGray();
      } else {
          colorSpace = CGColorSpaceCreateDeviceRGB();
      }
-    
+
      CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
-    
+
      // Creating CGImage from cv::Mat
      CGImageRef imageRef = CGImageCreate(cvMat.cols,                                 //width
                                         cvMat.rows,                                 //height
@@ -103,15 +103,15 @@ After the processing we need to convert it back to UIImage.
                                         false,                                      //should interpolate
                                         kCGRenderingIntentDefault                   //intent
                                         );
-    
-    
+
+
      // Getting UIImage from CGImage
      UIImage *finalImage = [UIImage imageWithCGImage:imageRef];
      CGImageRelease(imageRef);
      CGDataProviderRelease(provider);
      CGColorSpaceRelease(colorSpace);
-    
-     return finalImage; 
+
+     return finalImage;
     }
 
 *Output*
@@ -119,9 +119,9 @@ After the processing we need to convert it back to UIImage.
 
 .. image:: images/output.jpg
      :alt: header
-     :align: center 
+     :align: center
 
-Check out an instance of running code with more Image Effects on `YouTube <http://www.youtube.com/watch?v=Ko3K_xdhJ1I>`_ . 
+Check out an instance of running code with more Image Effects on `YouTube <http://www.youtube.com/watch?v=Ko3K_xdhJ1I>`_ .
 
 .. raw:: html
 
index 5ecda41..377446d 100644 (file)
@@ -69,7 +69,7 @@
 
 .. toctree::
    :hidden:
-   
+
    ../hello/hello
    ../image_manipulation/image_manipulation
    ../video_processing/video_processing
index 6143f77..4d8116a 100644 (file)
@@ -18,34 +18,34 @@ 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 <http://sourceforge.net/projects/opencvlibrary/files/opencv-ios/>. 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
-       
-       
+
+
 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:
-       
+
        //
        // Prefix header for all source files of the 'VideoFilters' target in the 'VideoFilters' project
        //
-       
+
        #import <Availability.h>
-       
+
        #ifndef __IPHONE_4_0
        #warning "This project uses features only available in iOS SDK 4.0 and later."
        #endif
-       
+
        #ifdef __cplusplus
        #import <opencv2/opencv.hpp>
        #endif
-       
+
        #ifdef __OBJC__
                #import <UIKit/UIKit.h>
                #import <Foundation/Foundation.h>
        #endif
-       
-       
-       
+
+
+
 Example video frame processing project
 --------------------------------------
 User Interface
@@ -60,18 +60,18 @@ Make sure to add and connect the IBOutlets and IBActions to the corresponding Vi
 
 .. code-block:: objc
        :linenos:
-       
+
        @interface ViewController : UIViewController
        {
                IBOutlet UIImageView* imageView;
                IBOutlet UIButton* button;
        }
-       
+
        - (IBAction)actionStart:(id)sender;
-       
+
        @end
-       
-       
+
+
 Adding the Camera
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -79,21 +79,21 @@ We add a camera controller to the view controller and initialize it when the vie
 
 .. code-block:: objc
        :linenos:
-       
+
        #import <opencv2/highgui/cap_ios.h>
        using namespace cv;
-       
-       
+
+
        @interface ViewController : UIViewController
        {
-               ...     
+               ...
                CvVideoCamera* videoCamera;
        }
        ...
        @property (nonatomic, retain) CvVideoCamera* videoCamera;
-       
+
        @end
-       
+
 .. code-block:: objc
        :linenos:
 
@@ -101,7 +101,7 @@ We add a camera controller to the view controller and initialize it when the vie
        {
                [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;
@@ -109,7 +109,7 @@ We add a camera controller to the view controller and initialize it when the vie
                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).
 
 The property defaultFPS sets the FPS of the camera. If the processing is less fast than the desired FPS, frames are automatically dropped.
@@ -153,14 +153,14 @@ We follow the delegation pattern, which is very common in iOS, to provide access
 
 .. code-block:: objc
        :linenos:
-       
+
        @interface ViewController : UIViewController<CvVideoCameraDelegate>
-       
+
 
 
 .. code-block:: objc
        :linenos:
-       
+
        - (void)viewDidLoad
        {
                ...
@@ -194,13 +194,13 @@ From here you can start processing video frames. For example the following snipp
 
 .. code-block:: objc
        :linenos:
-       
+
        - (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);
@@ -214,9 +214,9 @@ Finally, we have to tell the camera to actually start/stop working. The followin
 
 .. code-block:: objc
        :linenos:
-       
+
        #pragma mark - UI Actions
-       
+
        - (IBAction)actionStart:(id)sender;
        {
                [self.videoCamera start];
index 6cd66e5..1b3abd6 100644 (file)
@@ -10,7 +10,7 @@ In this tutorial you will learn how to:
 
 .. container:: enumeratevisibleitemswithsquare
 
-   + Use the OpenCV functions :svms:`CvSVM::train <cvsvm-train>` to build a classifier based on SVMs and :svms:`CvSVM::predict <cvsvm-predict>` to test its performance.  
+   + Use the OpenCV functions :svms:`CvSVM::train <cvsvm-train>` to build a classifier based on SVMs and :svms:`CvSVM::predict <cvsvm-predict>` to test its performance.
 
 What is a SVM?
 ==============
@@ -36,14 +36,14 @@ Then, the operation of the SVM algorithm is based on finding the hyperplane that
 
 .. image:: images/optimal-hyperplane.png
    :alt: The Optimal hyperplane
-   :align: center 
+   :align: center
 
 How is the optimal hyperplane computed?
 =======================================
 
 Let's introduce the notation used to define formally a hyperplane:
 
-.. math:: 
+.. math::
   f(x) = \beta_{0} + \beta^{T} x,
 
 where :math:`\beta` is known as the *weight vector* and :math:`\beta_{0}` as the *bias*.
@@ -106,7 +106,7 @@ Explanation
   .. code-block:: cpp
 
      Mat trainingDataMat(3, 2, CV_32FC1, trainingData);
-     Mat labelsMat      (3, 1, CV_32FC1, labels);    
+     Mat labelsMat      (3, 1, CV_32FC1, labels);
 
 2. **Set up SVM's parameters**
 
@@ -143,7 +143,7 @@ Explanation
   .. code-block:: cpp
 
      Vec3b green(0,255,0), blue (255,0,0);
-     
+
      for (int i = 0; i < image.rows; ++i)
          for (int j = 0; j < image.cols; ++j)
          {
@@ -152,8 +152,8 @@ Explanation
 
          if (response == 1)
             image.at<Vec3b>(j, i)  = green;
-         else 
-         if (response == -1) 
+         else
+         if (response == -1)
             image.at<Vec3b>(j, i)  = blue;
          }
 
@@ -184,5 +184,5 @@ Results
 
 .. image:: images/result.png
   :alt: The seperated planes
-  :align: center 
+  :align: center
 
index 452b896..4691756 100644 (file)
@@ -5,9 +5,9 @@
 
 Use the powerfull machine learning classes for statistical classification, regression and clustering of data.
 
-.. include:: ../../definitions/tocDefinitions.rst 
+.. include:: ../../definitions/tocDefinitions.rst
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
@@ -18,7 +18,7 @@ Use the powerfull machine learning classes for statistical classification, regre
 
                *Author:* |Author_FernandoI|
 
-               Learn what a Suport Vector Machine is. 
+               Learn what a Suport Vector Machine is.
 
   ============ ==============================================
 
@@ -26,7 +26,7 @@ Use the powerfull machine learning classes for statistical classification, regre
      :height: 90pt
      :width:  90pt
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
@@ -51,6 +51,6 @@ Use the powerfull machine learning classes for statistical classification, regre
 
 .. toctree::
    :hidden:
-   
+
    ../introduction_to_svm/introduction_to_svm
    ../non_linear_svms/non_linear_svms
index 64ed109..c9df3eb 100644 (file)
@@ -5,23 +5,23 @@
 
 Ever wondered how your digital camera detects peoples and faces? Look here to find out!
 
-.. include:: ../../definitions/tocDefinitions.rst 
+.. include:: ../../definitions/tocDefinitions.rst
 
-+ 
++
   .. tabularcolumns:: m{100pt} m{300pt}
   .. cssclass:: toctableopencv
 
   ===================== ==============================================
    |CascadeClassif|     **Title:** :ref:`cascade_classifier`
-  
+
                         *Compatibility:* > OpenCV 2.0
-                        
+
                         *Author:* |Author_AnaH|
-                        
+
                         Here we learn how to use *objdetect* to find objects in our images or videos
-  
+
   ===================== ==============================================
-  
+
   .. |CascadeClassif| image:: images/Cascade_Classifier_Tutorial_Cover.jpg
                       :height: 90pt
                       :width:  90pt
index 778bc5c..a2521d6 100644 (file)
@@ -3,7 +3,7 @@
 *video* module. Video analysis
 -----------------------------------------------------------
 
-Look here in order to find use on your video stream algoritms like: motion extraction, feature tracking and foreground extractions. 
+Look here in order to find use on your video stream algoritms like: motion extraction, feature tracking and foreground extractions.
 
 .. include:: ../../definitions/noContent.rst
 
index ac56336..e3ef302 100644 (file)
@@ -78,7 +78,7 @@ First, we create an instance of a keypoint detector. All detectors inherit the a
     extractor.compute(img1, keypoints1, descriptors1);
     extractor.compute(img2, keypoints2, descriptors2);
 
-We create an instance of descriptor extractor. The most of OpenCV descriptors inherit ``DescriptorExtractor`` abstract interface. Then we compute descriptors for each of the keypoints. The output ``Mat`` of the ``DescriptorExtractor::compute`` method contains a descriptor in a row *i* for each *i*-th keypoint. Note that the method can modify the keypoints vector by removing the keypoints such that a descriptor for them is not defined (usually these are the keypoints near image border). The method makes sure that the ouptut keypoints and descriptors are consistent with each other (so that the number of keypoints is equal to the descriptors row count). :: 
+We create an instance of descriptor extractor. The most of OpenCV descriptors inherit ``DescriptorExtractor`` abstract interface. Then we compute descriptors for each of the keypoints. The output ``Mat`` of the ``DescriptorExtractor::compute`` method contains a descriptor in a row *i* for each *i*-th keypoint. Note that the method can modify the keypoints vector by removing the keypoints such that a descriptor for them is not defined (usually these are the keypoints near image border). The method makes sure that the ouptut keypoints and descriptors are consistent with each other (so that the number of keypoints is equal to the descriptors row count). ::
 
     // matching descriptors
     BruteForceMatcher<L2<float> > matcher;
index 5fd1630..d4cef8f 100644 (file)
@@ -13,7 +13,7 @@ Images
 Load an image from a file: ::
 
     Mat img = imread(filename)
-    
+
 If you read a jpg file, a 3 channel image is created by default. If you need a grayscale image, use: ::
 
     Mat img = imread(filename, 0);
@@ -23,14 +23,14 @@ If you read a jpg file, a 3 channel image is created by default. If you need a g
 Save an image to a file: ::
 
     imwrite(filename, img);
-    
+
 .. note:: format of the file is determined by its extension.
 
 .. note:: use ``imdecode`` and ``imencode`` to read and write image from/to memory rather than a file.
 
 XML/YAML
 --------
-    
+
 TBD
 
 Basic operations with images
@@ -71,7 +71,7 @@ There are functions in OpenCV, especially from calib3d module, such as ``project
     //... fill the array
     Mat pointsMat = Mat(points);
 
-One can access a point in this matrix using the same method ``Mat::at`` : 
+One can access a point in this matrix using the same method ``Mat::at`` :
 
 ::
 
@@ -87,7 +87,7 @@ Memory management and reference counting
     // .. fill the array
     Mat pointsMat = Mat(points).reshape(1);
 
-As a result we get a 32FC1 matrix with 3 columns instead of 32FC3 matrix with 1 column. ``pointsMat`` uses data from ``points`` and will not deallocate the memory when destroyed. In this particular instance, however, developer has to make sure that lifetime of ``points`` is longer than of ``pointsMat``. 
+As a result we get a 32FC1 matrix with 3 columns instead of 32FC3 matrix with 1 column. ``pointsMat`` uses data from ``points`` and will not deallocate the memory when destroyed. In this particular instance, however, developer has to make sure that lifetime of ``points`` is longer than of ``pointsMat``.
 If we need to copy the data, this is done using, for example, ``Mat::copyTo`` or ``Mat::clone``: ::
 
     Mat img = imread("image.jpg");
@@ -117,7 +117,7 @@ A convertion from ``Mat`` to C API data structures: ::
     IplImage img1 = img;
     CvMat m = img;
 
-Note that there is no data copying here. 
+Note that there is no data copying here.
 
 Conversion from color to grey scale: ::
 
index cb5190b..601f504 100644 (file)
@@ -6,7 +6,7 @@ Cascade Classifier Training
 
 Introduction
 ============
-The work with a cascade classifier inlcudes two major stages: training and detection. 
+The work with a cascade classifier inlcudes two major stages: training and detection.
 Detection stage is described in a documentation of ``objdetect`` module of general OpenCV documentation. Documentation gives some basic information about cascade classifier.
 Current guide is describing how to train a cascade classifier: preparation of a training data and running the training application.
 
@@ -18,10 +18,10 @@ There are two applications in OpenCV to train cascade classifier: ``opencv_haart
 
 Note that ``opencv_traincascade`` application can use TBB for multi-threading. To use it in multicore mode OpenCV must be built with TBB.
 
-Also there are some auxilary utilities related to the training. 
+Also there are some auxilary utilities related to the training.
 
     * ``opencv_createsamples`` is used to prepare a training dataset of positive and test samples. ``opencv_createsamples`` produces dataset of positive samples in a format that is supported by both ``opencv_haartraining`` and ``opencv_traincascade`` applications. The output is a file with \*.vec extension, it is a binary format which contains images.
-    
+
     * ``opencv_performance`` may be used to evaluate the quality of classifiers, but for trained by ``opencv_haartraining`` only. It takes a collection of marked up images, runs the classifier and reports the performance, i.e. number of found objects, number of missed objects, number of false alarms and other information.
 
 Since ``opencv_haartraining`` is an obsolete application, only ``opencv_traincascade`` will be described futher. ``opencv_createsamples`` utility is  needed to prepare a training data for ``opencv_traincascade``, so it will be described too.
@@ -36,7 +36,7 @@ Negative Samples
 Negative samples are taken from arbitrary images. These images must not contain detected objects. Negative samples are enumerated in a special file. It is a text file in which each line contains an image filename (relative to the directory of the description file) of negative sample image. This file must be created manually. Note that negative samples and sample images are also called background samples or background samples images, and are used interchangeably in this document. Described images may be of different sizes. But each image should be (but not nessesarily) larger then a training window size, because these images are used to subsample negative image to the training size.
 
 An example of description file:
+
 Directory structure:
 
     .. code-block:: text
@@ -45,14 +45,14 @@ Directory structure:
           img1.jpg
           img2.jpg
         bg.txt
+
 File bg.txt:
 
     .. code-block:: text
 
         img/img1.jpg
         img/img2.jpg
-        
+
 Positive Samples
 ----------------
 Positive samples are created by ``opencv_createsamples`` utility. They may be created from a single image with object or from a collection of previously marked up images.
@@ -66,37 +66,37 @@ Command line arguments:
 * ``-vec <vec_file_name>``
 
     Name of the output file containing the positive samples for training.
-    
+
 * ``-img <image_file_name>``
 
     Source object image (e.g., a company logo).
-    
+
 * ``-bg <background_file_name>``
 
     Background description file; contains a list of images which are used as a background for randomly distorted versions of the object.
 
 * ``-num <number_of_samples>``
-    
+
     Number of positive samples to generate.
-    
+
 * ``-bgcolor <background_color>``
 
     Background color (currently grayscale images are assumed); the background color denotes the transparent color. Since there might be compression artifacts, the amount of color tolerance can be specified by ``-bgthresh``. All pixels withing ``bgcolor-bgthresh`` and ``bgcolor+bgthresh`` range are interpreted as transparent.
-    
+
 * ``-bgthresh <background_color_threshold>``
 
 * ``-inv``
-    
+
     If specified, colors will be inverted.
-    
+
 * ``-randinv``
 
     If specified, colors will be inverted randomly.
-      
+
 * ``-maxidev <max_intensity_deviation>``
+
     Maximal intensity deviation of pixels in foreground samples.
-    
+
 * ``-maxxangle <max_x_rotation_angle>``
 
 * ``-maxyangle <max_y_rotation_angle>``
@@ -104,15 +104,15 @@ Command line arguments:
 * ``-maxzangle <max_z_rotation_angle>``
 
       Maximum rotation angles must be given in radians.
-      
+
 * ``-show``
 
     Useful debugging option. If specified, each sample will be shown. Pressing ``Esc`` will continue the samples creation process without.
-    
+
 * ``-w <sample_width>``
 
     Width (in pixels) of the output samples.
-  
+
 * ``-h <sample_height>``
 
     Height (in pixels) of the output samples.
@@ -123,7 +123,7 @@ The source image is rotated randomly around all three axes. The chosen angle is
 Positive samples also may be obtained from a collection of previously marked up images. This collection is described by a text file similar to background description file. Each line of this file corresponds to an image. The first element of the line is the filename. It is followed by the number of object instances. The following numbers are the coordinates of objects bounding rectangles (x, y, width, height).
 
 An example of description file:
+
 Directory structure:
 
     .. code-block:: text
@@ -132,27 +132,27 @@ Directory structure:
           img1.jpg
           img2.jpg
         info.dat
+
 File info.dat:
 
     .. code-block:: text
-    
+
         img/img1.jpg  1  140 100 45 45
         img/img2.jpg  2  100 200 50 50   50 30 25 25
+
 Image img1.jpg contains single object instance with the following coordinates of bounding rectangle: (140, 100, 45, 45). Image img2.jpg contains two object instances.
+
 In order to create positive samples from such collection, ``-info`` argument should be specified instead of ``-img``:
 
 * ``-info <collection_file_name>``
 
     Description file of marked up images collection.
+
 The scheme of samples creation in this case is as follows. The object instances are taken from images. Then they are resized to target samples size and stored in output vec-file. No distortion is applied, so the only affecting arguments are ``-w``, ``-h``, ``-show`` and ``-num``.
+
 ``opencv_createsamples`` utility may be used for examining samples stored in positive samples file. In order to do this only ``-vec``, ``-w`` and ``-h`` parameters should be specified.
-Note that for training, it does not matter how vec-files with positive samples are generated. But ``opencv_createsamples`` utility is the only one way to collect/create a vector file of positive samples, provided by OpenCV. 
+
+Note that for training, it does not matter how vec-files with positive samples are generated. But ``opencv_createsamples`` utility is the only one way to collect/create a vector file of positive samples, provided by OpenCV.
 
 Example of vec-file is available here ``opencv/data/vec_files/trainingfaces_24-24.vec``. It can be used to train a face detector with the following window size: ``-w 24 -h 24``.
 
@@ -165,99 +165,99 @@ Command line arguments of ``opencv_traincascade`` application grouped by purpose
 #.
 
     Common arguments:
-    
+
     * ``-data <cascade_dir_name>``
-    
+
         Where the trained classifier should be stored.
-      
+
     * ``-vec <vec_file_name>``
-    
+
         vec-file with positive samples (created by ``opencv_createsamples`` utility).
-      
+
     * ``-bg <background_file_name>``
-    
+
         Background description file.
-      
+
     * ``-numPos <number_of_positive_samples>``
-    
+
     * ``-numNeg <number_of_negative_samples>``
-    
+
         Number of positive/negative samples used in training for every classifier stage.
-        
+
     * ``-numStages <number_of_stages>``
-    
+
         Number of cascade stages to be trained.
-        
+
     * ``-precalcValBufSize <precalculated_vals_buffer_size_in_Mb>``
-        
+
         Size of buffer for precalculated feature values (in Mb).
-        
+
     * ``-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb>``
-    
+
         Size of buffer for precalculated feature indices (in Mb). The more memory you have the faster the training process.
-        
+
     * ``-baseFormatSave``
-        
+
         This argument is actual in case of Haar-like features. If it is specified, the cascade will be saved in the old format.
-        
+
 #.
 
     Cascade parameters:
 
     * ``-stageType <BOOST(default)>``
-    
+
         Type of stages. Only boosted classifier are supported as a stage type at the moment.
-        
+
     * ``-featureType<{HAAR(default), LBP}>``
-    
+
         Type of features: ``HAAR`` - Haar-like features, ``LBP`` - local binary patterns.
-    
+
     * ``-w <sampleWidth>``
-    
+
     * ``-h <sampleHeight>``
-    
+
         Size of training samples (in pixels). Must have exactly the same values as used during training samples creation (``opencv_createsamples`` utility).
-        
+
 #.
 
     Boosted classifer parameters:
-    
+
     * ``-bt <{DAB, RAB, LB, GAB(default)}>``
-    
+
         Type of boosted classifiers: ``DAB`` - Discrete AdaBoost, ``RAB`` - Real AdaBoost, ``LB`` - LogitBoost, ``GAB`` - Gentle AdaBoost.
-        
+
     * ``-minHitRate <min_hit_rate>``
-        
+
         Minimal desired hit rate for each stage of the classifier. Overall hit rate may be estimated as (min_hit_rate^number_of_stages).
-        
+
     * ``-maxFalseAlarmRate <max_false_alarm_rate>``
-    
+
       Maximal desired false alarm rate for each stage of the classifier. Overall false alarm rate may be estimated as (max_false_alarm_rate^number_of_stages).
-      
+
     * ``-weightTrimRate <weight_trim_rate>``
-    
+
         Specifies whether trimming should be used and its weight. A decent choice is 0.95.
-        
+
     * ``-maxDepth <max_depth_of_weak_tree>``
-    
+
         Maximal depth of a weak tree. A decent choice is 1, that is case of stumps.
-        
+
     * ``-maxWeakCount <max_weak_tree_count>``
-    
+
         Maximal count of weak trees for every cascade stage. The boosted classifier (stage) will have so many weak trees (``<=maxWeakCount``), as needed to achieve the given ``-maxFalseAlarmRate``.
-        
+
 #.
 
     Haar-like feature parameters:
-    
+
     * ``-mode <BASIC (default) | CORE | ALL>``
-    
+
         Selects the type of Haar features set used in training. ``BASIC`` use only upright features, while ``ALL`` uses the full set of upright and 45 degree rotated feature set. See [Rainer2002]_ for more details.
-    
-#.    
+
+#.
 
     Local Binary Patterns parameters:
-    
+
     Local Binary Patterns don't have parameters.
 
 After the ``opencv_traincascade`` application has finished its work, the trained cascade will be saved in cascade.xml file in the folder, which was passed as ``-data`` parameter. Other files in this folder are created for the case of interrupted training, so you may delete them after completion of training.
index 11a0802..37159b0 100644 (file)
@@ -1481,7 +1481,7 @@ Reconstructs points by triangulation.
 
     :param points4D: 4xN array of reconstructed points in homogeneous coordinates.
 
-The function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera. Projections matrices can be obtained from :ocv:func:`stereoRectify`. 
+The function reconstructs 3-dimensional points (in homogeneous coordinates) by using their observations with a stereo camera. Projections matrices can be obtained from :ocv:func:`stereoRectify`.
 
 .. seealso::
 
index fc8b1ad..1071358 100644 (file)
@@ -4,19 +4,19 @@ Changelog
 Release 0.05
 ------------
 
-This library is now included in the official OpenCV distribution (from 2.4 on). 
+This library is now included in the official OpenCV distribution (from 2.4 on).
 The :ocv:class`FaceRecognizer` is now an :ocv:class:`Algorithm`, which better fits into the overall
-OpenCV API. 
+OpenCV API.
 
-To reduce the confusion on user side and minimize my work, libfacerec and OpenCV 
-have been synchronized and are now based on the same interfaces and implementation. 
+To reduce the confusion on user side and minimize my work, libfacerec and OpenCV
+have been synchronized and are now based on the same interfaces and implementation.
 
 The library now has an extensive documentation:
 
 * The API is explained in detail and with a lot of code examples.
-* The face recognition guide I had written for Python and GNU Octave/MATLAB has been adapted to the new OpenCV C++ ``cv::FaceRecognizer``. 
+* The face recognition guide I had written for Python and GNU Octave/MATLAB has been adapted to the new OpenCV C++ ``cv::FaceRecognizer``.
 * A tutorial for gender classification with Fisherfaces.
-* A tutorial for face recognition in videos (e.g. webcam). 
+* A tutorial for face recognition in videos (e.g. webcam).
 
 
 Release highlights
@@ -27,8 +27,8 @@ Release highlights
 Release 0.04
 ------------
 
-This version is fully Windows-compatible and works with OpenCV 2.3.1. Several 
-bugfixes, but none influenced the recognition rate. 
+This version is fully Windows-compatible and works with OpenCV 2.3.1. Several
+bugfixes, but none influenced the recognition rate.
 
 Release highlights
 ++++++++++++++++++
@@ -40,9 +40,9 @@ Release highlights
 Release 0.03
 ------------
 
-Reworked the library to provide separate implementations in cpp files, because 
-it's the preferred way of contributing OpenCV libraries. This means the library 
-is not header-only anymore. Slight API changes were done, please see the 
+Reworked the library to provide separate implementations in cpp files, because
+it's the preferred way of contributing OpenCV libraries. This means the library
+is not header-only anymore. Slight API changes were done, please see the
 documentation for details.
 
 Release highlights
@@ -55,9 +55,9 @@ Release highlights
 Release 0.02
 ------------
 
-Reworked the library to provide separate implementations in cpp files, because 
-it's the preferred way of contributing OpenCV libraries. This means the library 
-is not header-only anymore. Slight API changes were done, please see the 
+Reworked the library to provide separate implementations in cpp files, because
+it's the preferred way of contributing OpenCV libraries. This means the library
+is not header-only anymore. Slight API changes were done, please see the
 documentation for details.
 
 Release highlights
@@ -80,7 +80,7 @@ Release highlights
   * Eigenfaces [TP91]_
   * Fisherfaces [BHK97]_
   * Local Binary Patterns Histograms [AHP04]_
-  
+
 * Added persistence facilities to store the models with a common API.
 * Unit Tests (using `gtest <http://code.google.com/p/googletest/>`_).
 * Providing a CMakeLists.txt to enable easy cross-platform building.
index 61cd882..16b425d 100644 (file)
@@ -201,7 +201,7 @@ For the first source code example, I'll go through it with you. I am first givin
 .. literalinclude:: src/facerec_eigenfaces.cpp
    :language: cpp
    :linenos:
-   
+
 The source code for this demo application is also available in the ``src`` folder coming with this documentation:
 
 * :download:`src/facerec_eigenfaces.cpp <src/facerec_eigenfaces.cpp>`
index faa77df..7948bcd 100644 (file)
@@ -6,7 +6,7 @@ Introduction
 
 Saving and loading a :ocv:class:`FaceRecognizer` is very important. Training a FaceRecognizer can be a very time-intense task, plus it's often impossible to ship the whole face database to the user of your product. The task of saving and loading a FaceRecognizer is easy with :ocv:class:`FaceRecognizer`. You only have to call :ocv:func:`FaceRecognizer::load` for loading and :ocv:func:`FaceRecognizer::save` for saving a :ocv:class:`FaceRecognizer`.
 
-I'll adapt the Eigenfaces example from the :doc:`../facerec_tutorial`: Imagine we want to learn the Eigenfaces of the `AT&T Facedatabase <http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html>`_, store the model to a YAML file and then load it again. 
+I'll adapt the Eigenfaces example from the :doc:`../facerec_tutorial`: Imagine we want to learn the Eigenfaces of the `AT&T Facedatabase <http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html>`_, store the model to a YAML file and then load it again.
 
 From the loaded model, we'll get a prediction, show the mean, Eigenfaces and the image reconstruction.
 
index ecb979d..b692fe5 100644 (file)
@@ -111,7 +111,7 @@ An example. If the haar-cascade is at ``C:/opencv/data/haarcascades/haarcascade_
 
     facerec_video.exe C:/opencv/data/haarcascades/haarcascade_frontalface_default.xml C:/facerec/data/celebrities.txt 1
 
-That's it. 
+That's it.
 
 Results
 -------
index fbf124a..bc41a86 100644 (file)
@@ -306,7 +306,7 @@ void FaceRecognizer::update(InputArrayOfArrays src, InputArray labels ) {
         dynamic_cast<LBPH*>(this)->update( src, labels );
         return;
     }
-    
+
     string error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
     CV_Error(CV_StsNotImplemented, error_msg);
 }
index 66ea59b..7631ee3 100644 (file)
@@ -553,7 +553,7 @@ Range
 -----
 .. ocv:class:: Range
 
-Template class specifying a continuous subsequence (slice) of a sequence. 
+Template class specifying a continuous subsequence (slice) of a sequence.
 
 ::
 
@@ -773,7 +773,7 @@ Mat
 ---
 .. ocv:class:: Mat
 
-OpenCV C++ n-dimensional dense array class 
+OpenCV C++ n-dimensional dense array class
 ::
 
     class CV_EXPORTS Mat
index 090a75d..0f9fa6c 100644 (file)
@@ -80,8 +80,8 @@ Splits an element set into equivalency classes.
 
     :param vec: Set of elements stored as a vector.
 
-    :param labels: Output vector of labels. It contains as many elements as  ``vec``. Each label  ``labels[i]``  is a 0-based cluster index of  ``vec[i]`` .   
-    
+    :param labels: Output vector of labels. It contains as many elements as  ``vec``. Each label  ``labels[i]``  is a 0-based cluster index of  ``vec[i]`` .
+
     :param predicate: Equivalence predicate (pointer to a boolean function of two arguments or an instance of the class that has the method  ``bool operator()(const _Tp& a, const _Tp& b)`` ). The predicate returns ``true`` when the elements are certainly in the same class, and returns ``false`` if they may or may not be in the same class.
 
 The generic function ``partition`` implements an
index 472ebfd..f1b62fb 100644 (file)
@@ -416,8 +416,8 @@ The number of pixels along the line is stored in ``LineIterator::count`` . The m
 
     for(int i = 0; i < it.count; i++, ++it)
         buf[i] = *(const Vec3b)*it;
-    
-    // alternative way of iterating through the line    
+
+    // alternative way of iterating through the line
     for(int i = 0; i < it2.count; i++, ++it2)
     {
         Vec3b val = img.at<Vec3b>(it2.pos());
index 0f8a3b0..ae95b57 100644 (file)
@@ -91,8 +91,8 @@ you can use::
 
    Ptr<T> ptr = new T(...);
 
-That is, ``Ptr<T> ptr`` encapsulates a pointer to a ``T`` instance and a reference counter associated with the pointer. See the 
-:ocv:class:`Ptr` 
+That is, ``Ptr<T> ptr`` encapsulates a pointer to a ``T`` instance and a reference counter associated with the pointer. See the
+:ocv:class:`Ptr`
 description for details.
 
 .. _AutomaticAllocation:
index 7b2c940..d3b80a0 100644 (file)
@@ -3002,55 +3002,55 @@ static inline void read(const FileNode& node, string& value, const string& defau
 }
 
 template<typename _Tp> static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value)
-{  
+{
     vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
     value = temp.size() != 2 ? default_value : Point_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
 }
 
 template<typename _Tp> static inline void read(const FileNode& node, Point3_<_Tp>& value, const Point3_<_Tp>& default_value)
-{  
+{
     vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
     value = temp.size() != 3 ? default_value : Point3_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
                                                             saturate_cast<_Tp>(temp[2]));
 }
 
 template<typename _Tp> static inline void read(const FileNode& node, Size_<_Tp>& value, const Size_<_Tp>& default_value)
-{  
+{
     vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
     value = temp.size() != 2 ? default_value : Size_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
 }
 
 template<typename _Tp> static inline void read(const FileNode& node, Complex<_Tp>& value, const Complex<_Tp>& default_value)
-{  
+{
     vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
     value = temp.size() != 2 ? default_value : Complex<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
 }
 
 template<typename _Tp> static inline void read(const FileNode& node, Rect_<_Tp>& value, const Rect_<_Tp>& default_value)
-{  
+{
     vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
-    value = temp.size() != 4 ? default_value : Rect_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]), 
+    value = temp.size() != 4 ? default_value : Rect_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
                                                           saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
 }
 
 template<typename _Tp, int cn> static inline void read(const FileNode& node, Vec<_Tp, cn>& value, const Vec<_Tp, cn>& default_value)
-{  
+{
     vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
     value = temp.size() != cn ? default_value : Vec<_Tp, cn>(&temp[0]);
 }
 
 template<typename _Tp> static inline void read(const FileNode& node, Scalar_<_Tp>& value, const Scalar_<_Tp>& default_value)
-{  
+{
     vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
     value = temp.size() != 4 ? default_value : Scalar_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
                                                             saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
 }
 
 static inline void read(const FileNode& node, Range& value, const Range& default_value)
-{  
-    Point2i temp(value.start, value.end); const Point2i default_temp = Point2i(default_value.start, default_value.end); 
+{
+    Point2i temp(value.start, value.end); const Point2i default_temp = Point2i(default_value.start, default_value.end);
     read(node, temp, default_temp);
-    value.start = temp.x; value.end = temp.y; 
+    value.start = temp.x; value.end = temp.y;
 }
 
 CV_EXPORTS_W void read(const FileNode& node, Mat& mat, const Mat& default_mat=Mat() );
index 9939040..0db4c62 100644 (file)
@@ -1252,14 +1252,14 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
     Mat src1 = _src1.getMat(), src2 = _src2.getMat();
     bool haveMask = !_mask.empty();
     bool reallocate = false;
-    
-    bool src1Scalar = checkScalar(src1, src2.type(), kind1, kind2); 
-    bool src2Scalar = checkScalar(src2, src1.type(), kind2, kind1); 
+
+    bool src1Scalar = checkScalar(src1, src2.type(), kind1, kind2);
+    bool src2Scalar = checkScalar(src2, src1.type(), kind2, kind1);
 
     if( (kind1 == kind2 || src1.channels() == 1) && src1.dims <= 2 && src2.dims <= 2 &&
         src1.size() == src2.size() && src1.type() == src2.type() &&
         !haveMask && ((!_dst.fixedType() && (dtype < 0 || CV_MAT_DEPTH(dtype) == src1.depth())) ||
-                       (_dst.fixedType() && _dst.type() == _src1.type())) && 
+                       (_dst.fixedType() && _dst.type() == _src1.type())) &&
         ((src1Scalar && src2Scalar) || (!src1Scalar && !src2Scalar)) )
     {
         _dst.create(src1.size(), src1.type());
index 1509c92..d8ce658 100644 (file)
@@ -453,7 +453,7 @@ cv::Scalar cv::sum( InputArray _src )
 {
     Mat src = _src.getMat();
     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);
@@ -462,7 +462,7 @@ cv::Scalar cv::sum( InputArray _src )
                IppiSize sz = { cols, rows };
                int type = src.type();
                typedef IppStatus (CV_STDCALL* ippiSumFunc)(const void*, int, IppiSize, double *, int);
-               ippiSumFunc ippFunc = 
+               ippiSumFunc ippFunc =
                        type == CV_8UC1 ? (ippiSumFunc)ippiSum_8u_C1R :
                        type == CV_8UC3 ? (ippiSumFunc)ippiSum_8u_C3R :
                        type == CV_8UC4 ? (ippiSumFunc)ippiSum_8u_C4R :
@@ -490,8 +490,8 @@ cv::Scalar cv::sum( InputArray _src )
                        }
                }
        }
-#endif 
-       
+#endif
+
     SumFunc func = getSumFunc(depth);
 
     CV_Assert( cn <= 4 && func != 0 );
@@ -565,7 +565,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
     CV_Assert( mask.empty() || mask.type() == CV_8U );
 
     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);
@@ -576,7 +576,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
                if( !mask.empty() )
                {
                        typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC1)(const void *, int, void *, int, IppiSize, Ipp64f *);
-                       ippiMaskMeanFuncC1 ippFuncC1 = 
+                       ippiMaskMeanFuncC1 ippFuncC1 =
                        type == CV_8UC1 ? (ippiMaskMeanFuncC1)ippiMean_8u_C1MR :
                        type == CV_16UC1 ? (ippiMaskMeanFuncC1)ippiMean_16u_C1MR :
                        type == CV_32FC1 ? (ippiMaskMeanFuncC1)ippiMean_32f_C1MR :
@@ -590,7 +590,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
                                }
                        }
                        typedef IppStatus (CV_STDCALL* ippiMaskMeanFuncC3)(const void *, int, void *, int, IppiSize, int, Ipp64f *);
-                       ippiMaskMeanFuncC3 ippFuncC3 = 
+                       ippiMaskMeanFuncC3 ippFuncC3 =
                        type == CV_8UC3 ? (ippiMaskMeanFuncC3)ippiMean_8u_C3CMR :
                        type == CV_16UC3 ? (ippiMaskMeanFuncC3)ippiMean_16u_C3CMR :
                        type == CV_32FC3 ? (ippiMaskMeanFuncC3)ippiMean_32f_C3CMR :
@@ -609,7 +609,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
                else
                {
                        typedef IppStatus (CV_STDCALL* ippiMeanFunc)(const void*, int, IppiSize, double *, int);
-                       ippiMeanFunc ippFunc = 
+                       ippiMeanFunc ippFunc =
                                type == CV_8UC1 ? (ippiMeanFunc)ippiMean_8u_C1R :
                                type == CV_8UC3 ? (ippiMeanFunc)ippiMean_8u_C3R :
                                type == CV_8UC4 ? (ippiMeanFunc)ippiMean_8u_C4R :
@@ -639,7 +639,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
                }
        }
 #endif
-       
+
     SumFunc func = getSumFunc(depth);
 
     CV_Assert( cn <= 4 && func != 0 );
index 58c8817..09a45fd 100644 (file)
@@ -405,7 +405,7 @@ protected:
             Vec<int, 5> v1(15, 16, 17, 18, 19), ov1;
             Scalar sc1(20.0, 21.1, 22.2, 23.3), osc1;
             Range g1(7, 8), og1;
-            
+
             FileStorage fs(fname, FileStorage::WRITE);
             fs << "mi" << mi;
             fs << "mv" << mv;
index c3d88bd..cc91a6b 100644 (file)
@@ -2457,7 +2457,7 @@ TEST(Core_Invert, small)
 {
     cv::Mat a = (cv::Mat_<float>(3,3) << 2.42104644730331, 1.81444796521479, -3.98072565304758, 0, 7.08389214348967e-3, 5.55326770986007e-3, 0,0, 7.44556154284261e-3);
     //cv::randu(a, -1, 1);
-    
+
     cv::Mat b = a.t()*a;
     cv::Mat c, i = Mat_<float>::eye(3, 3);
     cv::invert(b, c, cv::DECOMP_LU); //std::cout << b*c << std::endl;
index cf10460..4361c30 100644 (file)
@@ -40,7 +40,7 @@ Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. ::
 
 BOWTrainer::add
 -------------------
-Adds descriptors to a training set. 
+Adds descriptors to a training set.
 
 .. ocv:function:: void BOWTrainer::add( const Mat& descriptors )
 
@@ -66,7 +66,7 @@ Returns the count of all descriptors stored in the training set.
 
 BOWTrainer::cluster
 -----------------------
-Clusters train descriptors. 
+Clusters train descriptors.
 
 .. ocv:function:: Mat BOWTrainer::cluster() const
 
@@ -116,7 +116,7 @@ Class to compute an image descriptor using the *bag of visual words*. Such a com
     #. Compute descriptors for a given image and its keypoints set.
     #. Find the nearest visual words from the vocabulary for each keypoint descriptor.
     #. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words encountered in the image. The ``i``-th bin of the histogram is a frequency of ``i``-th word of the vocabulary in the given image.
-    
+
 The class declaration is the following: ::
 
         class BOWImgDescriptorExtractor
index 898c634..83d9df7 100644 (file)
@@ -178,10 +178,10 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, vector<KeyPoint>& key
 
     // Normalize image descriptor.
     imgDescriptor /= descriptors.rows;
-       
+
     // Add the descriptors of image keypoints
     if (_descriptors) {
-        *_descriptors = descriptors.clone(); 
+        *_descriptors = descriptors.clone();
     }
 }
 
index 1724b01..44151c0 100644 (file)
@@ -258,7 +258,7 @@ struct IntersectAreaCounter
     {
         CV_Assert( miny < maxy );
         CV_Assert( dr > FLT_EPSILON );
-        
+
         int temp_bua = bua, temp_bna = bna;
         for( int i = range.begin(); i != range.end(); i++ )
         {
index ee44b30..07b0b2a 100644 (file)
@@ -68,11 +68,11 @@ The method constructs a fast search structure from a set of features using the s
 
            * **branching**  The branching factor to use for the hierarchical k-means tree
 
-           * **iterations**  The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence 
+           * **iterations**  The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence
 
-           * **centers_init** The algorithm to use for selecting the initial centers when performing a k-means clustering step. The possible values are  ``CENTERS_RANDOM``  (picks the initial cluster centers randomly),  ``CENTERS_GONZALES``  (picks the initial centers using Gonzales' algorithm) and  ``CENTERS_KMEANSPP``  (picks the initial centers using the algorithm suggested in  arthur_kmeanspp_2007 ) 
+           * **centers_init** The algorithm to use for selecting the initial centers when performing a k-means clustering step. The possible values are  ``CENTERS_RANDOM``  (picks the initial cluster centers randomly),  ``CENTERS_GONZALES``  (picks the initial centers using Gonzales' algorithm) and  ``CENTERS_KMEANSPP``  (picks the initial centers using the algorithm suggested in  arthur_kmeanspp_2007 )
 
-           * **cb_index** This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When  ``cb_index``  is zero the next kmeans domain to be explored is chosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. 
+           * **cb_index** This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When  ``cb_index``  is zero the next kmeans domain to be explored is chosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain.
 
     *
        **CompositeIndexParams** When using a parameters object of this type the index created combines the randomized kd-trees  and the hierarchical k-means tree. ::
@@ -122,16 +122,16 @@ The method constructs a fast search structure from a set of features using the s
 
        ..
 
-           * **target_precision**  Is a number between 0 and 1 specifying the percentage of the approximate nearest-neighbor searches that return the exact nearest-neighbor. Using a higher value for this parameter gives more accurate results, but the search takes longer. The optimum value usually depends on the application.  
+           * **target_precision**  Is a number between 0 and 1 specifying the percentage of the approximate nearest-neighbor searches that return the exact nearest-neighbor. Using a higher value for this parameter gives more accurate results, but the search takes longer. The optimum value usually depends on the application.
 
 
-           * **build_weight**  Specifies the importance of the index build time raported to the nearest-neighbor search time. In some applications it's acceptable for the index build step to take a long time if the subsequent searches in the index can be performed very fast. In other applications it's required that the index be build as fast as possible even if that leads to slightly longer search times. 
+           * **build_weight**  Specifies the importance of the index build time raported to the nearest-neighbor search time. In some applications it's acceptable for the index build step to take a long time if the subsequent searches in the index can be performed very fast. In other applications it's required that the index be build as fast as possible even if that leads to slightly longer search times.
 
 
            * **memory_weight** Is used to specify the tradeoff between time (index build time and search time) and memory used by the index. A value less than 1 gives more importance to the time spent and a value greater than 1 gives more importance to the memory usage.
 
 
-           * **sample_fraction** Is a number between 0 and 1 indicating what fraction of the dataset to use in the automatic parameter configuration algorithm. Running the algorithm on the full dataset gives the most accurate results, but for very large datasets can take longer than desired. In such case using just a fraction of the data helps speeding up this algorithm while still giving good approximations of the optimum parameters. 
+           * **sample_fraction** Is a number between 0 and 1 indicating what fraction of the dataset to use in the automatic parameter configuration algorithm. Running the algorithm on the full dataset gives the most accurate results, but for very large datasets can take longer than desired. In such case using just a fraction of the data helps speeding up this algorithm while still giving good approximations of the optimum parameters.
 
     *
        **SavedIndexParams** This object type is used for loading a previously saved index from the disk. ::
index 44b5072..8650b3f 100644 (file)
@@ -43,7 +43,7 @@ if(HAVE_CUDA)
   ocv_cuda_compile(cuda_objs ${lib_cuda} ${ncv_cuda})
 
   set(cuda_link_libs ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
-  
+
   if(HAVE_CUFFT)
       set(cuda_link_libs ${cuda_link_libs} ${CUDA_cufft_LIBRARY})
   endif()
index d99def2..aafbf74 100644 (file)
@@ -49,7 +49,7 @@ This means that the input left image is low textured.
    * A basic stereo matching example can be found at opencv_source_code/samples/gpu/stereo_match.cpp
    * A stereo matching example using several GPU's can be found at opencv_source_code/samples/gpu/stereo_multi.cpp
    * A stereo matching example using several GPU's and driver API can be found at opencv_source_code/samples/gpu/driver_api_stereo_multi.cpp
-   
+
 gpu::StereoBM_GPU::StereoBM_GPU
 -----------------------------------
 Enables :ocv:class:`gpu::StereoBM_GPU` constructors.
index 7b8dde6..ea15a06 100644 (file)
@@ -7,7 +7,7 @@ Video Analysis
 
    * A general optical flow example can be found at opencv_source_code/samples/gpu/optical_flow.cpp
    * A general optical flow example using the Nvidia API can be found at opencv_source_code/samples/gpu/opticalflow_nvidia_api.cpp
-   
+
 gpu::BroxOpticalFlow
 --------------------
 .. ocv:class:: gpu::BroxOpticalFlow
index 811f3da..bc90182 100644 (file)
@@ -20,7 +20,7 @@ Reads an image from a buffer in memory.
     :param buf: Input array or vector of bytes.
 
     :param flags: The same flags as in :ocv:func:`imread` .
-    
+
     :param dst: The optional output placeholder for the decoded matrix. It can save the image reallocations when the function is called repeatedly for images of the same size.
 
 The function reads an image from the specified buffer in the memory.
@@ -74,9 +74,9 @@ Loads an image from a file.
     :param filename: Name of file to be loaded.
 
     :param flags: Flags specifying the color type of a loaded image:
-    
+
         * CV_LOAD_IMAGE_ANYDEPTH - If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
-        
+
         * CV_LOAD_IMAGE_COLOR - If set, always convert image to the color one
 
         * CV_LOAD_IMAGE_GRAYSCALE - If set, always convert image to the grayscale one
index 00f0494..54a8529 100644 (file)
@@ -160,7 +160,7 @@ private:
 };
 
 
-class CvCapture_FFMPEG_proxy : 
+class CvCapture_FFMPEG_proxy :
        public CvCapture
 {
 public:
@@ -224,7 +224,7 @@ CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename)
     return 0;
 }
 
-class CvVideoWriter_FFMPEG_proxy : 
+class CvVideoWriter_FFMPEG_proxy :
        public CvVideoWriter
 {
 public:
index 21acc54..ee6ba84 100644 (file)
@@ -345,7 +345,7 @@ class ImplMutex
 public:
        ImplMutex() { init(); }
        ~ImplMutex() { destroy(); }
-       
+
     void init();
     void destroy();
 
@@ -450,7 +450,7 @@ void ImplMutex::init()
        impl = (Impl*)malloc(sizeof(Impl));
        impl->init();
 }
-void ImplMutex::destroy() 
+void ImplMutex::destroy()
 {
        impl->destroy();
        free(impl);
index ac85f79..f4d30a7 100644 (file)
@@ -388,7 +388,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
 
 - (CVPixelBufferRef) pixelBufferFromCGImage: (CGImageRef) image
 {
-    
+
     CGSize frameSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image));
     NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                              [NSNumber numberWithBool:NO], kCVPixelBufferCGImageCompatibilityKey,
@@ -399,23 +399,23 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;};
                                           frameSize.height,  kCVPixelFormatType_32ARGB, (CFDictionaryRef) CFBridgingRetain(options),
                                           &pxbuffer);
     NSParameterAssert(status == kCVReturnSuccess && pxbuffer != NULL);
-    
+
     CVPixelBufferLockBaseAddress(pxbuffer, 0);
     void *pxdata = CVPixelBufferGetBaseAddress(pxbuffer);
-    
-    
+
+
     CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
     CGContextRef context = CGBitmapContextCreate(pxdata, frameSize.width,
                                                  frameSize.height, 8, 4*frameSize.width, rgbColorSpace,
                                                  kCGImageAlphaPremultipliedFirst);
-    
+
     CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image),
                                            CGImageGetHeight(image)), image);
     CGColorSpaceRelease(rgbColorSpace);
     CGContextRelease(context);
-    
+
     CVPixelBufferUnlockBaseAddress(pxbuffer, 0);
-    
+
     return pxbuffer;
 }
 
index 6027cae..3fd6dd5 100644 (file)
@@ -14,7 +14,7 @@ It has been tested with the motempl sample program
 First Patch:  August 24, 2004 Travis Wood   TravisOCV@tkwood.com
 For Release:  OpenCV-Linux Beta4  opencv-0.9.6
 Tested On:    LMLBT44 with 8 video inputs
-Problems?     Post your questions at answers.opencv.org, 
+Problems?     Post your questions at answers.opencv.org,
               Report bugs at code.opencv.org,
               Submit your fixes at https://github.com/Itseez/opencv/
 Patched Comments:
index 76b9a21..9daad64 100644 (file)
@@ -3026,7 +3026,7 @@ double CvCaptureFile_MSMF::getProperty(int property_id)
         return ((double)captureFormats[captureFormatIndex].MF_MT_FRAME_RATE_NUMERATOR) /
             ((double)captureFormats[captureFormatIndex].MF_MT_FRAME_RATE_DENOMINATOR);
     }
+
     return -1;
 }
 
@@ -3062,7 +3062,7 @@ IplImage* CvCaptureFile_MSMF::retrieveFrame(int)
 
     if(RIOut && size == RIOut->getSize())
     {
-         videoInput::processPixels(RIOut->getpPixels(), (unsigned char*)frame->imageData, width, 
+         videoInput::processPixels(RIOut->getpPixels(), (unsigned char*)frame->imageData, width,
              height, bytes, false, verticalFlip);
     }
 
index 258d637..275deae 100644 (file)
@@ -413,9 +413,9 @@ int CvCaptureCAM::startCaptureDevice(int cameraNum) {
 
 void CvCaptureCAM::setWidthHeight() {
     NSAutoreleasePool* localpool = [[NSAutoreleasePool alloc] init];
-       
+
     [mCaptureSession stopRunning];
-       
+
     NSDictionary* pixelBufferOptions = [NSDictionary dictionaryWithObjectsAndKeys:
                           [NSNumber numberWithDouble:1.0*width], (id)kCVPixelBufferWidthKey,
                           [NSNumber numberWithDouble:1.0*height], (id)kCVPixelBufferHeightKey,
@@ -424,9 +424,9 @@ void CvCaptureCAM::setWidthHeight() {
                           nil];
 
     [mCaptureDecompressedVideoOutput setPixelBufferAttributes:pixelBufferOptions];
-       
+
     [mCaptureSession startRunning];
-       
+
     grabFrame(60);
     [localpool drain];
 }
index 23497a5..045c6f8 100644 (file)
@@ -14,7 +14,7 @@ It has been tested with the motempl sample program
 First Patch:  August 24, 2004 Travis Wood   TravisOCV@tkwood.com
 For Release:  OpenCV-Linux Beta4  opencv-0.9.6
 Tested On:    LMLBT44 with 8 video inputs
-Problems?     Post your questions at answers.opencv.org, 
+Problems?     Post your questions at answers.opencv.org,
               Report bugs at code.opencv.org,
               Submit your fixes at https://github.com/Itseez/opencv/
 Patched Comments:
@@ -157,7 +157,7 @@ the symptoms were damaged image and 'Corrupt JPEG data: premature end of data se
   prevents bad images in the first place
 
 11th patch: April 2, 2013, Forrest Reiling forrest.reiling@gmail.com
-Added v4l2 support for getting capture property CV_CAP_PROP_POS_MSEC. 
+Added v4l2 support for getting capture property CV_CAP_PROP_POS_MSEC.
 Returns the millisecond timestamp of the last frame grabbed or 0 if no frames have been grabbed
 Used to successfully synchonize 2 Logitech C310 USB webcams to within 16 ms of one another
 
@@ -1233,8 +1233,8 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
    if (-1 == ioctl (capture->deviceHandle, VIDIOC_QBUF, &buf))
        perror ("VIDIOC_QBUF");
 
-   //set timestamp in capture struct to be timestamp of most recent frame 
-   capture->timestamp = buf.timestamp; 
+   //set timestamp in capture struct to be timestamp of most recent frame
+   capture->timestamp = buf.timestamp;
 
    return 1;
 }
@@ -2327,7 +2327,7 @@ static double icvGetPropertyCAM_V4L (CvCaptureCAM_V4L* capture,
           if (capture->FirstCapture) {
             return 0;
           } else {
-            return 1000 * capture->timestamp.tv_sec + ((double) capture->timestamp.tv_usec) / 1000; 
+            return 1000 * capture->timestamp.tv_sec + ((double) capture->timestamp.tv_usec) / 1000;
           }
           break;
       case CV_CAP_PROP_BRIGHTNESS:
index 98279e0..7292727 100644 (file)
@@ -138,7 +138,7 @@ void CvCaptureCAM_XIMEA::close()
 {
     if(frame)
         cvReleaseImage(&frame);
-    
+
     if(hmv)
     {
         xiStopAcquisition(hmv);
@@ -176,11 +176,11 @@ IplImage* CvCaptureCAM_XIMEA::retrieveFrame(int)
 {
     // update cvImage after format has changed
     resetCvImage();
-    
+
     // copy pixel data
     switch( image.frm)
     {
-    case XI_MONO8       : 
+    case XI_MONO8       :
     case XI_RAW8        : memcpy( frame->imageData, image.bp, image.width*image.height); break;
     case XI_MONO16      :
     case XI_RAW16       : memcpy( frame->imageData, image.bp, image.width*image.height*sizeof(WORD)); break;
@@ -210,15 +210,15 @@ void CvCaptureCAM_XIMEA::resetCvImage()
         {
         case XI_MONO8       :
         case XI_RAW8        : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 1); break;
-        case XI_MONO16      : 
+        case XI_MONO16      :
         case XI_RAW16       : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_16U, 1); break;
-        case XI_RGB24       : 
+        case XI_RGB24       :
         case XI_RGB_PLANAR  : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 3); break;
         case XI_RGB32       : frame = cvCreateImage(cvSize( image.width, image.height), IPL_DEPTH_8U, 4); break;
         default :
             return;
         }
-    }  
+    }
     cvZero(frame);
 }
 /**********************************************************************************/
@@ -338,9 +338,9 @@ int  CvCaptureCAM_XIMEA::getBpp()
     {
     case XI_MONO8       :
     case XI_RAW8        : return 1;
-    case XI_MONO16      : 
+    case XI_MONO16      :
     case XI_RAW16       : return 2;
-    case XI_RGB24       : 
+    case XI_RGB24       :
     case XI_RGB_PLANAR  : return 3;
     case XI_RGB32       : return 4;
     default :
@@ -348,4 +348,4 @@ int  CvCaptureCAM_XIMEA::getBpp()
     }
 }
 
-/**********************************************************************************/
\ No newline at end of file
+/**********************************************************************************/
index a257e5a..df2a2e8 100644 (file)
@@ -16,4 +16,4 @@ The license does not permit the following uses:
 
 You may not use, or allow anyone else to use the icons to create pornographic, libelous, obscene, or defamatory material.
 
-All icon files are provided "as is". You agree not to hold IconEden.com liable for any damages that may occur due to use, or inability to use, icons or image data from IconEden.com. 
\ No newline at end of file
+All icon files are provided "as is". You agree not to hold IconEden.com liable for any damages that may occur due to use, or inability to use, icons or image data from IconEden.com.
\ No newline at end of file
index 7295743..4300acd 100644 (file)
 #include "precomp.hpp"
 
 UIImage* MatToUIImage(const cv::Mat& image) {
-    
+
     NSData *data = [NSData dataWithBytes:image.data
                                   length:image.elemSize()*image.total()];
-    
+
     CGColorSpaceRef colorSpace;
-    
+
     if (image.elemSize() == 1) {
         colorSpace = CGColorSpaceCreateDeviceGray();
     } else {
         colorSpace = CGColorSpaceCreateDeviceRGB();
     }
-    
+
     CGDataProviderRef provider =
             CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
-    
+
     // Creating CGImage from cv::Mat
     CGImageRef imageRef = CGImageCreate(image.cols,
                                         image.rows,
@@ -73,14 +73,14 @@ UIImage* MatToUIImage(const cv::Mat& image) {
                                         false,
                                         kCGRenderingIntentDefault
                                         );
-    
-    
+
+
     // Getting UIImage from CGImage
     UIImage *finalImage = [UIImage imageWithCGImage:imageRef];
     CGImageRelease(imageRef);
     CGDataProviderRelease(provider);
     CGColorSpaceRelease(colorSpace);
-    
+
     return finalImage;
 }
 
index 64d57ab..eb9cfe3 100644 (file)
@@ -2474,7 +2474,7 @@ void DefaultViewPort::saveView()
     if (!fileName.isEmpty()) //save the picture
     {
         QString extension = fileName.right(3);
-        
+
         // Create a new pixmap to render the viewport into
         QPixmap viewportPixmap(viewport()->size());
         viewport()->render(&viewportPixmap);
index bf6c98f..e36ce2d 100644 (file)
@@ -179,7 +179,7 @@ Compares two histograms.
             * **CV_COMP_INTERSECT**     Intersection
 
             * **CV_COMP_BHATTACHARYYA**     Bhattacharyya distance
-            
+
             * **CV_COMP_HELLINGER**     Synonym for ``CV_COMP_BHATTACHARYYA``
 
 The functions ``compareHist`` compare two dense or two sparse histograms using the specified method:
index ba25af9..4aba0a8 100644 (file)
@@ -309,7 +309,7 @@ enum
     // alpha premultiplication
     CV_RGBA2mRGBA = 125,
     CV_mRGBA2RGBA = 126,
-    
+
     CV_RGB2YUV_I420 = 127,
     CV_BGR2YUV_I420 = 128,
     CV_RGB2YUV_IYUV = CV_RGB2YUV_I420,
index fed7b73..2e130e0 100644 (file)
@@ -3896,7 +3896,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
                     CV_Error( CV_StsBadArg, "Unsupported image depth" );
                 }
             }
-            break;   
+            break;
         default:
             CV_Error( CV_StsBadFlag, "Unknown/unsupported color conversion code" );
     }
index fb901b7..40be8cd 100644 (file)
@@ -1149,11 +1149,11 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
        }
        //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 : 
+       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;
@@ -1163,25 +1163,25 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
        {
        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 :  
+                       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 :  
+                       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;
                }
@@ -1207,8 +1207,8 @@ static bool IPPMorphOp(int op, InputArray _src, OutputArray _dst,
        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()) ) 
+       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 )
index 61bc9bd..bd8d95d 100644 (file)
@@ -349,7 +349,7 @@ public:
         int r = rgb[0];
         int g = rgb[1];
         int b = rgb[2];
-        
+
         uchar y = saturate_cast<uchar>((int)( 0.257f*r + 0.504f*g + 0.098f*b + 0.5f) + 16);
         uchar u = saturate_cast<uchar>((int)(-0.148f*r - 0.291f*g + 0.439f*b + 0.5f) + 128);
         uchar v = saturate_cast<uchar>((int)( 0.439f*r - 0.368f*g - 0.071f*b + 0.5f) + 128);
index b651b4d..fb546ed 100644 (file)
@@ -11,10 +11,10 @@ using namespace cv;
 static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) {
   std::string what = "unknown exception";
   jclass je = 0;
-  
+
   if(e) {
     std::string exception_type = "std::exception";
-    
+
     if(dynamic_cast<const cv::Exception*>(e)) {
       exception_type = "cv::Exception";
       je = env->FindClass("org/opencv/core/CvException");
@@ -22,16 +22,16 @@ static void throwJavaException(JNIEnv *env, const std::exception *e, const char
 
     what = exception_type + ": " + e->what();
   }
-  
+
   if(!je) je = env->FindClass("java/lang/Exception");
   env->ThrowNew(je, what.c_str());
-  
+
   LOGE("%s caught %s", method, what.c_str());
   (void)method;        // avoid "unused" warning
 }
 
 extern "C" {
-  
+
 
 //
 //   MatXXX::MatXXX()
@@ -69,7 +69,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -95,7 +95,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -122,7 +122,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -149,7 +149,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -176,7 +176,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -198,7 +198,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -224,7 +224,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -293,7 +293,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -319,7 +319,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -341,7 +341,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -363,7 +363,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -391,7 +391,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -418,7 +418,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -445,7 +445,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -454,7 +454,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange
 //
 //  int Mat::dims()
 //
-  
+
 JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1dims
   (JNIEnv* env, jclass, jlong self);
 
@@ -471,7 +471,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1dims
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -497,7 +497,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -690,7 +690,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -733,7 +733,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -760,7 +760,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -787,7 +787,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -814,7 +814,7 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -840,7 +840,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -866,7 +866,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -892,7 +892,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -918,7 +918,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -945,7 +945,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -972,7 +972,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -994,7 +994,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -1020,7 +1020,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -1046,7 +1046,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -1101,7 +1101,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -1253,7 +1253,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -1276,7 +1276,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -1303,7 +1303,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row
     } catch (...) {
         throwJavaException(env, 0, method_name);
     }
-    
+
     return 0;
 }
 
@@ -1487,7 +1487,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size
         LOGD("%s", method_name);
         Mat* me = (Mat*) self; //TODO: check for NULL
         Size _retval_ = me->size(  );
-        jdoubleArray _da_retval_ = env->NewDoubleArray(2);  
+        jdoubleArray _da_retval_ = env->NewDoubleArray(2);
         jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height};
         env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_);
         return _da_retval_;
index 4bace30..93d0d82 100644 (file)
@@ -67,7 +67,7 @@ The following loss functions are implemented for regression problems:
     :math:`L(y,f(x)) = \left\{ \begin{array}{lr}
     \delta\cdot\left(|y-f(x)|-\dfrac{\delta}{2}\right) & : |y-f(x)|>\delta\\
     \dfrac{1}{2}\cdot(y-f(x))^2 & : |y-f(x)|\leq\delta \end{array} \right.`,
-    
+
     where :math:`\delta` is the :math:`\alpha`-quantile estimation of the
     :math:`|y-f(x)|`. In the current implementation :math:`\alpha=0.2`.
 
@@ -129,9 +129,9 @@ CvGBTreesParams::CvGBTreesParams
    :param weak_count: Count of boosting algorithm iterations. ``weak_count*K`` is the total
     count of trees in the GBT model, where ``K`` is the output classes count
     (equal to one in case of a regression).
-  
+
    :param shrinkage: Regularization parameter (see :ref:`Training GBT`).
-    
+
    :param subsample_portion: Portion of the whole training set used for each algorithm iteration.
     Subset is generated randomly. For more information see
     http://www.salfordsystems.com/doc/StochasticBoostingSS.pdf.
@@ -139,7 +139,7 @@ CvGBTreesParams::CvGBTreesParams
    :param max_depth: Maximal depth of each decision tree in the ensemble (see :ocv:class:`CvDTree`).
 
    :param use_surrogates: If ``true``, surrogate splits are built (see :ocv:class:`CvDTree`).
-    
+
 By default the following constructor is used:
 
 .. code-block:: cpp
@@ -178,7 +178,7 @@ Trains a Gradient boosted tree model.
 .. ocv:function:: bool CvGBTrees::train(CvMLData* data, CvGBTreesParams params=CvGBTreesParams(), bool update=false)
 
 .. ocv:pyfunction:: cv2.GBTrees.train(trainData, tflag, responses[, varIdx[, sampleIdx[, varType[, missingDataMask[, params[, update]]]]]]) -> retval
-    
+
 The first train method follows the common template (see :ocv:func:`CvStatModel::train`).
 Both ``tflag`` values (``CV_ROW_SAMPLE``, ``CV_COL_SAMPLE``) are supported.
 ``trainData`` must be of the ``CV_32F`` type. ``responses`` must be a matrix of type
@@ -188,7 +188,7 @@ list of indices (``CV_32S``) or a mask (``CV_8U`` or ``CV_8S``). ``update`` is
 a dummy parameter.
 
 The second form of :ocv:func:`CvGBTrees::train` function uses :ocv:class:`CvMLData` as a
-data set container. ``update`` is still a dummy parameter. 
+data set container. ``update`` is still a dummy parameter.
 
 All parameters specific to the GBT model are passed into the training function
 as a :ocv:class:`CvGBTreesParams` structure.
@@ -207,42 +207,42 @@ Predicts a response for an input sample.
    :param sample: Input feature vector that has the same format as every training set
     element. If not all the variables were actually used during training,
     ``sample`` contains forged values at the appropriate places.
-    
+
    :param missing: Missing values mask, which is a dimensional matrix of the same size as
     ``sample`` having the ``CV_8U`` type. ``1`` corresponds to the missing value
     in the same position in the ``sample`` vector. If there are no missing values
     in the feature vector, an empty matrix can be passed instead of the missing mask.
-    
+
    :param weakResponses: Matrix used to obtain predictions of all the trees.
     The matrix has :math:`K` rows,
     where :math:`K` is the count of output classes (1 for the regression case).
     The matrix has as many columns as the ``slice`` length.
-    
+
    :param slice: Parameter defining the part of the ensemble used for prediction.
     If ``slice = Range::all()``, all trees are used. Use this parameter to
     get predictions of the GBT models with different ensemble sizes learning
     only one model.
-    
+
    :param k: Number of tree ensembles built in case of the classification problem
     (see :ref:`Training GBT`). Use this
     parameter to change the output to sum of the trees' predictions in the
     ``k``-th ensemble only. To get the total GBT model prediction, ``k`` value
     must be -1. For regression problems, ``k`` is also equal to -1.
+
 The method predicts the response corresponding to the given sample
 (see :ref:`Predicting with GBT`).
 The result is either the class label or the estimated function value. The
 :ocv:func:`CvGBTrees::predict` method enables using the parallel version of the GBT model
 prediction if the OpenCV is built with the TBB library. In this case, predictions
-of single trees are computed in a parallel fashion. 
+of single trees are computed in a parallel fashion.
+
 
-    
 CvGBTrees::clear
 ----------------
 Clears the model.
 
 .. ocv:function:: void CvGBTrees::clear()
-    
+
 .. ocv:pyfunction:: cv2.GBTrees.clear() -> None
 
 The function deletes the data set information and all the weak models and sets all internal
@@ -257,7 +257,7 @@ Calculates a training or testing error.
 .. ocv:function:: float CvGBTrees::calc_error( CvMLData* _data, int type, std::vector<float> *resp = 0 )
 
    :param _data: Data set.
-    
+
    :param type: Parameter defining the error that should be computed: train (``CV_TRAIN_ERROR``) or test
     (``CV_TEST_ERROR``).
 
index 6692417..171be3d 100644 (file)
@@ -45,7 +45,7 @@ Trains the model.
 
     :param updateBase: Specifies whether the model is trained from scratch (``update_base=false``), or it is updated using the new training data (``update_base=true``). In the latter case, the parameter ``maxK`` must not be larger than the original value.
 
-The method trains the K-Nearest model. It follows the conventions of the generic :ocv:func:`CvStatModel::train` approach with the following limitations: 
+The method trains the K-Nearest model. It follows the conventions of the generic :ocv:func:`CvStatModel::train` approach with the following limitations:
 
 * Only ``CV_ROW_SAMPLE`` data layout is supported.
 * Input variables are all ordered.
index 9b5e805..7981529 100644 (file)
@@ -9,7 +9,7 @@ CvMLData
 --------
 .. ocv:class:: CvMLData
 
-Class for loading the data from a ``.csv`` file. 
+Class for loading the data from a ``.csv`` file.
 ::
 
     class CV_EXPORTS CvMLData
@@ -27,42 +27,42 @@ Class for loading the data from a ``.csv`` file.
         void set_response_idx( int idx );
         int get_response_idx() const;
 
-        
+
         void set_train_test_split( const CvTrainTestSplit * spl);
         const CvMat* get_train_sample_idx() const;
         const CvMat* get_test_sample_idx() const;
         void mix_train_and_test_idx();
-        
+
         const CvMat* get_var_idx();
         void change_var_idx( int vi, bool state );
 
         const CvMat* get_var_types();
         void set_var_types( const char* str );
-        
+
         int get_var_type( int var_idx ) const;
         void change_var_type( int var_idx, int type);
-     
+
         void set_delimiter( char ch );
         char get_delimiter() const;
 
         void set_miss_ch( char ch );
         char get_miss_ch() const;
-        
+
         const std::map<std::string, int>& get_class_labels_map() const;
-        
-    protected: 
-        ... 
+
+    protected:
+        ...
     };
 
 CvMLData::read_csv
 ------------------
-Reads the data set from a ``.csv``-like ``filename`` file and stores all read values in a matrix. 
+Reads the data set from a ``.csv``-like ``filename`` file and stores all read values in a matrix.
 
 .. ocv:function:: int CvMLData::read_csv(const char* filename)
 
     :param filename: The input file name
 
-While reading the data, the method tries to define the type of variables (predictors and responses): ordered or categorical. If a value of the variable is not numerical (except for the label for a missing value), the type of the variable is set to ``CV_VAR_CATEGORICAL``. If all existing values of the variable are numerical, the type of the variable is set to ``CV_VAR_ORDERED``. So, the default definition of variables types works correctly for all cases except the case of a categorical variable with numerical class labels. In this case, the type ``CV_VAR_ORDERED`` is set. You should change the type to ``CV_VAR_CATEGORICAL`` using the method :ocv:func:`CvMLData::change_var_type`. For categorical variables, a common map is built to convert a string class label to the numerical class label. Use :ocv:func:`CvMLData::get_class_labels_map` to obtain this map. 
+While reading the data, the method tries to define the type of variables (predictors and responses): ordered or categorical. If a value of the variable is not numerical (except for the label for a missing value), the type of the variable is set to ``CV_VAR_CATEGORICAL``. If all existing values of the variable are numerical, the type of the variable is set to ``CV_VAR_ORDERED``. So, the default definition of variables types works correctly for all cases except the case of a categorical variable with numerical class labels. In this case, the type ``CV_VAR_ORDERED`` is set. You should change the type to ``CV_VAR_CATEGORICAL`` using the method :ocv:func:`CvMLData::change_var_type`. For categorical variables, a common map is built to convert a string class label to the numerical class label. Use :ocv:func:`CvMLData::get_class_labels_map` to obtain this map.
 
 Also, when reading the data, the method constructs the mask of missing values. For example, values are equal to `'?'`.
 
@@ -72,7 +72,7 @@ Returns a pointer to the matrix of predictors and response values
 
 .. ocv:function:: const CvMat* CvMLData::get_values() const
 
-The method returns a pointer to the matrix of predictor and response ``values``  or ``0`` if the data has not been loaded from the file yet. 
+The method returns a pointer to the matrix of predictor and response ``values``  or ``0`` if the data has not been loaded from the file yet.
 
 The row count of this matrix equals the sample count. The column count equals predictors ``+ 1`` for the response (if exists) count. This means that each row of the matrix contains values of one sample predictor and response. The matrix type is ``CV_32FC1``.
 
@@ -82,7 +82,7 @@ Returns a pointer to the matrix of response values
 
 .. ocv:function:: const CvMat* CvMLData::get_responses()
 
-The method returns a pointer to the matrix of response values or throws an exception if the data has not been loaded from the file yet. 
+The method returns a pointer to the matrix of response values or throws an exception if the data has not been loaded from the file yet.
 
 This is a single-column matrix of the type ``CV_32FC1``. Its row count is equal to the sample count, one column and .
 
@@ -92,7 +92,7 @@ Returns a pointer to the mask matrix of missing values
 
 .. ocv:function:: const CvMat* CvMLData::get_missing() const
 
-The method returns a pointer to the mask matrix of missing values or throws an exception if the data has not been loaded from the file yet. 
+The method returns a pointer to the mask matrix of missing values or throws an exception if the data has not been loaded from the file yet.
 
 This matrix has the same size as the  ``values`` matrix (see :ocv:func:`CvMLData::get_values`) and the type ``CV_8UC1``.
 
@@ -102,7 +102,7 @@ Specifies index of response column in the data matrix
 
 .. ocv:function:: void CvMLData::set_response_idx( int idx )
 
-The method sets the index of a response column in the ``values`` matrix (see :ocv:func:`CvMLData::get_values`) or throws an exception if the data has not been loaded from the file yet. 
+The method sets the index of a response column in the ``values`` matrix (see :ocv:func:`CvMLData::get_values`) or throws an exception if the data has not been loaded from the file yet.
 
 The old response columns become predictors. If ``idx < 0``, there is no response.
 
@@ -115,15 +115,15 @@ Returns index of the response column in the loaded data matrix
 The method returns the index of a response column in the ``values`` matrix (see :ocv:func:`CvMLData::get_values`) or throws an exception if the data has not been loaded from the file yet.
 
 If ``idx < 0``, there is no response.
-    
+
 
 CvMLData::set_train_test_split
 ------------------------------
-Divides the read data set into two disjoint training and test subsets. 
+Divides the read data set into two disjoint training and test subsets.
 
 .. ocv:function:: void CvMLData::set_train_test_split( const CvTrainTestSplit * spl )
 
-This method sets parameters for such a split using ``spl`` (see :ocv:class:`CvTrainTestSplit`) or throws an exception if the data has not been loaded from the file yet. 
+This method sets parameters for such a split using ``spl`` (see :ocv:class:`CvTrainTestSplit`) or throws an exception if the data has not been loaded from the file yet.
 
 CvMLData::get_train_sample_idx
 ------------------------------
@@ -139,13 +139,13 @@ Returns the matrix of sample indices for a testing subset
 
 .. ocv:function:: const CvMat* CvMLData::get_test_sample_idx() const
 
-    
+
 CvMLData::mix_train_and_test_idx
 --------------------------------
 Mixes the indices of training and test samples
 
 .. ocv:function:: void CvMLData::mix_train_and_test_idx()
-    
+
 The method shuffles the indices of training and test samples preserving sizes of training and test subsets if the data split is set by :ocv:func:`CvMLData::get_values`. If the data has not been loaded from the file yet, an exception is thrown.
 
 CvMLData::get_var_idx
@@ -153,8 +153,8 @@ CvMLData::get_var_idx
 Returns the indices of the active variables in the data matrix
 
 .. ocv:function:: const CvMat* CvMLData::get_var_idx()
-    
-The method returns the indices of variables (columns) used in the ``values`` matrix (see :ocv:func:`CvMLData::get_values`). 
+
+The method returns the indices of variables (columns) used in the ``values`` matrix (see :ocv:func:`CvMLData::get_values`).
 
 It returns ``0`` if the used subset is not set. It throws an exception if the data has not been loaded from the file yet. Returned matrix is a single-row matrix of the type ``CV_32SC1``. Its column count is equal to the size of the used variable subset.
 
@@ -165,22 +165,22 @@ Enables or disables particular variable in the loaded data
 .. ocv:function:: void CvMLData::change_var_idx( int vi, bool state )
 
 By default, after reading the data set all variables in the ``values`` matrix (see :ocv:func:`CvMLData::get_values`) are used. But you may want to use only a subset of variables and include/exclude (depending on ``state`` value) a variable with the ``vi`` index from the used subset. If the data has not been loaded from the file yet, an exception is thrown.
-    
+
 CvMLData::get_var_types
 -----------------------
-Returns a matrix of the variable types. 
+Returns a matrix of the variable types.
 
 .. ocv:function:: const CvMat* CvMLData::get_var_types()
-    
+
 The function returns a single-row matrix of the type ``CV_8UC1``, where each element is set to either ``CV_VAR_ORDERED`` or ``CV_VAR_CATEGORICAL``. The number of columns is equal to the number of variables. If data has not been loaded from file yet an exception is thrown.
-    
+
 CvMLData::set_var_types
 -----------------------
 Sets the variables types in the loaded data.
 
 .. ocv:function:: void CvMLData::set_var_types( const char* str )
 
-In the string, a variable type is followed by a list of variables indices. For example: ``"ord[0-17],cat[18]"``, ``"ord[0,2,4,10-12], cat[1,3,5-9,13,14]"``, ``"cat"`` (all variables are categorical), ``"ord"`` (all variables are ordered). 
+In the string, a variable type is followed by a list of variables indices. For example: ``"ord[0-17],cat[18]"``, ``"ord[0,2,4,10-12], cat[1,3,5-9,13,14]"``, ``"cat"`` (all variables are categorical), ``"ord"`` (all variables are ordered).
 
 CvMLData::get_var_type
 ----------------------
@@ -189,15 +189,15 @@ Returns type of the specified variable
 .. ocv:function:: int CvMLData::get_var_type( int var_idx ) const
 
 The method returns the type of a variable by the index ``var_idx`` ( ``CV_VAR_ORDERED`` or ``CV_VAR_CATEGORICAL``).
-    
+
 CvMLData::change_var_type
 -------------------------
 Changes type of the specified variable
 
 .. ocv:function:: void CvMLData::change_var_type( int var_idx, int type)
-    
+
 The method changes type of variable with index ``var_idx`` from existing type to ``type`` ( ``CV_VAR_ORDERED`` or ``CV_VAR_CATEGORICAL``).
-     
+
 CvMLData::set_delimiter
 -----------------------
 Sets the delimiter in the file used to separate input numbers
@@ -260,6 +260,6 @@ Structure setting the split of a data set read by :ocv:class:`CvMLData`.
 
 There are two ways to construct a split:
 
-* Set the training sample count (subset size) ``train_sample_count``. Other existing samples are located in a test subset. 
+* Set the training sample count (subset size) ``train_sample_count``. Other existing samples are located in a test subset.
 
 * Set a training sample portion in ``[0,..1]``. The flag ``mix`` is used to mix training and test samples indices when the split is set. Otherwise, the data set is split in the storing order: the first part of samples of a given size is a training subset, the second part is a test subset.
index 6b6f5e6..78012ba 100644 (file)
@@ -116,7 +116,7 @@ bool CvKNearest::train( const CvMat* _train_data, const CvMat* _responses,
 
     if( !responses )
         CV_ERROR( CV_StsNoMem, "Could not allocate memory for responses" );
-        
+
     if( _update_base && _dims != var_count )
         CV_ERROR( CV_StsBadArg, "The newly added data have different dimensionality" );
 
index 3dced5e..aace143 100644 (file)
@@ -125,7 +125,7 @@ float icvCalcHaarPatternSum_2(
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx2.x, y + dy1.x), rows, cols, elemPerRow );
     t += read_sumTex( sumTex, sampler, (int2)(x + dx2.x, y + dy2.x), rows, cols, elemPerRow );
     d += t * src[4].x / ((dx2.x - dx1.x) * (dy2.x - dy1.x));
-    
+
     t = 0;
     t += read_sumTex( sumTex, sampler, (int2)(x + dx1.y, y + dy1.y), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx1.y, y + dy2.y), rows, cols, elemPerRow );
@@ -161,14 +161,14 @@ float icvCalcHaarPatternSum_3(
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx2.x, y + dy1.x), rows, cols, elemPerRow );
     t += read_sumTex( sumTex, sampler, (int2)(x + dx2.x, y + dy2.x), rows, cols, elemPerRow );
     d += t * src[4].x / ((dx2.x - dx1.x) * (dy2.x - dy1.x));
-    
+
     t = 0;
     t += read_sumTex( sumTex, sampler, (int2)(x + dx1.y, y + dy1.y), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx1.y, y + dy2.y), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx2.y, y + dy1.y), rows, cols, elemPerRow );
     t += read_sumTex( sumTex, sampler, (int2)(x + dx2.y, y + dy2.y), rows, cols, elemPerRow );
     d += t * src[4].y / ((dx2.y - dx1.y) * (dy2.y - dy1.y));
-    
+
     t = 0;
     t += read_sumTex( sumTex, sampler, (int2)(x + dx1.z, y + dy1.z), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx1.z, y + dy2.z), rows, cols, elemPerRow );
@@ -204,21 +204,21 @@ float icvCalcHaarPatternSum_4(
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx2.x, y + dy1.x), rows, cols, elemPerRow );
     t += read_sumTex( sumTex, sampler, (int2)(x + dx2.x, y + dy2.x), rows, cols, elemPerRow );
     d += t * src[4].x / ((dx2.x - dx1.x) * (dy2.x - dy1.x));
-    
+
     t = 0;
     t += read_sumTex( sumTex, sampler, (int2)(x + dx1.y, y + dy1.y), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx1.y, y + dy2.y), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx2.y, y + dy1.y), rows, cols, elemPerRow );
     t += read_sumTex( sumTex, sampler, (int2)(x + dx2.y, y + dy2.y), rows, cols, elemPerRow );
     d += t * src[4].y / ((dx2.y - dx1.y) * (dy2.y - dy1.y));
-    
+
     t = 0;
     t += read_sumTex( sumTex, sampler, (int2)(x + dx1.z, y + dy1.z), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx1.z, y + dy2.z), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx2.z, y + dy1.z), rows, cols, elemPerRow );
     t += read_sumTex( sumTex, sampler, (int2)(x + dx2.z, y + dy2.z), rows, cols, elemPerRow );
     d += t * src[4].z / ((dx2.z - dx1.z) * (dy2.z - dy1.z));
-    
+
     t = 0;
     t += read_sumTex( sumTex, sampler, (int2)(x + dx1.w, y + dy1.w), rows, cols, elemPerRow );
     t -= read_sumTex( sumTex, sampler, (int2)(x + dx1.w, y + dy2.w), rows, cols, elemPerRow );
@@ -1231,7 +1231,7 @@ void compute_descriptors64(
     barrier(CLK_LOCAL_MEM_FENCE);
 
     reduce_sum25(sdx, sdy, sdxabs, sdyabs, tid);
+
     barrier(CLK_LOCAL_MEM_FENCE);
     if (tid < 25)
     {
@@ -1361,14 +1361,14 @@ void reduce_sum128(volatile __local  float* smem, int tid)
 #if WAVE_SIZE < 64
     }
     barrier(CLK_LOCAL_MEM_FENCE);
-    if (tid < 32) 
+    if (tid < 32)
     {
 #endif
         smem[tid] += smem[tid + 32];
 #if WAVE_SIZE < 32
     }
     barrier(CLK_LOCAL_MEM_FENCE);
-    if (tid < 16) 
+    if (tid < 16)
     {
 #endif
         smem[tid] += smem[tid + 16];
@@ -1415,7 +1415,7 @@ void reduce_sum64(volatile __local  float* smem, int tid)
 #if WAVE_SIZE < 32
     }
     barrier(CLK_LOCAL_MEM_FENCE);
-    if (tid < 16) 
+    if (tid < 16)
     {
 #endif
         smem[tid] += smem[tid + 16];
index 2abe603..5fbe446 100644 (file)
@@ -53,7 +53,7 @@
 
 #if defined(HAVE_OPENCV_GPU)
     #include "opencv2/nonfree/gpu.hpp"
-    
+
     #if defined(HAVE_CUDA)
         #include "opencv2/gpu/stream_accessor.hpp"
         #include "opencv2/gpu/device/common.hpp"
index 0a5f887..6bde067 100644 (file)
@@ -1964,10 +1964,10 @@ cvLoadHaarClassifierCascade( const char* directory, CvSize orig_window_size )
 
     size += (n+1)*sizeof(char*);
     const char** input_cascade = (const char**)cvAlloc( size );
-    
+
     if( !input_cascade )
       CV_Error( CV_StsNoMem, "Could not allocate memory for input_cascade" );
-      
+
     char* ptr = (char*)(input_cascade + n + 1);
 
     for( int i = 0; i < n; i++ )
@@ -1988,7 +1988,7 @@ cvLoadHaarClassifierCascade( const char* directory, CvSize orig_window_size )
     }
 
     input_cascade[n] = 0;
-    
+
     CvHaarClassifierCascade* cascade = icvLoadCascadeCART( input_cascade, n, orig_window_size );
 
     if( input_cascade )
index 41ecb3f..dd0c439 100644 (file)
@@ -439,7 +439,7 @@ int CV_CascadeDetectorTest::detectMultiScale_C( const string& filename,
 
     CvMat c_gray = grayImg;
     CvSeq* rs = cvHaarDetectObjects(&c_gray, c_cascade, storage, 1.1, 3, flags[di] );
-    
+
     objects.clear();
     for( int i = 0; i < rs->total; i++ )
     {
index 5da848f..7dda963 100644 (file)
@@ -6,14 +6,14 @@ OpenCL Module Introduction
 General Information
 -------------------
 
-The OpenCV OCL module contains  a set of classes and functions that implement and accelerate select openCV functionality on OpenCL compatible devices. OpenCL is a Khronos standard, implemented by a variety of devices (CPUs, GPUs, FPGAs, ARM), abstracting the exact hardware details, while enabling vendors to provide native implementation for maximal acceleration on their hardware. The standard enjoys wide industry support, and the end user of the module will enjoy the data parallelism benefits that the specific platform/hardware may be capable of, in a platform/hardware independent manner. 
+The OpenCV OCL module contains  a set of classes and functions that implement and accelerate select openCV functionality on OpenCL compatible devices. OpenCL is a Khronos standard, implemented by a variety of devices (CPUs, GPUs, FPGAs, ARM), abstracting the exact hardware details, while enabling vendors to provide native implementation for maximal acceleration on their hardware. The standard enjoys wide industry support, and the end user of the module will enjoy the data parallelism benefits that the specific platform/hardware may be capable of, in a platform/hardware independent manner.
 
-While in the future we hope to validate (and enable) the OCL module in all OpenCL capable devices, we currently develop and test on GPU devices only. This includes both discrete GPUs (NVidia, AMD), as well as integrated chips(AMD APU and intel HD devices). Performance of any particular algorithm will depend on the particular platform characteristics and capabilities. However, currently (as of 2.4.4), accuracy and  mathematical correctness has been verified to be identical to that of the pure CPU implementation on all tested GPU devices and platforms (both windows and linux). 
+While in the future we hope to validate (and enable) the OCL module in all OpenCL capable devices, we currently develop and test on GPU devices only. This includes both discrete GPUs (NVidia, AMD), as well as integrated chips(AMD APU and intel HD devices). Performance of any particular algorithm will depend on the particular platform characteristics and capabilities. However, currently (as of 2.4.4), accuracy and  mathematical correctness has been verified to be identical to that of the pure CPU implementation on all tested GPU devices and platforms (both windows and linux).
 
 
 The OpenCV OCL module includes utility functions, low-level vision primitives, and high-level algorithms. The utility functions and low-level primitives provide a powerful infrastructure for developing fast vision algorithms taking advangtage of OCL whereas the high-level functionality (samples)includes some state-of-the-art algorithms (including LK Optical flow, and Face detection) ready to be used by the application developers. The module is also accompanied by an extensive performance and accuracy test suite.
 
-The OpenCV OCL module is designed for ease of use and does not require any knowledge of OpenCL. At a minimuml level, it can be viewed as a set of accelerators, that can take advantage of the high compute throughput that GPU/APU devices can provide. However, it can also be viewed as a starting point to really integratethe  built-in functionality with your own custom OpenCL kernels, with or without modifying the source of OpenCV-OCL. Of course, knowledge of OpenCL will certainly help, however we hope that OpenCV-OCL module, and  the kernels it contains in source code, can be very useful as a means of actually learning openCL. Such a knowledge would be necessary to further fine-tune any of the existing OpenCL kernels, or for extending the framework with new kernels. As of OpenCV 2.4.4, we introduce interoperability with OpenCL, enabling easy use of custom OpenCL kernels within the OpenCV framework. 
+The OpenCV OCL module is designed for ease of use and does not require any knowledge of OpenCL. At a minimuml level, it can be viewed as a set of accelerators, that can take advantage of the high compute throughput that GPU/APU devices can provide. However, it can also be viewed as a starting point to really integratethe  built-in functionality with your own custom OpenCL kernels, with or without modifying the source of OpenCV-OCL. Of course, knowledge of OpenCL will certainly help, however we hope that OpenCV-OCL module, and  the kernels it contains in source code, can be very useful as a means of actually learning openCL. Such a knowledge would be necessary to further fine-tune any of the existing OpenCL kernels, or for extending the framework with new kernels. As of OpenCV 2.4.4, we introduce interoperability with OpenCL, enabling easy use of custom OpenCL kernels within the OpenCV framework.
 
 To use the OCL module, you need to make sure that you have the OpenCL SDK provided with your device vendor. To correctly run the OCL module, you need to have the OpenCL runtime provide by the device vendor, typically the device driver.
 
index 1500ea5..e47e720 100644 (file)
@@ -500,13 +500,13 @@ Returns void
             * **SORT_SELECTION** selection sort, currently cannot sort duplicate keys
             * **SORT_MERGE**     merge sort
             * **SORT_RADIX**     radix sort, only support signed int/float keys(``CV_32S``/``CV_32F``)
-            
+
 Returns the sorted result of all the elements in values based on equivalent keys.
 
-The element unit in the values to be sorted is determined from the data type, 
+The element unit in the values to be sorted is determined from the data type,
 i.e., a ``CV_32FC2`` input ``{a1a2, b1b2}`` will be considered as two elements, regardless its matrix dimension.
 
-Both keys and values will be sorted inplace. 
+Both keys and values will be sorted inplace.
 
 Keys needs to be a **single** channel `oclMat`.
 
index aa0283f..5b3642d 100644 (file)
@@ -119,7 +119,7 @@ namespace cv
         CV_EXPORTS void setDevice(Info &oclinfo, int devnum = 0);
 
         //The two functions below enable other opencl program to use ocl module's cl_context and cl_command_queue
-        //returns cl_context * 
+        //returns cl_context *
         CV_EXPORTS void* getoclContext();
         //returns cl_command_queue *
         CV_EXPORTS void* getoclCommandQueue();
@@ -183,8 +183,8 @@ namespace cv
 
         //! Enable or disable OpenCL program binary caching onto local disk
         // After a program (*.cl files in opencl/ folder) is built at runtime, we allow the
-        // compiled OpenCL program to be cached to the path automatically as "path/*.clb" 
-        // binary file, which will be reused when the OpenCV executable is started again. 
+        // compiled OpenCL program to be cached to the path automatically as "path/*.clb"
+        // binary file, which will be reused when the OpenCV executable is started again.
         //
         // Caching mode is controlled by the following enums
         // Notes
@@ -201,7 +201,7 @@ namespace cv
         };
         CV_EXPORTS void setBinaryDiskCache(int mode = CACHE_RELEASE, cv::String path = "./");
 
-        //! set where binary cache to be saved to 
+        //! set where binary cache to be saved to
         CV_EXPORTS void setBinpath(const char *path);
 
         class CV_EXPORTS oclMatExpr;
@@ -514,10 +514,10 @@ namespace cv
         CV_EXPORTS void calcHist(const oclMat &mat_src, oclMat &mat_hist);
         //! only 8UC1 and 256 bins is supported now
         CV_EXPORTS void equalizeHist(const oclMat &mat_src, oclMat &mat_dst);
-        
+
         //! only 8UC1 is supported now
         CV_EXPORTS Ptr<cv::CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
-        
+
         //! bilateralFilter
         // supports 8UC1 8UC4
         CV_EXPORTS void bilateralFilter(const oclMat& src, oclMat& dst, int d, double sigmaColor, double sigmaSpave, int borderType=BORDER_DEFAULT);
@@ -840,7 +840,7 @@ namespace cv
         // supports CV_32FC1/CV_32FC2/CV_32FC4 data type
         CV_EXPORTS void distanceToCenters(oclMat &dists, oclMat &labels, const oclMat &src, const oclMat &centers);
 
-        //!Does k-means procedure on GPU 
+        //!Does k-means procedure on GPU
         // supports CV_32FC1/CV_32FC2/CV_32FC4 data type
         CV_EXPORTS double kmeans(const oclMat &src, int K, oclMat &bestLabels,
                                      TermCriteria criteria, int attemps, int flags, oclMat &centers);
@@ -1683,7 +1683,7 @@ namespace cv
         };
         //! Returns the sorted result of all the elements in input based on equivalent keys.
         //
-        //  The element unit in the values to be sorted is determined from the data type, 
+        //  The element unit in the values to be sorted is determined from the data type,
         //  i.e., a CV_32FC2 input {a1a2, b1b2} will be considered as two elements, regardless its
         //  matrix dimension.
         //  both keys and values will be sorted inplace
index 634f2f2..3176a68 100644 (file)
@@ -130,7 +130,7 @@ namespace cv
             {
                 openCLFree(tex_);
             }
-            operator cl_mem() 
+            operator cl_mem()
             {
                 return tex_;
             }
index 0875903..1d7e2cf 100644 (file)
@@ -99,7 +99,7 @@ int main(int argc, const char *argv[])
 
     // set this to overwrite binary cache every time the test starts
     ocl::setBinaryDiskCache(ocl::CACHE_UPDATE);
-    
+
     if (cmd.get<bool>("verify"))
     {
         TestSystem::instance().setNumIters(1);
index e0622aa..8485278 100644 (file)
@@ -87,7 +87,7 @@ PERFTEST(StereoMatchBM)
        d_bm(d_left, d_right, d_disp);
        d_disp.download(disp);
        GPU_FULL_OFF;
-    
+
     TestSystem::instance().setAccurate(-1, 0.);
 }
 
@@ -98,4 +98,4 @@ PERFTEST(StereoMatchBM)
 
 
 
-       
\ No newline at end of file
+
index be288b4..e4204cb 100644 (file)
@@ -284,7 +284,7 @@ PERFTEST(GaussianBlur)
     Mat src, dst, ocl_dst;
     int all_type[] = {CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4};
     std::string type_name[] = {"CV_8UC1", "CV_8UC4", "CV_32FC1", "CV_32FC4"};
-    const int ksize = 7;       
+    const int ksize = 7;
 
     for (int size = Min_Size; size <= Max_Size; size *= Multiple)
     {
@@ -374,4 +374,4 @@ PERFTEST(filter2D)
 
 
     }
-}
\ No newline at end of file
+}
index 9e809e4..430d441 100644 (file)
@@ -55,14 +55,14 @@ PERFTEST(GoodFeaturesToTrack)
     double qualityLevel = 0.01;
 
     std::string images[] = { "rubberwhale1.png", "aloeL.jpg" };
-    
+
     std::vector<cv::Point2f> pts_gold, pts_ocl;
 
     for(size_t imgIdx = 0; imgIdx < (sizeof(images)/sizeof(std::string)); ++imgIdx)
     {
         Mat frame = imread(abspath(images[imgIdx]), IMREAD_GRAYSCALE);
         CV_Assert(!frame.empty());
-        
+
         for(float minDistance = 0; minDistance < 4; minDistance += 3.0)
         {
             SUBTEST << "image = " << images[imgIdx] << "; ";
index 0f05581..610a168 100644 (file)
@@ -77,7 +77,7 @@ PERFTEST(HOG)
     WARMUP_ON;
     ocl_hog.detectMultiScale(d_src, d_found_locations);
     WARMUP_OFF;
-    
+
     if(d_found_locations.size() == found_locations.size())
         TestSystem::instance().setAccurate(1, 0);
     else
index 582853d..2ed64ce 100644 (file)
@@ -852,7 +852,7 @@ PERFTEST(meanShiftProc)
         GPU_FULL_OFF;
 
         vector<double> eps(2, 0.);
-        TestSystem::instance().ExpectMatsNear(dst, ocl_dst, eps);      
+        TestSystem::instance().ExpectMatsNear(dst, ocl_dst, eps);
     }
 }
 
index fec8d73..268fe79 100644 (file)
@@ -72,7 +72,7 @@ PERFTEST(norm)
         WARMUP_OFF;
 
         d_src1.download(ocl_src1);
-        TestSystem::instance().ExpectedMatNear(src1, ocl_src1, .5);                        
+        TestSystem::instance().ExpectedMatNear(src1, ocl_src1, .5);
 
         GPU_ON;
         ocl::norm(d_src1, d_src2, NORM_INF);
index 2a49eb2..439930d 100644 (file)
@@ -301,8 +301,8 @@ static const char* GetAnsiColorCode(GTestColor color) {
 
 static void printMetricsUti(double cpu_time, double gpu_time, double gpu_full_time, double speedup, double fullspeedup, std::stringstream& stream, std::stringstream& cur_subtest_description)
 {
-    //cout <<TAB<< setw(7) << stream.str(); 
-    cout <<TAB; 
+    //cout <<TAB<< setw(7) << stream.str();
+    cout <<TAB;
 
     stream.str("");
     stream << cpu_time;
@@ -334,9 +334,9 @@ void TestSystem::printMetrics(int is_accurate, double cpu_time, double gpu_time,
     stringstream stream;
 
     std::stringstream &cur_subtest_description = getCurSubtestDescription();
-   
+
 #if GTEST_OS_WINDOWS&&!GTEST_OS_WINDOWS_MOBILE
-    
+
     WORD color;
     const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
     // Gets the current text color.
@@ -401,10 +401,10 @@ void TestSystem::writeMetrics(double cpu_time, double gpu_time, double gpu_full_
         exit(-1);
     }
 
-    fprintf(record_, "%s,%s,%s,%.2f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\n", 
+    fprintf(record_, "%s,%s,%s,%.2f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\n",
         itname_changed_ ? itname_.c_str() : "",
         cur_subtest_description_.str().c_str(),
-        _is_accurate_.c_str(), 
+        _is_accurate_.c_str(),
         accurate_diff_,
         cpu_time, gpu_time, speedup, gpu_full_time, fullspeedup,
         gpu_min, gpu_max, std_dev);
index cbe817f..736125e 100644 (file)
@@ -133,7 +133,7 @@ PERFTEST(Split)
 
             WARMUP_ON;
             ocl::split(d_src, d_dst);
-            WARMUP_OFF;         
+            WARMUP_OFF;
 
             GPU_ON;
             ocl::split(d_src, d_dst);
index 49a56ce..a591c82 100644 (file)
@@ -118,7 +118,7 @@ inline int divUp(int total, int grain)
 /////////////////////// add subtract multiply divide /////////////////////////
 //////////////////////////////////////////////////////////////////////////////
 template<typename T>
-void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, 
+void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst,
                     string kernelName, const char **kernelString, void *_scalar, int op_type = 0)
 {
     if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
@@ -187,12 +187,12 @@ void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst,
             openCLExecuteKernel(clCxt, kernelString, kernelName, globalThreads, localThreads, args, -1, depth);
     }
 }
-static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, 
+static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst,
                            string kernelName, const char **kernelString, int op_type = 0)
 {
     arithmetic_run<char>(src1, src2, dst, kernelName, kernelString, (void *)NULL, op_type);
 }
-static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask, 
+static void arithmetic_run(const oclMat &src1, const oclMat &src2, oclMat &dst, const oclMat &mask,
                            string kernelName, const char **kernelString, int op_type = 0)
 {
     if(!src1.clCxt->supportsFeature(Context::CL_DOUBLE) && src1.type() == CV_64F)
index 6e858d1..a08f0ed 100644 (file)
@@ -218,7 +218,7 @@ public:
 **Extend this if necessary later.
 **Note that the kernel need to be further refined.
 */
-static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel, 
+static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
                          Size &ksize, const Point anchor, bool rectKernel)
 {
     //Normalize the result by default
@@ -275,8 +275,8 @@ static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
     }
 
     char compile_option[128];
-    sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D ERODE %s %s", 
-        anchor.x, anchor.y, (int)localThreads[0], (int)localThreads[1], 
+    sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D ERODE %s %s",
+        anchor.x, anchor.y, (int)localThreads[0], (int)localThreads[1],
         s, rectKernel?"-D RECTKERNEL":"");
     vector< pair<size_t, const void *> > args;
     args.push_back(make_pair(sizeof(cl_mem), (void *)&src.data));
@@ -296,7 +296,7 @@ static void GPUErode(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
 
 
 //! data type supported: CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4
-static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel, 
+static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
                           Size &ksize, const Point anchor, bool rectKernel)
 {
     //Normalize the result by default
@@ -316,7 +316,7 @@ static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
     Context *clCxt = src.clCxt;
     string kernelName;
     size_t localThreads[3] = {16, 16, 1};
-    size_t globalThreads[3] = {(src.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0], 
+    size_t globalThreads[3] = {(src.cols + localThreads[0] - 1) / localThreads[0] *localThreads[0],
                                (src.rows + localThreads[1] - 1) / localThreads[1] *localThreads[1], 1};
 
     if (src.type() == CV_8UC1)
@@ -354,8 +354,8 @@ static void GPUDilate(const oclMat &src, oclMat &dst, oclMat &mat_kernel,
     }
 
     char compile_option[128];
-    sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D DILATE %s %s", 
-        anchor.x, anchor.y, (int)localThreads[0], (int)localThreads[1], 
+    sprintf(compile_option, "-D RADIUSX=%d -D RADIUSY=%d -D LSIZE0=%d -D LSIZE1=%d -D DILATE %s %s",
+        anchor.x, anchor.y, (int)localThreads[0], (int)localThreads[1],
         s, rectKernel?"-D RECTKERNEL":"");
     vector< pair<size_t, const void *> > args;
     args.push_back(make_pair(sizeof(cl_mem), (void *)&src.data));
@@ -622,7 +622,7 @@ static void GPUFilter2D(const oclMat &src, oclMat &dst, const oclMat &mat_kernel
     int cn =  src.oclchannels();
     int src_step = (int)(src.step/src.elemSize());
     int dst_step = (int)(dst.step/src.elemSize());
-    
+
     int localWidth = localThreads[0] + paddingPixels;
     int localHeight = localThreads[1] + paddingPixels;
 
index 0684417..2219e77 100644 (file)
@@ -147,7 +147,7 @@ struct Sorter<SELECTION>
     static void sortCorners_caller(const EigType& eig_tex, oclMat& corners, const int count)
     {
         Context * cxt = Context::getContext();
-        
+
         size_t globalThreads[3] = {count, 1, 1};
         size_t localThreads[3]  = {GROUP_SIZE, 1, 1};
 
@@ -170,7 +170,7 @@ struct Sorter<SELECTION>
 };
 
 int findCorners_caller(
-    const TextureCL& eig, 
+    const TextureCL& eig,
     const float threshold,
     const oclMat& mask,
     oclMat& corners,
@@ -254,7 +254,7 @@ void cv::ocl::GoodFeaturesToTrackDetector_OCL::operator ()(const oclMat& image,
             Sorter<SELECTION>::sortCorners_caller(*eig_tex, tmpCorners_, total);
         }
     }
-    
+
     if (minDistance < 1)
     {
         Rect roi_range(0, 0, maxCorners > 0 ? std::min(maxCorners, total) : total, 1);
@@ -338,14 +338,14 @@ void cv::ocl::GoodFeaturesToTrackDetector_OCL::downloadPoints(const oclMat &poin
     CV_DbgAssert(points.type() == CV_32FC2);
     points_v.resize(points.cols);
     openCLSafeCall(clEnqueueReadBuffer(
-        *reinterpret_cast<cl_command_queue*>(getoclCommandQueue()), 
-        reinterpret_cast<cl_mem>(points.data), 
-        CL_TRUE,                                    
-        0, 
-        points.cols * sizeof(Point2f), 
-        &points_v[0], 
-        0, 
-        NULL, 
+        *reinterpret_cast<cl_command_queue*>(getoclCommandQueue()),
+        reinterpret_cast<cl_mem>(points.data),
+        CL_TRUE,
+        0,
+        points.cols * sizeof(Point2f),
+        &points_v[0],
+        0,
+        NULL,
         NULL));
 }
 
index 934957e..212fd2c 100644 (file)
@@ -1458,7 +1458,7 @@ void cv::ocl::OclCascadeClassifierBuf::CreateFactorRelatedBufs(
             gimg1.release();
             gsum.release();
             gsqsum.release();
-        } 
+        }
         else if (!(m_flags & CV_HAAR_SCALE_IMAGE) && (flags & CV_HAAR_SCALE_IMAGE))
         {
             openCLSafeCall(clReleaseMemObject(((OclBuffers *)buffers)->newnodebuffer));
@@ -1476,7 +1476,7 @@ void cv::ocl::OclCascadeClassifierBuf::CreateFactorRelatedBufs(
             {
                 return;
             }
-        } 
+        }
         else
         {
             if (fabs(m_scaleFactor - scaleFactor) < 1e-6
index c7ac409..e532d31 100644 (file)
@@ -89,33 +89,33 @@ namespace cv
 
                 void compute_hists(int nbins, int block_stride_x, int blovck_stride_y,
                                    int height, int width, const cv::ocl::oclMat &grad,
-                                   const cv::ocl::oclMat &qangle, 
+                                   const cv::ocl::oclMat &qangle,
                                    const cv::ocl::oclMat &gauss_w_lut, cv::ocl::oclMat &block_hists);
 
                 void normalize_hists(int nbins, int block_stride_x, int block_stride_y,
-                                     int height, int width, cv::ocl::oclMat &block_hists, 
+                                     int height, int width, cv::ocl::oclMat &block_hists,
                                      float threshold);
 
                 void classify_hists(int win_height, int win_width, int block_stride_y,
-                                    int block_stride_x, int win_stride_y, int win_stride_x, 
-                                    int height, int width, const cv::ocl::oclMat &block_hists, 
+                                    int block_stride_x, int win_stride_y, int win_stride_x,
+                                    int height, int width, const cv::ocl::oclMat &block_hists,
                                     const cv::ocl::oclMat &coefs, float free_coef,
                                     float threshold, cv::ocl::oclMat &labels);
 
-                void extract_descrs_by_rows(int win_height, int win_width, int block_stride_y, 
-                                            int block_stride_x, int win_stride_y, int win_stride_x, 
+                void extract_descrs_by_rows(int win_height, int win_width, int block_stride_y,
+                                            int block_stride_x, int win_stride_y, int win_stride_x,
                                             int height, int width, const cv::ocl::oclMat &block_hists,
                                             cv::ocl::oclMat &descriptors);
-                void extract_descrs_by_cols(int win_height, int win_width, int block_stride_y, 
-                                            int block_stride_x, int win_stride_y, int win_stride_x, 
+                void extract_descrs_by_cols(int win_height, int win_width, int block_stride_y,
+                                            int block_stride_x, int win_stride_y, int win_stride_x,
                                             int height, int width, const cv::ocl::oclMat &block_hists,
                                             cv::ocl::oclMat &descriptors);
 
                 void compute_gradients_8UC1(int height, int width, const cv::ocl::oclMat &img,
-                                            float angle_scale, cv::ocl::oclMat &grad, 
+                                            float angle_scale, cv::ocl::oclMat &grad,
                                             cv::ocl::oclMat &qangle, bool correct_gamma);
                 void compute_gradients_8UC4(int height, int width, const cv::ocl::oclMat &img,
-                                            float angle_scale, cv::ocl::oclMat &grad, 
+                                            float angle_scale, cv::ocl::oclMat &grad,
                                             cv::ocl::oclMat &qangle, bool correct_gamma);
             }
         }
@@ -129,8 +129,8 @@ static inline int divUp(int total, int grain)
     return (total + grain - 1) / grain;
 }
 
-cv::ocl::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size block_stride_, 
-                                      Size cell_size_, int nbins_, double win_sigma_, 
+cv::ocl::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size block_stride_,
+                                      Size cell_size_, int nbins_, double win_sigma_,
                                       double threshold_L2hys_, bool gamma_correction_, int nlevels_)
     : win_size(win_size_),
       block_size(block_size_),
@@ -145,19 +145,19 @@ cv::ocl::HOGDescriptor::HOGDescriptor(Size win_size_, Size block_size_, Size blo
     CV_Assert((win_size.width  - block_size.width ) % block_stride.width  == 0 &&
               (win_size.height - block_size.height) % block_stride.height == 0);
 
-    CV_Assert(block_size.width % cell_size.width == 0 && 
+    CV_Assert(block_size.width % cell_size.width == 0 &&
         block_size.height % cell_size.height == 0);
 
     CV_Assert(block_stride == cell_size);
 
     CV_Assert(cell_size == Size(8, 8));
 
-    Size cells_per_block(block_size.width / cell_size.width, 
+    Size cells_per_block(block_size.width / cell_size.width,
         block_size.height / cell_size.height);
     CV_Assert(cells_per_block == Size(2, 2));
 
     cv::Size blocks_per_win = numPartsWithin(win_size, block_size, block_stride);
-    hog::set_up_constants(nbins, block_stride.width, block_stride.height, 
+    hog::set_up_constants(nbins, block_stride.width, block_stride.height,
         blocks_per_win.width, blocks_per_win.height);
 
     effect_size = Size(0, 0);
@@ -175,7 +175,7 @@ size_t cv::ocl::HOGDescriptor::getDescriptorSize() const
 
 size_t cv::ocl::HOGDescriptor::getBlockHistogramSize() const
 {
-    Size cells_per_block = Size(block_size.width / cell_size.width, 
+    Size cells_per_block = Size(block_size.width / cell_size.width,
         block_size.height / cell_size.height);
     return (size_t)(nbins * cells_per_block.area());
 }
@@ -189,7 +189,7 @@ bool cv::ocl::HOGDescriptor::checkDetectorSize() const
 {
     size_t detector_size = detector.rows * detector.cols;
     size_t descriptor_size = getDescriptorSize();
-    return detector_size == 0 || detector_size == descriptor_size || 
+    return detector_size == 0 || detector_size == descriptor_size ||
         detector_size == descriptor_size + 1;
 }
 
@@ -230,7 +230,7 @@ void cv::ocl::HOGDescriptor::init_buffer(const oclMat &img, Size win_stride)
 
     const size_t block_hist_size = getBlockHistogramSize();
     const Size blocks_per_img = numPartsWithin(img.size(), block_size, block_stride);
-    block_hists.create(1, 
+    block_hists.create(1,
         static_cast<int>(block_hist_size * blocks_per_img.area()) + 256, CV_32F);
 
     Size wins_per_img = numPartsWithin(img.size(), win_size, win_stride);
@@ -258,11 +258,11 @@ void cv::ocl::HOGDescriptor::computeGradient(const oclMat &img, oclMat &grad, oc
     switch (img.type())
     {
     case CV_8UC1:
-        hog::compute_gradients_8UC1(effect_size.height, effect_size.width, img, 
+        hog::compute_gradients_8UC1(effect_size.height, effect_size.width, img,
             angleScale, grad, qangle, gamma_correction);
         break;
     case CV_8UC4:
-        hog::compute_gradients_8UC4(effect_size.height, effect_size.width, img, 
+        hog::compute_gradients_8UC4(effect_size.height, effect_size.width, img,
             angleScale, grad, qangle, gamma_correction);
         break;
     }
@@ -273,18 +273,18 @@ void cv::ocl::HOGDescriptor::computeBlockHistograms(const oclMat &img)
 {
     computeGradient(img, this->grad, this->qangle);
 
-    hog::compute_hists(nbins, block_stride.width, block_stride.height, effect_size.height, 
+    hog::compute_hists(nbins, block_stride.width, block_stride.height, effect_size.height,
         effect_size.width, grad, qangle, gauss_w_lut, block_hists);
 
-    hog::normalize_hists(nbins, block_stride.width, block_stride.height, effect_size.height, 
+    hog::normalize_hists(nbins, block_stride.width, block_stride.height, effect_size.height,
         effect_size.width, block_hists, (float)threshold_L2hys);
 }
 
 
-void cv::ocl::HOGDescriptor::getDescriptors(const oclMat &img, Size win_stride, 
+void cv::ocl::HOGDescriptor::getDescriptors(const oclMat &img, Size win_stride,
                                             oclMat &descriptors, int descr_format)
 {
-    CV_Assert(win_stride.width % block_stride.width == 0 && 
+    CV_Assert(win_stride.width % block_stride.width == 0 &&
         win_stride.height % block_stride.height == 0);
 
     init_buffer(img, win_stride);
@@ -295,19 +295,19 @@ void cv::ocl::HOGDescriptor::getDescriptors(const oclMat &img, Size win_stride,
     Size blocks_per_win = numPartsWithin(win_size, block_size, block_stride);
     Size wins_per_img   = numPartsWithin(effect_size, win_size, win_stride);
 
-    descriptors.create(wins_per_img.area(), 
+    descriptors.create(wins_per_img.area(),
         static_cast<int>(blocks_per_win.area() * block_hist_size), CV_32F);
 
     switch (descr_format)
     {
     case DESCR_FORMAT_ROW_BY_ROW:
-        hog::extract_descrs_by_rows(win_size.height, win_size.width, 
-            block_stride.height, block_stride.width, win_stride.height, win_stride.width, 
+        hog::extract_descrs_by_rows(win_size.height, win_size.width,
+            block_stride.height, block_stride.width, win_stride.height, win_stride.width,
             effect_size.height, effect_size.width, block_hists, descriptors);
         break;
     case DESCR_FORMAT_COL_BY_COL:
-        hog::extract_descrs_by_cols(win_size.height, win_size.width, 
-            block_stride.height, block_stride.width, win_stride.height, win_stride.width, 
+        hog::extract_descrs_by_cols(win_size.height, win_size.width,
+            block_stride.height, block_stride.width, win_stride.height, win_stride.width,
             effect_size.height, effect_size.width, block_hists, descriptors);
         break;
     default:
@@ -316,7 +316,7 @@ void cv::ocl::HOGDescriptor::getDescriptors(const oclMat &img, Size win_stride,
 }
 
 
-void cv::ocl::HOGDescriptor::detect(const oclMat &img, vector<Point> &hits, 
+void cv::ocl::HOGDescriptor::detect(const oclMat &img, vector<Point> &hits,
                                     double hit_threshold, Size win_stride, Size padding)
 {
     CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
@@ -329,15 +329,15 @@ void cv::ocl::HOGDescriptor::detect(const oclMat &img, vector<Point> &hits,
     if (win_stride == Size())
         win_stride = block_stride;
     else
-        CV_Assert(win_stride.width % block_stride.width == 0 && 
+        CV_Assert(win_stride.width % block_stride.width == 0 &&
             win_stride.height % block_stride.height == 0);
     init_buffer(img, win_stride);
 
     computeBlockHistograms(img);
 
-    hog::classify_hists(win_size.height, win_size.width, block_stride.height, 
-        block_stride.width, win_stride.height, win_stride.width, 
-        effect_size.height, effect_size.width, block_hists, detector, 
+    hog::classify_hists(win_size.height, win_size.width, block_stride.height,
+        block_stride.width, win_stride.height, win_stride.width,
+        effect_size.height, effect_size.width, block_hists, detector,
         (float)free_coef, (float)hit_threshold, labels);
 
     labels.download(labels_host);
@@ -354,8 +354,8 @@ void cv::ocl::HOGDescriptor::detect(const oclMat &img, vector<Point> &hits,
 
 
 
-void cv::ocl::HOGDescriptor::detectMultiScale(const oclMat &img, vector<Rect> &found_locations, 
-                                              double hit_threshold, Size win_stride, Size padding, 
+void cv::ocl::HOGDescriptor::detectMultiScale(const oclMat &img, vector<Rect> &found_locations,
+                                              double hit_threshold, Size win_stride, Size padding,
                                               double scale0, int group_threshold)
 {
     CV_Assert(img.type() == CV_8UC1 || img.type() == CV_8UC4);
@@ -382,7 +382,7 @@ void cv::ocl::HOGDescriptor::detectMultiScale(const oclMat &img, vector<Rect> &f
     if (win_stride == Size())
         win_stride = block_stride;
     else
-        CV_Assert(win_stride.width % block_stride.width == 0 && 
+        CV_Assert(win_stride.width % block_stride.width == 0 &&
             win_stride.height % block_stride.height == 0);
     init_buffer(img, win_stride);
     image_scale.create(img.size(), img.type());
@@ -400,10 +400,10 @@ void cv::ocl::HOGDescriptor::detectMultiScale(const oclMat &img, vector<Rect> &f
             resize(img, image_scale, effect_size);
             detect(image_scale, locations, hit_threshold, win_stride, padding);
         }
-        Size scaled_win_size(cvRound(win_size.width * scale), 
+        Size scaled_win_size(cvRound(win_size.width * scale),
             cvRound(win_size.height * scale));
         for (size_t j = 0; j < locations.size(); j++)
-            all_candidates.push_back(Rect(Point2d((CvPoint)locations[j]) * scale, 
+            all_candidates.push_back(Rect(Point2d((CvPoint)locations[j]) * scale,
               scaled_win_size));
     }
 
@@ -416,10 +416,10 @@ int cv::ocl::HOGDescriptor::numPartsWithin(int size, int part_size, int stride)
     return (size - part_size + stride) / stride;
 }
 
-cv::Size cv::ocl::HOGDescriptor::numPartsWithin(cv::Size size, cv::Size part_size, 
+cv::Size cv::ocl::HOGDescriptor::numPartsWithin(cv::Size size, cv::Size part_size,
                                                 cv::Size stride)
 {
-    return Size(numPartsWithin(size.width, part_size.width, stride.width), 
+    return Size(numPartsWithin(size.width, part_size.width, stride.width),
         numPartsWithin(size.height, part_size.height, stride.height));
 }
 
@@ -1601,8 +1601,8 @@ static int power_2up(unsigned int n)
     return -1; // Input is too big
 }
 
-void cv::ocl::device::hog::set_up_constants(int nbins, 
-                                            int block_stride_x, int block_stride_y, 
+void cv::ocl::device::hog::set_up_constants(int nbins,
+                                            int block_stride_x, int block_stride_y,
                                             int nblocks_win_x, int nblocks_win_y)
 {
     cnbins = nbins;
@@ -1622,21 +1622,21 @@ void cv::ocl::device::hog::set_up_constants(int nbins,
     cdescr_size = descr_size;
 }
 
-void cv::ocl::device::hog::compute_hists(int nbins, 
+void cv::ocl::device::hog::compute_hists(int nbins,
                                          int block_stride_x, int block_stride_y,
-                                         int height, int width, 
-                                         const cv::ocl::oclMat &grad, 
-                                         const cv::ocl::oclMat &qangle, 
-                                         const cv::ocl::oclMat &gauss_w_lut, 
+                                         int height, int width,
+                                         const cv::ocl::oclMat &grad,
+                                         const cv::ocl::oclMat &qangle,
+                                         const cv::ocl::oclMat &gauss_w_lut,
                                          cv::ocl::oclMat &block_hists)
 {
     Context *clCxt = Context::getContext();
     vector< pair<size_t, const void *> > args;
     string kernelName = "compute_hists_lut_kernel";
 
-    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) 
+    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x)
         / block_stride_x;
-    int img_block_height = (height - CELLS_PER_BLOCK_Y * CELL_HEIGHT + block_stride_y) 
+    int img_block_height = (height - CELLS_PER_BLOCK_Y * CELL_HEIGHT + block_stride_y)
         / block_stride_y;
     int blocks_total = img_block_width * img_block_height;
 
@@ -1645,7 +1645,7 @@ void cv::ocl::device::hog::compute_hists(int nbins,
 
     int blocks_in_group = 4;
     size_t localThreads[3] = { blocks_in_group * 24, 2, 1 };
-    size_t globalThreads[3] = { 
+    size_t globalThreads[3] = {
         divUp(img_block_width * img_block_height, blocks_in_group) * localThreads[0], 2, 1 };
 
     int hists_size = (nbins * CELLS_PER_BLOCK_X * CELLS_PER_BLOCK_Y * 12) * sizeof(float);
@@ -1669,7 +1669,7 @@ void cv::ocl::device::hog::compute_hists(int nbins,
 
     if(hog_device_cpu)
     {
-        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
             localThreads, args, -1, -1, "-D CPU");
     }else
     {
@@ -1677,15 +1677,15 @@ void cv::ocl::device::hog::compute_hists(int nbins,
         int wave_size = queryDeviceInfo<WAVEFRONT_SIZE, int>(kernel);
         char opt[32] = {0};
         sprintf(opt, "-D WAVE_SIZE=%d", wave_size);
-        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
             localThreads, args, -1, -1, opt);
     }
 }
 
-void cv::ocl::device::hog::normalize_hists(int nbins, 
+void cv::ocl::device::hog::normalize_hists(int nbins,
                                            int block_stride_x, int block_stride_y,
-                                           int height, int width, 
-                                           cv::ocl::oclMat &block_hists, 
+                                           int height, int width,
+                                           cv::ocl::oclMat &block_hists,
                                            float threshold)
 {
     Context *clCxt = Context::getContext();
@@ -1693,14 +1693,14 @@ void cv::ocl::device::hog::normalize_hists(int nbins,
     string kernelName;
 
     int block_hist_size = nbins * CELLS_PER_BLOCK_X * CELLS_PER_BLOCK_Y;
-    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) 
+    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x)
         / block_stride_x;
-    int img_block_height = (height - CELLS_PER_BLOCK_Y * CELL_HEIGHT + block_stride_y) 
+    int img_block_height = (height - CELLS_PER_BLOCK_Y * CELL_HEIGHT + block_stride_y)
         / block_stride_y;
     int nthreads;
     size_t globalThreads[3] = { 1, 1, 1  };
     size_t localThreads[3] = { 1, 1, 1  };
-    
+
     if ( nbins == 9 )
     {
         /* optimized for the case of 9 bins */
@@ -1720,7 +1720,7 @@ void cv::ocl::device::hog::normalize_hists(int nbins,
         localThreads[0] = nthreads;
 
         if ((nthreads < 32) || (nthreads > 512) )
-            cv::ocl::error("normalize_hists: histogram's size is too small or too big", 
+            cv::ocl::error("normalize_hists: histogram's size is too small or too big",
                 __FILE__, __LINE__, "normalize_hists");
 
         args.push_back( make_pair( sizeof(cl_int), (void *)&nthreads));
@@ -1733,7 +1733,7 @@ void cv::ocl::device::hog::normalize_hists(int nbins,
     args.push_back( make_pair( nthreads * sizeof(float), (void *)NULL));
 
     if(hog_device_cpu)
-        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
                              localThreads, args, -1, -1, "-D CPU");
     else
     {
@@ -1741,18 +1741,18 @@ void cv::ocl::device::hog::normalize_hists(int nbins,
         int wave_size = queryDeviceInfo<WAVEFRONT_SIZE, int>(kernel);
         char opt[32] = {0};
         sprintf(opt, "-D WAVE_SIZE=%d", wave_size);
-        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
                              localThreads, args, -1, -1, opt);
     }
 }
 
-void cv::ocl::device::hog::classify_hists(int win_height, int win_width, 
-                                          int block_stride_y, int block_stride_x, 
-                                          int win_stride_y, int win_stride_x, 
-                                          int height, int width, 
-                                          const cv::ocl::oclMat &block_hists, 
-                                          const cv::ocl::oclMat &coefs, 
-                                          float free_coef, float threshold, 
+void cv::ocl::device::hog::classify_hists(int win_height, int win_width,
+                                          int block_stride_y, int block_stride_x,
+                                          int win_stride_y, int win_stride_x,
+                                          int height, int width,
+                                          const cv::ocl::oclMat &block_hists,
+                                          const cv::ocl::oclMat &coefs,
+                                          float free_coef, float threshold,
                                           cv::ocl::oclMat &labels)
 {
     Context *clCxt = Context::getContext();
@@ -1785,7 +1785,7 @@ void cv::ocl::device::hog::classify_hists(int win_height, int win_width,
     int win_block_stride_y = win_stride_y / block_stride_y;
     int img_win_width = (width - win_width + win_stride_x) / win_stride_x;
     int img_win_height = (height - win_height + win_stride_y) / win_stride_y;
-    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) / 
+    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) /
         block_stride_x;
 
     size_t globalThreads[3] = { img_win_width * nthreads, img_win_height, 1 };
@@ -1802,7 +1802,7 @@ void cv::ocl::device::hog::classify_hists(int win_height, int win_width,
     args.push_back( make_pair( sizeof(cl_mem), (void *)&labels.data));
 
     if(hog_device_cpu)
-        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
                              localThreads, args, -1, -1, "-D CPU");
     else
     {
@@ -1810,16 +1810,16 @@ void cv::ocl::device::hog::classify_hists(int win_height, int win_width,
         int wave_size = queryDeviceInfo<WAVEFRONT_SIZE, int>(kernel);
         char opt[32] = {0};
         sprintf(opt, "-D WAVE_SIZE=%d", wave_size);
-        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+        openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
                              localThreads, args, -1, -1, opt);
     }
 }
 
-void cv::ocl::device::hog::extract_descrs_by_rows(int win_height, int win_width, 
+void cv::ocl::device::hog::extract_descrs_by_rows(int win_height, int win_width,
                                                   int block_stride_y, int block_stride_x,
-                                                  int win_stride_y, int win_stride_x, 
+                                                  int win_stride_y, int win_stride_x,
                                                   int height, int width,
-                                                  const cv::ocl::oclMat &block_hists, 
+                                                  const cv::ocl::oclMat &block_hists,
                                                   cv::ocl::oclMat &descriptors)
 {
     Context *clCxt = Context::getContext();
@@ -1830,7 +1830,7 @@ void cv::ocl::device::hog::extract_descrs_by_rows(int win_height, int win_width,
     int win_block_stride_y = win_stride_y / block_stride_y;
     int img_win_width = (width - win_width + win_stride_x) / win_stride_x;
     int img_win_height = (height - win_height + win_stride_y) / win_stride_y;
-    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) / 
+    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) /
         block_stride_x;
     int descriptors_quadstep = descriptors.step >> 2;
 
@@ -1847,15 +1847,15 @@ void cv::ocl::device::hog::extract_descrs_by_rows(int win_height, int win_width,
     args.push_back( make_pair( sizeof(cl_mem), (void *)&block_hists.data));
     args.push_back( make_pair( sizeof(cl_mem), (void *)&descriptors.data));
 
-    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
         localThreads, args, -1, -1);
 }
 
-void cv::ocl::device::hog::extract_descrs_by_cols(int win_height, int win_width, 
+void cv::ocl::device::hog::extract_descrs_by_cols(int win_height, int win_width,
                                                   int block_stride_y, int block_stride_x,
-                                                  int win_stride_y, int win_stride_x, 
+                                                  int win_stride_y, int win_stride_x,
                                                   int height, int width,
-                                                  const cv::ocl::oclMat &block_hists, 
+                                                  const cv::ocl::oclMat &block_hists,
                                                   cv::ocl::oclMat &descriptors)
 {
     Context *clCxt = Context::getContext();
@@ -1866,7 +1866,7 @@ void cv::ocl::device::hog::extract_descrs_by_cols(int win_height, int win_width,
     int win_block_stride_y = win_stride_y / block_stride_y;
     int img_win_width = (width - win_width + win_stride_x) / win_stride_x;
     int img_win_height = (height - win_height + win_stride_y) / win_stride_y;
-    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) / 
+    int img_block_width = (width - CELLS_PER_BLOCK_X * CELL_WIDTH + block_stride_x) /
         block_stride_x;
     int descriptors_quadstep = descriptors.step >> 2;
 
@@ -1884,15 +1884,15 @@ void cv::ocl::device::hog::extract_descrs_by_cols(int win_height, int win_width,
     args.push_back( make_pair( sizeof(cl_mem), (void *)&block_hists.data));
     args.push_back( make_pair( sizeof(cl_mem), (void *)&descriptors.data));
 
-    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
         localThreads, args, -1, -1);
 }
 
-void cv::ocl::device::hog::compute_gradients_8UC1(int height, int width, 
+void cv::ocl::device::hog::compute_gradients_8UC1(int height, int width,
                                                   const cv::ocl::oclMat &img,
-                                                  float angle_scale, 
-                                                  cv::ocl::oclMat &grad, 
-                                                  cv::ocl::oclMat &qangle, 
+                                                  float angle_scale,
+                                                  cv::ocl::oclMat &grad,
+                                                  cv::ocl::oclMat &qangle,
                                                   bool correct_gamma)
 {
     Context *clCxt = Context::getContext();
@@ -1918,15 +1918,15 @@ void cv::ocl::device::hog::compute_gradients_8UC1(int height, int width,
     args.push_back( make_pair( sizeof(cl_char), (void *)&correctGamma));
     args.push_back( make_pair( sizeof(cl_int), (void *)&cnbins));
 
-    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
         localThreads, args, -1, -1);
 }
 
-void cv::ocl::device::hog::compute_gradients_8UC4(int height, int width, 
+void cv::ocl::device::hog::compute_gradients_8UC4(int height, int width,
                                                   const cv::ocl::oclMat &img,
-                                                  float angle_scale, 
-                                                  cv::ocl::oclMat &grad, 
-                                                  cv::ocl::oclMat &qangle, 
+                                                  float angle_scale,
+                                                  cv::ocl::oclMat &grad,
+                                                  cv::ocl::oclMat &qangle,
                                                   bool correct_gamma)
 {
     Context *clCxt = Context::getContext();
@@ -1953,6 +1953,6 @@ void cv::ocl::device::hog::compute_gradients_8UC4(int height, int width,
     args.push_back( make_pair( sizeof(cl_char), (void *)&correctGamma));
     args.push_back( make_pair( sizeof(cl_int), (void *)&cnbins));
 
-    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads, 
+    openCLExecuteKernel(clCxt, &objdetect_hog, kernelName, globalThreads,
         localThreads, args, -1, -1);
 }
\ No newline at end of file
index 15c1539..ff509fb 100644 (file)
@@ -291,7 +291,7 @@ namespace cv
                 args.push_back( make_pair(sizeof(cl_int), (void *)&map1.cols));
                 args.push_back( make_pair(sizeof(cl_int), (void *)&map1.rows));
                 args.push_back( make_pair(sizeof(cl_int), (void *)&cols));
-                
+
                 if(src.clCxt->supportsFeature(Context::CL_DOUBLE))
                 {
                     args.push_back( make_pair(sizeof(cl_double4), (void *)&borderValue));
@@ -1115,7 +1115,7 @@ namespace cv
              args.push_back( make_pair( sizeof(cl_int) , (void *)&sum.step));
              args.push_back( make_pair( sizeof(cl_int) , (void *)&sum_offset));
              size_t gt2[3] = {t_sum.cols  * 32, 1, 1}, lt2[3] = {256, 1, 1};
-             openCLExecuteKernel(src.clCxt, &imgproc_integral_sum, "integral_sum_rows", gt2, lt2, args, -1, depth);         
+             openCLExecuteKernel(src.clCxt, &imgproc_integral_sum, "integral_sum_rows", gt2, lt2, args, -1, depth);
         }
 
         /////////////////////// corner //////////////////////////////
@@ -1230,7 +1230,7 @@ namespace cv
             oclMat dx, dy;
             cornerMinEigenVal_dxdy(src, dst, dx, dy, blockSize, ksize, borderType);
         }
-        
+
         void cornerMinEigenVal_dxdy(const oclMat &src, oclMat &dst, oclMat &dx, oclMat &dy, int blockSize, int ksize, int borderType)
         {
             if(!src.clCxt->supportsFeature(Context::CL_DOUBLE) && src.depth() == CV_64F)
index 5d81517..b990e09 100644 (file)
@@ -168,7 +168,7 @@ namespace cv
         };
 
         // global variables to hold binary cache properties
-        static int enable_disk_cache = 
+        static int enable_disk_cache =
 #ifdef _DEBUG
             false;
 #else
@@ -514,8 +514,8 @@ namespace cv
                 return;
             }
             update_disk_cache |= (mode & CACHE_UPDATE) == CACHE_UPDATE;
-            enable_disk_cache |= 
-#ifdef _DEBUG 
+            enable_disk_cache |=
+#ifdef _DEBUG
                 (mode & CACHE_DEBUG)   == CACHE_DEBUG;
 #else
                 (mode & CACHE_RELEASE) == CACHE_RELEASE;
@@ -950,8 +950,8 @@ namespace cv
 
         bool initialized()
         {
-            return *((volatile int*)&Context::val) != 0 && 
-                Context::clCxt->impl->clCmdQueue != NULL&& 
+            return *((volatile int*)&Context::val) != 0 &&
+                Context::clCxt->impl->clCmdQueue != NULL&&
                 Context::clCxt->impl->oclcontext != NULL;
         }
 
index 1f76d63..7c0a7ac 100644 (file)
@@ -103,7 +103,7 @@ namespace cv
         {
             // FIXME!
             //   always use naive until convolve is imported
-            return true; 
+            return true;
         }
 
         //////////////////////////////////////////////////////////////////////
@@ -120,7 +120,7 @@ namespace cv
             else
             {
                 buf.image_sqsums.resize(1);
-                
+
                 // TODO, add double support for ocl::integral
                 // use CPU integral temporarily
                 Mat sums, sqsums;
@@ -360,7 +360,7 @@ namespace cv
             }
             else
             {
-                
+
                 split(image, buf.images);
                 templ_sum = sum(templ) / templ.size().area();
                 buf.image_sums.resize(buf.images.size());
index 1ff963a..82189b7 100644 (file)
@@ -627,7 +627,7 @@ static void set_to_withoutmask_run(const oclMat &dst, const Scalar &scalar, stri
     if(Context::getContext()->supportsFeature(Context::CL_VER_1_2) &&
         dst.offset == 0 && dst.cols == dst.wholecols)
     {
-        clEnqueueFillBuffer((cl_command_queue)dst.clCxt->oclCommandQueue(), 
+        clEnqueueFillBuffer((cl_command_queue)dst.clCxt->oclCommandQueue(),
             (cl_mem)dst.data, args[0].second, args[0].first, 0, dst.step * dst.rows, 0, NULL, NULL);
     }
     else
index 4292a1f..2966d53 100644 (file)
@@ -197,7 +197,7 @@ namespace cv
                 desc.buffer           = NULL;
                 desc.num_mip_levels   = 0;
                 desc.num_samples      = 0;
-                texture = clCreateImage((cl_context)mat.clCxt->oclContext(), CL_MEM_READ_WRITE, &format, &desc, NULL, &err);            
+                texture = clCreateImage((cl_context)mat.clCxt->oclContext(), CL_MEM_READ_WRITE, &format, &desc, NULL, &err);
             }
             else
 #endif
@@ -223,7 +223,7 @@ namespace cv
                 const size_t regin[3] = {mat.cols * mat.elemSize(), mat.rows, 1};
                 clEnqueueCopyBufferRect((cl_command_queue)mat.clCxt->oclCommandQueue(), (cl_mem)mat.data, devData, origin, origin,
                     regin, mat.step, 0, mat.cols * mat.elemSize(), 0, 0, NULL, NULL);
-                clFlush((cl_command_queue)mat.clCxt->oclCommandQueue()); 
+                clFlush((cl_command_queue)mat.clCxt->oclCommandQueue());
             }
             else
             {
index cb16fb1..8dfc664 100644 (file)
@@ -143,7 +143,7 @@ static void icvContourMoments( CvSeq* contour, CvMoments* mom )
         args.push_back( make_pair( sizeof(cl_int) , (void *)&dst_step ));
 
         openCLExecuteKernel(dst_a.clCxt, &moments, "icvContourMoments", globalThreads, localThreads, args, -1, -1);
-        
+
         cv::Mat dst(dst_a);
         a00 = a10 = a01 = a20 = a11 = a02 = a30 = a21 = a12 = a03 = 0.0;
         if (!cv::ocl::Context::getContext()->supportsFeature(Context::CL_DOUBLE))
index 6ae869d..341a004 100644 (file)
@@ -66,7 +66,7 @@ __kernel void arithm_absdiff_D0 (__global uchar *src1, int src1_step, int src1_o
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -117,7 +117,7 @@ __kernel void arithm_absdiff_D2 (__global ushort *src1, int src1_step, int src1_
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -154,7 +154,7 @@ __kernel void arithm_absdiff_D3 (__global short *src1, int src1_step, int src1_o
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -261,7 +261,7 @@ __kernel void arithm_s_absdiff_C1_D0 (__global   uchar *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -303,7 +303,7 @@ __kernel void arithm_s_absdiff_C1_D2 (__global   ushort *src1, int src1_step, in
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -337,7 +337,7 @@ __kernel void arithm_s_absdiff_C1_D3 (__global   short *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -443,7 +443,7 @@ __kernel void arithm_s_absdiff_C2_D0 (__global   uchar *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -588,7 +588,7 @@ __kernel void arithm_s_absdiff_C3_D0 (__global   uchar *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -645,7 +645,7 @@ __kernel void arithm_s_absdiff_C3_D2 (__global   ushort *src1, int src1_step, in
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -698,7 +698,7 @@ __kernel void arithm_s_absdiff_C3_D3 (__global   short *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index d3a0026..e7ed289 100644 (file)
@@ -128,7 +128,7 @@ __kernel void addWeighted_D2 (__global ushort *src1, int src1_step,int src1_offs
     {
 
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -191,7 +191,7 @@ __kernel void addWeighted_D3 (__global short *src1, int src1_step,int src1_offse
     {
 
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -255,7 +255,7 @@ __kernel void addWeighted_D4 (__global int *src1, int src1_step,int src1_offset,
         x = x << 2;
 
 #define bitOfInt  (sizeof(int)== 4 ? 2: 3)
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -319,7 +319,7 @@ __kernel void addWeighted_D5 (__global float *src1,int src1_step,int src1_offset
     {
 
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -384,7 +384,7 @@ __kernel void addWeighted_D6 (__global double *src1, int src1_step,int src1_offs
     {
 
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 0552fc8..cdb79f3 100644 (file)
@@ -67,7 +67,7 @@ __kernel void arithm_s_add_C1_D0 (__global   uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -110,7 +110,7 @@ __kernel void arithm_s_add_C1_D2 (__global   ushort *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -145,7 +145,7 @@ __kernel void arithm_s_add_C1_D3 (__global   short *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -250,7 +250,7 @@ __kernel void arithm_s_add_C2_D0 (__global   uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 3dbd376..a0cb7da 100644 (file)
@@ -69,7 +69,7 @@ __kernel void arithm_s_add_with_mask_C1_D0 (__global   uchar *src1, int src1_ste
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -122,7 +122,7 @@ __kernel void arithm_s_add_with_mask_C1_D2 (__global   ushort *src1, int src1_st
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -160,7 +160,7 @@ __kernel void arithm_s_add_with_mask_C1_D3 (__global   short *src1, int src1_ste
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -284,7 +284,7 @@ __kernel void arithm_s_add_with_mask_C2_D0 (__global   uchar *src1, int src1_ste
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index b1f8545..8bdd23c 100644 (file)
@@ -72,7 +72,7 @@ __kernel void arithm_bitwise_binary_D0 (__global uchar *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -125,7 +125,7 @@ __kernel void arithm_bitwise_binary_D1 (__global char *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -179,7 +179,7 @@ __kernel void arithm_bitwise_binary_D2 (__global ushort *src1, int src1_step, in
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -234,7 +234,7 @@ __kernel void arithm_bitwise_binary_D3 (__global short *src1, int src1_step, int
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 7e4a884..60cd188 100644 (file)
@@ -73,7 +73,7 @@ __kernel void arithm_bitwise_binary_with_mask_C1_D0 (
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -118,7 +118,7 @@ __kernel void arithm_bitwise_binary_with_mask_C1_D1 (
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -163,7 +163,7 @@ __kernel void arithm_bitwise_binary_with_mask_C1_D2 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -206,7 +206,7 @@ __kernel void arithm_bitwise_binary_with_mask_C1_D3 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -349,7 +349,7 @@ __kernel void arithm_bitwise_binary_with_mask_C2_D0 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -391,7 +391,7 @@ __kernel void arithm_bitwise_binary_with_mask_C2_D1 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index ce870b3..5fa2500 100644 (file)
@@ -70,7 +70,7 @@ __kernel void arithm_s_bitwise_binary_C1_D0 (
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -108,7 +108,7 @@ __kernel void arithm_s_bitwise_binary_C1_D1 (
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -146,7 +146,7 @@ __kernel void arithm_s_bitwise_binary_C1_D2 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -181,7 +181,7 @@ __kernel void arithm_s_bitwise_binary_C1_D3 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -293,7 +293,7 @@ __kernel void arithm_s_bitwise_binary_C2_D0 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -331,7 +331,7 @@ __kernel void arithm_s_bitwise_binary_C2_D1 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 9f5bac5..9c6475c 100644 (file)
@@ -71,7 +71,7 @@ __kernel void arithm_s_bitwise_binary_with_mask_C1_D0 (
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -113,7 +113,7 @@ __kernel void arithm_s_bitwise_binary_with_mask_C1_D1 (
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -154,7 +154,7 @@ __kernel void arithm_s_bitwise_binary_with_mask_C1_D2 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -192,7 +192,7 @@ __kernel void arithm_s_bitwise_binary_with_mask_C1_D3 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -318,7 +318,7 @@ __kernel void arithm_s_bitwise_binary_with_mask_C2_D0 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -358,7 +358,7 @@ __kernel void arithm_s_bitwise_binary_with_mask_C2_D1 (
     if (x < cols && y < rows)
     {
         x = x << 1;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 8eb9ece..9905130 100644 (file)
@@ -63,7 +63,7 @@ __kernel void arithm_bitwise_not_D0 (__global uchar *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -106,7 +106,7 @@ __kernel void arithm_bitwise_not_D1 (__global char *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -143,7 +143,7 @@ __kernel void arithm_bitwise_not_D2 (__global ushort *src1, int src1_step, int s
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -181,7 +181,7 @@ __kernel void arithm_bitwise_not_D3 (__global short *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index a660d41..0681c6f 100644 (file)
@@ -65,7 +65,7 @@ __kernel void arithm_compare_eq_D0 (__global uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -120,7 +120,7 @@ __kernel void arithm_compare_ne_D2 (__global ushort *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -174,7 +174,7 @@ __kernel void arithm_compare_eq_D3 (__global short *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -380,7 +380,7 @@ __kernel void arithm_compare_gt_D0 (__global uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -434,7 +434,7 @@ __kernel void arithm_compare_gt_D2 (__global ushort *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -490,7 +490,7 @@ __kernel void arithm_compare_gt_D3 (__global short *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -700,7 +700,7 @@ __kernel void arithm_compare_ge_D0 (__global uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -757,7 +757,7 @@ __kernel void arithm_compare_ge_D2 (__global ushort *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -815,7 +815,7 @@ __kernel void arithm_compare_ge_D3 (__global short *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -869,7 +869,7 @@ __kernel void arithm_compare_ge_D4 (__global int *src1, int src1_step, int src1_
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -921,7 +921,7 @@ __kernel void arithm_compare_ge_D5 (__global float *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -975,7 +975,7 @@ __kernel void arithm_compare_ge_D6 (__global double *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index f012884..d0e862d 100644 (file)
@@ -61,7 +61,7 @@ __kernel void arithm_compare_ne_D0 (__global uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -116,7 +116,7 @@ __kernel void arithm_compare_ne_D2 (__global ushort *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -171,7 +171,7 @@ __kernel void arithm_compare_ne_D3 (__global short *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -380,7 +380,7 @@ __kernel void arithm_compare_lt_D0 (__global uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -435,7 +435,7 @@ __kernel void arithm_compare_lt_D2 (__global ushort *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -491,7 +491,7 @@ __kernel void arithm_compare_lt_D3 (__global short *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -704,7 +704,7 @@ __kernel void arithm_compare_le_D0 (__global uchar *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -760,7 +760,7 @@ __kernel void arithm_compare_le_D2 (__global ushort *src1, int src1_step, int sr
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -816,7 +816,7 @@ __kernel void arithm_compare_le_D3 (__global short *src1, int src1_step, int src
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 896277c..b79da97 100644 (file)
@@ -93,7 +93,7 @@ __kernel void arithm_div_D0 (__global uchar *src1, int src1_step, int src1_offse
     if (coor.x < cols && coor.y < rows)
     {
         coor.x = coor.x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -137,7 +137,7 @@ __kernel void arithm_div_D2 (__global ushort *src1, int src1_step, int src1_offs
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -180,7 +180,7 @@ __kernel void arithm_div_D3 (__global short *src1, int src1_step, int src1_offse
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -298,7 +298,7 @@ __kernel void arithm_s_div_D0 (__global uchar *src, int src_step, int src_offset
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -337,7 +337,7 @@ __kernel void arithm_s_div_D2 (__global ushort *src, int src_step, int src_offse
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -375,7 +375,7 @@ __kernel void arithm_s_div_D3 (__global short *src, int src_step, int src_offset
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index d0e6782..49242d0 100644 (file)
@@ -64,7 +64,7 @@ __kernel void arithm_flip_rows_D0 (__global uchar *src, int src_step, int src_of
     if (x < cols && y < thread_rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -122,7 +122,7 @@ __kernel void arithm_flip_rows_D1 (__global char *src, int src_step, int src_off
     if (x < cols && y < thread_rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -167,7 +167,7 @@ __kernel void arithm_flip_rows_D2 (__global ushort *src, int src_step, int src_o
     if (x < cols && y < thread_rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -212,7 +212,7 @@ __kernel void arithm_flip_rows_D3 (__global short *src, int src_step, int src_of
     if (x < cols && y < thread_rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 40988f5..f853629 100644 (file)
@@ -90,7 +90,7 @@ __kernel void arithm_mul_D0 (__global uchar *src1, int src1_step, int src1_offse
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -138,7 +138,7 @@ __kernel void arithm_mul_D2 (__global ushort *src1, int src1_step, int src1_offs
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
@@ -177,7 +177,7 @@ __kernel void arithm_mul_D3 (__global short *src1, int src1_step, int src1_offse
     if (x < cols && y < rows)
     {
         x = x << 2;
-        
+
 #ifdef dst_align
 #undef dst_align
 #endif
index 8dcb9d2..a05c98e 100644 (file)
@@ -425,7 +425,7 @@ __kernel void BruteForceMatch_RadiusMatch(
         barrier(CLK_LOCAL_MEM_FENCE);
     }
 
-    if (queryIdx < query_rows && trainIdx < train_rows && 
+    if (queryIdx < query_rows && trainIdx < train_rows &&
         convert_float(result) < maxDistance/* && mask(queryIdx, trainIdx)*/)
     {
         unsigned int ind = atom_inc(nMatches + queryIdx);
index 5524041..30d65c5 100644 (file)
@@ -465,7 +465,7 @@ __kernel __attribute__((reqd_work_group_size(LSIZE0,LSIZE1,1))) void row_filter_
         start_addr = mad24(y,dst_step_in_pixel,x);
         dst[start_addr] = sum;
     }
-  
+
 }
 
 
index 512e329..d163ebe 100644 (file)
@@ -231,7 +231,7 @@ __kernel void boxFilter_C1_D0(__global const uchar * restrict src, __global ucha
     {
         tmp_sum += (data[i]);
     }
-    
+
     int index = dst_startY * dst_step + dst_startX + (col-anX)*4;
 
     temp[0][col] = tmp_sum + (data[0]);
index 4873298..003505e 100644 (file)
@@ -46,7 +46,7 @@
 typedef int   sumtype;
 typedef float sqsumtype;
 
-#ifndef STUMP_BASED 
+#ifndef STUMP_BASED
 #define STUMP_BASED 1
 #endif
 
@@ -323,7 +323,7 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
                         int root_offset = 0;
                         for(int lcl_loop=0; lcl_loop<lcl_loops && tempnodecounter<stageinfo.x;)
                         {
-                            __global GpuHidHaarTreeNode* currentnodeptr = 
+                            __global GpuHidHaarTreeNode* currentnodeptr =
                                 nodeptr + (nodecounter + tempnodecounter) * stump_factor + root_offset;
 
                             int4 info1 = *(__global int4*)(&(currentnodeptr->p[0][0]));
index 8507972..23ef723 100644 (file)
@@ -207,7 +207,7 @@ __kernel void gpuRunHaarClassifierCascade_scaled2(
                         - sum[clamp(mad24(info3.y, step, info3.z), 0, max_idx)] -
                                      sum[clamp(mad24(info3.w, step, info3.x), 0, max_idx)]
                         + sum[clamp(mad24(info3.w, step, info3.z), 0, max_idx)]) * w.z;
-                        
+
                         bool passThres = classsum >= nodethreshold;
 
 #if STUMP_BASED
index 0d010f7..49c7096 100644 (file)
@@ -71,15 +71,15 @@ void reduce(volatile __local int* smem, int val, int tid)
     barrier(CLK_LOCAL_MEM_FENCE);
 
     if (tid < 128)
-    { 
+    {
         smem[tid] = val += smem[tid + 128];
-    } 
+    }
     barrier(CLK_LOCAL_MEM_FENCE);
 
     if (tid < 64)
-    { 
+    {
         smem[tid] = val += smem[tid + 64];
-    } 
+    }
     barrier(CLK_LOCAL_MEM_FENCE);
 
     if (tid < 32)
@@ -125,15 +125,15 @@ void reduce(__local volatile int* smem, int val, int tid)
     barrier(CLK_LOCAL_MEM_FENCE);
 
     if (tid < 128)
-    { 
+    {
         smem[tid] = val += smem[tid + 128];
-    } 
+    }
     barrier(CLK_LOCAL_MEM_FENCE);
 
     if (tid < 64)
-    { 
+    {
         smem[tid] = val += smem[tid + 64];
-    } 
+    }
     barrier(CLK_LOCAL_MEM_FENCE);
 
     if (tid < 32)
index 5fa27ff..4f5075d 100644 (file)
 
 __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
 
-inline float ELEM_INT2(image2d_t _eig, int _x, int _y) 
+inline float ELEM_INT2(image2d_t _eig, int _x, int _y)
 {
     return read_imagef(_eig, sampler, (int2)(_x, _y)).x;
 }
 
-inline float ELEM_FLT2(image2d_t _eig, float2 pt) 
+inline float ELEM_FLT2(image2d_t _eig, float2 pt)
 {
     return read_imagef(_eig, sampler, pt).x;
 }
@@ -132,7 +132,7 @@ __kernel
     const int pairDistance = 1 << (stage - passOfStage);
     const int blockWidth   = 2 * pairDistance;
 
-    const int leftId = min( (threadId % pairDistance) 
+    const int leftId = min( (threadId % pairDistance)
                    + (threadId / pairDistance) * blockWidth, count );
 
     const int rightId = min( leftId + pairDistance, count );
@@ -147,7 +147,7 @@ __kernel
 
     float2 greater = compareResult ? leftPt:rightPt;
     float2 lesser  = compareResult ? rightPt:leftPt;
-    
+
     corners[leftId]  = sortOrder ? lesser : greater;
     corners[rightId] = sortOrder ? greater : lesser;
 }
@@ -195,20 +195,20 @@ __kernel
     {
         pt2  = scratch[j];
         val2 = ELEM_FLT2(eig, pt2);
-        if(val2 > val1) 
+        if(val2 > val1)
             pos++;//calculate the rank of this element in this work group
-        else 
+        else
         {
             if(val1 > val2)
                 continue;
-            else 
+            else
             {
                 // val1 and val2 are same
                 same++;
             }
         }
     }
-    for (int j=0; j< same; j++)      
+    for (int j=0; j< same; j++)
         corners[pos + j] = pt1;
 }
 __kernel
@@ -240,15 +240,15 @@ __kernel
         for(int k=0; k<wg; k++)
         {
             pt2  = corners[j*wg + k];
-            val2 = ELEM_FLT2(eig, pt2); 
+            val2 = ELEM_FLT2(eig, pt2);
             if(val1 > val2)
                 break;
             else
             {
-                //Increment only if the value is not the same. 
+                //Increment only if the value is not the same.
                 if( val2 > val1 )
                     pos++;
-                else 
+                else
                     same++;
             }
         }
@@ -257,20 +257,20 @@ __kernel
     for(int k=0; k<remainder; k++)
     {
         pt2  = corners[(numOfGroups-1)*wg + k];
-        val2 = ELEM_FLT2(eig, pt2); 
+        val2 = ELEM_FLT2(eig, pt2);
         if(val1 > val2)
             break;
         else
         {
-            //Don't increment if the value is the same. 
+            //Don't increment if the value is the same.
             //Two elements are same if (*userComp)(jData, iData)  and (*userComp)(iData, jData) are both false
             if(val2 > val1)
                 pos++;
-            else 
+            else
                 same++;
         }
-    }  
-    for (int j=0; j< same; j++)      
+    }
+    for (int j=0; j< same; j++)
         corners[pos + j] = pt1;
 }
 
index 6eee8d3..16971e2 100644 (file)
@@ -183,7 +183,7 @@ __kernel void warpAffineLinear_C1_D0(__global const uchar * restrict src, __glob
         spos1 = src_offset + sy * srcStep + sx + 1;
         spos2 = src_offset + (sy+1) * srcStep + sx;
         spos3 = src_offset + (sy+1) * srcStep + sx + 1;
-        
+
         v0.s0 = scon0.s0 ? src[spos0.s0] : 0;
         v1.s0 = scon1.s0 ? src[spos1.s0] : 0;
         v2.s0 = scon2.s0 ? src[spos2.s0] : 0;
@@ -203,7 +203,7 @@ __kernel void warpAffineLinear_C1_D0(__global const uchar * restrict src, __glob
         v1.s3 = scon1.s3 ? src[spos1.s3] : 0;
         v2.s3 = scon2.s3 ? src[spos2.s3] : 0;
         v3.s3 = scon3.s3 ? src[spos3.s3] : 0;
-      
+
         short4 itab0, itab1, itab2, itab3;
         float4 taby, tabx;
         taby = INTER_SCALE * convert_float4(ay);
index edbe42c..f00e61c 100644 (file)
@@ -116,7 +116,7 @@ __kernel void warpPerspectiveNN_C1_D0(__global uchar const * restrict src, __glo
         sval.s1 = scon.s1 ? src[spos.s1] : 0;
         sval.s2 = scon.s2 ? src[spos.s2] : 0;
         sval.s3 = scon.s3 ? src[spos.s3] : 0;
-        dval = convert_uchar4(dcon) != (uchar4)(0,0,0,0) ? sval : dval;        
+        dval = convert_uchar4(dcon) != (uchar4)(0,0,0,0) ? sval : dval;
         *d = dval;
     }
 }
index fdb440a..3c3eb98 100644 (file)
@@ -43,7 +43,7 @@
 //
 //M*/
 
-#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable 
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
 
 #ifndef N   // number of radices
 #define N 4
@@ -71,14 +71,14 @@ __inline uint convertKey(uint converted_key)
     converted_key ^= mask;
 #elif defined(K_INT)
     const uint SIGN_MASK = 1u << ((sizeof(int) * 8) - 1);
-    converted_key ^= SIGN_MASK;        
+    converted_key ^= SIGN_MASK;
 #else
 
 #endif
     return converted_key;
 }
 
-//FIXME(pengx17): 
+//FIXME(pengx17):
 // exclusive scan, need to be optimized as this is too naive...
 kernel
     void naiveScanAddition(
@@ -108,7 +108,7 @@ kernel
 {
     const int RADIX_T     = N;
     const int RADICES_T   = (1 << RADIX_T);
-    const int NUM_OF_ELEMENTS_PER_WORK_ITEM_T = RADICES_T; 
+    const int NUM_OF_ELEMENTS_PER_WORK_ITEM_T = RADICES_T;
     const int MASK_T      = (1 << RADIX_T) - 1;
     int localBuckets[16] = {0,0,0,0,0,0,0,0,
                             0,0,0,0,0,0,0,0};
index 18e9d41..2e85e5a 100644 (file)
@@ -62,7 +62,7 @@
 #endif
 
 /////////////////////// Bitonic sort ////////////////////////////
-// ported from 
+// ported from
 // https://github.com/HSA-Libraries/Bolt/blob/master/include/bolt/cl/sort_by_key_kernels.cl
 __kernel
     void bitonicSort
@@ -82,7 +82,7 @@ __kernel
     const int pairDistance = 1 << (stage - passOfStage);
     const int blockWidth   = 2 * pairDistance;
 
-    int leftId = min( (threadId % pairDistance) 
+    int leftId = min( (threadId % pairDistance)
                    + (threadId / pairDistance) * blockWidth, count );
 
     int rightId = min( leftId + pairDistance, count );
@@ -90,7 +90,7 @@ __kernel
     int temp;
 
     const V_T lval = vals[leftId];
-    const V_T rval = vals[rightId]; 
+    const V_T rval = vals[rightId];
 
     const K_T lkey = keys[leftId];
     const K_T rkey = keys[rightId];
@@ -142,7 +142,7 @@ __kernel
 
     int offset   = groupID * wg;
     int same     = 0;
-    
+
     vals      += offset;
     keys      += offset;
     n = (groupID == (numOfGroups-1))? (count - wg*(numOfGroups-1)) : wg;
@@ -163,13 +163,13 @@ __kernel
     for (int j=0;j<n;++j)
     {
         key2  = scratch[j];
-        if(my_comp(key2, key1)) 
+        if(my_comp(key2, key1))
             pos++;//calculate the rank of this element in this work group
-        else 
+        else
         {
             if(my_comp(key1, key2))
                 continue;
-            else 
+            else
             {
                 // key1 and key2 are same
                 same++;
@@ -209,15 +209,15 @@ __kernel
     {
         for(int k=0; k<wg; k++)
         {
-            key2 = keys[j*wg + k]; 
+            key2 = keys[j*wg + k];
             if(my_comp(key1, key2))
                 break;
             else
             {
-                //Increment only if the value is not the same. 
+                //Increment only if the value is not the same.
                 if(my_comp(key2, key1))
                     pos++;
-                else 
+                else
                     same++;
             }
         }
@@ -225,18 +225,18 @@ __kernel
 
     for(int k=0; k<remainder; k++)
     {
-        key2 = keys[(numOfGroups-1)*wg + k]; 
+        key2 = keys[(numOfGroups-1)*wg + k];
         if(my_comp(key1, key2))
             break;
         else
         {
-            //Don't increment if the value is the same. 
+            //Don't increment if the value is the same.
             if(my_comp(key2, key1))
                 pos++;
-            else 
+            else
                 same++;
         }
-    }  
+    }
     for (int j=0; j< same; j++)
     {
         vals[pos + j] = val1;
index 0363227..da2285e 100644 (file)
@@ -56,7 +56,7 @@
 // Use pre-computed gaussian and interp_weight lookup tables
 __kernel void compute_hists_lut_kernel(
     const int cblock_stride_x, const int cblock_stride_y,
-    const int cnbins, const int cblock_hist_size, const int img_block_width, 
+    const int cnbins, const int cblock_hist_size, const int img_block_width,
     const int blocks_in_group, const int blocks_total,
     const int grad_quadstep, const int qangle_step,
     __global const float* grad, __global const uchar* qangle,
@@ -76,20 +76,20 @@ __kernel void compute_hists_lut_kernel(
     const int cell_y = lidY;
     const int cell_thread_x = lidX - cell_x * 12;
 
-    __local float* hists = smem + lp * cnbins * (CELLS_PER_BLOCK_X * 
+    __local float* hists = smem + lp * cnbins * (CELLS_PER_BLOCK_X *
         CELLS_PER_BLOCK_Y * 12 + CELLS_PER_BLOCK_X * CELLS_PER_BLOCK_Y);
-    __local float* final_hist = hists + cnbins * 
+    __local float* final_hist = hists + cnbins *
         (CELLS_PER_BLOCK_X * CELLS_PER_BLOCK_Y * 12);
 
     const int offset_x = gidX * cblock_stride_x + (cell_x << 2) + cell_thread_x;
     const int offset_y = gidY * cblock_stride_y + (cell_y << 2);
 
-    __global const float* grad_ptr = (gid < blocks_total) ? 
+    __global const float* grad_ptr = (gid < blocks_total) ?
         grad + offset_y * grad_quadstep + (offset_x << 1) : grad;
     __global const uchar* qangle_ptr = (gid < blocks_total) ?
         qangle + offset_y * qangle_step + (offset_x << 1) : qangle;
 
-    __local float* hist = hists + 12 * (cell_y * CELLS_PER_BLOCK_Y + cell_x) + 
+    __local float* hist = hists + 12 * (cell_y * CELLS_PER_BLOCK_Y + cell_x) +
         cell_thread_x;
     for (int bin_id = 0; bin_id < cnbins; ++bin_id)
         hist[bin_id * 48] = 0.f;
@@ -130,7 +130,7 @@ __kernel void compute_hists_lut_kernel(
         barrier(CLK_LOCAL_MEM_FENCE);
 #endif
         if (cell_thread_x == 0)
-            final_hist[(cell_x * 2 + cell_y) * cnbins + bin_id] = 
+            final_hist[(cell_x * 2 + cell_y) * cnbins + bin_id] =
                 hist_[0] + hist_[1] + hist_[2];
     }
 #ifdef CPU
@@ -140,7 +140,7 @@ __kernel void compute_hists_lut_kernel(
     int tid = (cell_y * CELLS_PER_BLOCK_Y + cell_x) * 12 + cell_thread_x;
     if ((tid < cblock_hist_size) && (gid < blocks_total))
     {
-        __global float* block_hist = block_hists + 
+        __global float* block_hist = block_hists +
             (gidY * img_block_width + gidX) * cblock_hist_size;
         block_hist[tid] = final_hist[tid];
     }
@@ -149,7 +149,7 @@ __kernel void compute_hists_lut_kernel(
 //-------------------------------------------------------------
 //  Normalization of histograms via L2Hys_norm
 //  optimized for the case of 9 bins
-__kernel void normalize_hists_36_kernel(__global float* block_hists, 
+__kernel void normalize_hists_36_kernel(__global float* block_hists,
                                         const float threshold, __local float *squares)
 {
     const int tid = get_local_id(0);
@@ -205,24 +205,24 @@ float reduce_smem(volatile __local float* smem, int size)
     unsigned int tid = get_local_id(0);
     float sum = smem[tid];
 
-    if (size >= 512) { if (tid < 256) smem[tid] = sum = sum + smem[tid + 256]; 
+    if (size >= 512) { if (tid < 256) smem[tid] = sum = sum + smem[tid + 256];
         barrier(CLK_LOCAL_MEM_FENCE); }
-    if (size >= 256) { if (tid < 128) smem[tid] = sum = sum + smem[tid + 128]; 
+    if (size >= 256) { if (tid < 128) smem[tid] = sum = sum + smem[tid + 128];
         barrier(CLK_LOCAL_MEM_FENCE); }
-    if (size >= 128) { if (tid < 64) smem[tid] = sum = sum + smem[tid + 64]; 
+    if (size >= 128) { if (tid < 64) smem[tid] = sum = sum + smem[tid + 64];
         barrier(CLK_LOCAL_MEM_FENCE); }
 #ifdef CPU
-    if (size >= 64) { if (tid < 32) smem[tid] = sum = sum + smem[tid + 32]; 
+    if (size >= 64) { if (tid < 32) smem[tid] = sum = sum + smem[tid + 32];
         barrier(CLK_LOCAL_MEM_FENCE); }
-    if (size >= 32) { if (tid < 16) smem[tid] = sum = sum + smem[tid + 16]; 
-        barrier(CLK_LOCAL_MEM_FENCE); }        
-    if (size >= 16) { if (tid < 8) smem[tid] = sum = sum + smem[tid + 8]; 
+    if (size >= 32) { if (tid < 16) smem[tid] = sum = sum + smem[tid + 16];
         barrier(CLK_LOCAL_MEM_FENCE); }
-    if (size >= 8) { if (tid < 4) smem[tid] = sum = sum + smem[tid + 4]; 
+    if (size >= 16) { if (tid < 8) smem[tid] = sum = sum + smem[tid + 8];
         barrier(CLK_LOCAL_MEM_FENCE); }
-    if (size >= 4) { if (tid < 2) smem[tid] = sum = sum + smem[tid + 2]; 
-        barrier(CLK_LOCAL_MEM_FENCE); }                
-    if (size >= 2) { if (tid < 1) smem[tid] = sum = sum + smem[tid + 1]; 
+    if (size >= 8) { if (tid < 4) smem[tid] = sum = sum + smem[tid + 4];
+        barrier(CLK_LOCAL_MEM_FENCE); }
+    if (size >= 4) { if (tid < 2) smem[tid] = sum = sum + smem[tid + 2];
+        barrier(CLK_LOCAL_MEM_FENCE); }
+    if (size >= 2) { if (tid < 1) smem[tid] = sum = sum + smem[tid + 1];
         barrier(CLK_LOCAL_MEM_FENCE); }
 #else
     if (tid < 32)
@@ -251,7 +251,7 @@ __kernel void normalize_hists_kernel(
     const int gidX = get_group_id(0);
     const int gidY = get_group_id(1);
 
-    __global float* hist = block_hists + (gidY * img_block_width + gidX) * 
+    __global float* hist = block_hists + (gidY * img_block_width + gidX) *
         block_hist_size + tid;
 
     float elem = 0.f;
@@ -292,14 +292,14 @@ __kernel void classify_hists_180_kernel(
     const int gidX = get_group_id(0);
     const int gidY = get_group_id(1);
 
-    __global const float* hist = block_hists + (gidY * win_block_stride_y * 
+    __global const float* hist = block_hists + (gidY * win_block_stride_y *
         img_block_width + gidX * win_block_stride_x) * cblock_hist_size;
 
     float product = 0.f;
 
     for (int i = 0; i < cdescr_height; i++)
     {
-        product += coefs[i * cdescr_width + tid] * 
+        product += coefs[i * cdescr_width + tid] *
             hist[i * img_block_width * cblock_hist_size + tid];
     }
 
@@ -365,14 +365,14 @@ __kernel void classify_hists_252_kernel(
     const int gidX = get_group_id(0);
     const int gidY = get_group_id(1);
 
-    __global const float* hist = block_hists + (gidY * win_block_stride_y * 
+    __global const float* hist = block_hists + (gidY * win_block_stride_y *
         img_block_width + gidX * win_block_stride_x) * cblock_hist_size;
 
     float product = 0.f;
     if (tid < cdescr_width)
     {
         for (int i = 0; i < cdescr_height; i++)
-            product += coefs[i * cdescr_width + tid] * 
+            product += coefs[i * cdescr_width + tid] *
                 hist[i * img_block_width * cblock_hist_size + tid];
     }
 
@@ -402,7 +402,7 @@ __kernel void classify_hists_252_kernel(
        barrier(CLK_LOCAL_MEM_FENCE);
 #else
     if (tid < 32)
-    {      
+    {
         smem[tid] = product = product + smem[tid + 32];
 #if WAVE_SIZE < 32
     } barrier(CLK_LOCAL_MEM_FENCE);
@@ -434,7 +434,7 @@ __kernel void classify_hists_kernel(
     const int gidX = get_group_id(0);
     const int gidY = get_group_id(1);
 
-    __global const float* hist = block_hists + (gidY * win_block_stride_y * 
+    __global const float* hist = block_hists + (gidY * win_block_stride_y *
         img_block_width + gidX * win_block_stride_x) * cblock_hist_size;
 
     float product = 0.f;
@@ -442,7 +442,7 @@ __kernel void classify_hists_kernel(
     {
         int offset_y = i / cdescr_width;
         int offset_x = i - offset_y * cdescr_width;
-        product += coefs[i] * 
+        product += coefs[i] *
             hist[offset_y * img_block_width * cblock_hist_size + offset_x];
     }
 
@@ -472,7 +472,7 @@ __kernel void classify_hists_kernel(
        barrier(CLK_LOCAL_MEM_FENCE);
 #else
     if (tid < 32)
-    {       
+    {
         smem[tid] = product = product + smem[tid + 32];
 #if WAVE_SIZE < 32
     } barrier(CLK_LOCAL_MEM_FENCE);
@@ -494,8 +494,8 @@ __kernel void classify_hists_kernel(
 // Extract descriptors
 
 __kernel void extract_descrs_by_rows_kernel(
-    const int cblock_hist_size, const int descriptors_quadstep, 
-    const int cdescr_size, const int cdescr_width, const int img_block_width, 
+    const int cblock_hist_size, const int descriptors_quadstep,
+    const int cdescr_size, const int cdescr_width, const int img_block_width,
     const int win_block_stride_x, const int win_block_stride_y,
     __global const float* block_hists, __global float* descriptors)
 {
@@ -504,11 +504,11 @@ __kernel void extract_descrs_by_rows_kernel(
     int gidY = get_group_id(1);
 
     // Get left top corner of the window in src
-    __global const float* hist = block_hists + (gidY * win_block_stride_y * 
+    __global const float* hist = block_hists + (gidY * win_block_stride_y *
         img_block_width + gidX * win_block_stride_x) * cblock_hist_size;
 
     // Get left top corner of the window in dst
-    __global float* descriptor = descriptors + 
+    __global float* descriptor = descriptors +
         (gidY * get_num_groups(0) + gidX) * descriptors_quadstep;
 
     // Copy elements from src to dst
@@ -522,8 +522,8 @@ __kernel void extract_descrs_by_rows_kernel(
 
 __kernel void extract_descrs_by_cols_kernel(
     const int cblock_hist_size, const int descriptors_quadstep, const int cdescr_size,
-    const int cnblocks_win_x, const int cnblocks_win_y, const int img_block_width, 
-    const int win_block_stride_x, const int win_block_stride_y, 
+    const int cnblocks_win_x, const int cnblocks_win_y, const int img_block_width,
+    const int win_block_stride_x, const int win_block_stride_y,
     __global const float* block_hists, __global float* descriptors)
 {
     int tid = get_local_id(0);
@@ -531,11 +531,11 @@ __kernel void extract_descrs_by_cols_kernel(
     int gidY = get_group_id(1);
 
     // Get left top corner of the window in src
-    __global const float* hist = block_hists +  (gidY * win_block_stride_y * 
+    __global const float* hist = block_hists +  (gidY * win_block_stride_y *
         img_block_width + gidX * win_block_stride_x) * cblock_hist_size;
 
     // Get left top corner of the window in dst
-    __global float* descriptor = descriptors + 
+    __global float* descriptor = descriptors +
         (gidY * get_num_groups(0) + gidX) * descriptors_quadstep;
 
     // Copy elements from src to dst
@@ -547,7 +547,7 @@ __kernel void extract_descrs_by_cols_kernel(
         int y = block_idx / cnblocks_win_x;
         int x = block_idx - y * cnblocks_win_x;
 
-        descriptor[(x * cnblocks_win_y + y) * cblock_hist_size + idx_in_block] = 
+        descriptor[(x * cnblocks_win_y + y) * cblock_hist_size + idx_in_block] =
             hist[(y * img_block_width  + x) * cblock_hist_size + idx_in_block];
     }
 }
@@ -556,7 +556,7 @@ __kernel void extract_descrs_by_cols_kernel(
 // Gradients computation
 
 __kernel void compute_gradients_8UC4_kernel(
-    const int height, const int width, 
+    const int height, const int width,
     const int img_step, const int grad_quadstep, const int qangle_step,
     const __global uchar4 * img, __global float * grad, __global uchar * qangle,
     const float angle_scale, const char correct_gamma, const int cnbins)
@@ -600,9 +600,9 @@ __kernel void compute_gradients_8UC4_kernel(
     barrier(CLK_LOCAL_MEM_FENCE);
     if (x < width)
     {
-        float3 a = (float3) (sh_row[tid], sh_row[tid + (NTHREADS + 2)], 
+        float3 a = (float3) (sh_row[tid], sh_row[tid + (NTHREADS + 2)],
             sh_row[tid + 2 * (NTHREADS + 2)]);
-        float3 b = (float3) (sh_row[tid + 2], sh_row[tid + 2 + (NTHREADS + 2)], 
+        float3 b = (float3) (sh_row[tid + 2], sh_row[tid + 2 + (NTHREADS + 2)],
             sh_row[tid + 2 + 2 * (NTHREADS + 2)]);
 
         float3 dx;
@@ -659,7 +659,7 @@ __kernel void compute_gradients_8UC4_kernel(
 }
 
 __kernel void compute_gradients_8UC1_kernel(
-    const int height, const int width, 
+    const int height, const int width,
     const int img_step, const int grad_quadstep, const int qangle_step,
     __global const uchar * img, __global float * grad, __global uchar * qangle,
     const float angle_scale, const char correct_gamma, const int cnbins)
@@ -717,4 +717,4 @@ __kernel void compute_gradients_8UC1_kernel(
         grad[ (gidY * grad_quadstep + x) << 1 ]       = mag * (1.f - ang);
         grad[ ((gidY * grad_quadstep + x) << 1) + 1 ]   = mag * ang;
     }
-}
\ No newline at end of file
+}
index f1b9588..56f445e 100644 (file)
@@ -190,7 +190,7 @@ __kernel void stereoKernel(__global unsigned char *left, __global unsigned char
         {
             int idx1 = y_tex * img_step + x_tex;
             int idx2 = min(y_tex + ((radius << 1) + 1), cheight - 1) * img_step + x_tex;
-            
+
             barrier(CLK_LOCAL_MEM_FENCE);
 
             StepDown(idx1, idx2, left, right, d, col_ssd);
index 8a71629..1d523e7 100644 (file)
@@ -67,7 +67,7 @@
 /////////////////////////////////////////////////////////////
 T saturate_cast(float v){
 #ifdef T_SHORT
-    return convert_short_sat_rte(v); 
+    return convert_short_sat_rte(v);
 #else
     return v;
 #endif
@@ -75,7 +75,7 @@ T saturate_cast(float v){
 
 T4 saturate_cast4(float4 v){
 #ifdef T_SHORT
-    return convert_short4_sat_rte(v); 
+    return convert_short4_sat_rte(v);
 #else
     return v;
 #endif
@@ -96,7 +96,7 @@ typedef struct
 
 inline float pix_diff_1(const uchar4 l, __global const uchar *rs)
 {
-    return abs((int)(l.x) - *rs); 
+    return abs((int)(l.x) - *rs);
 }
 
 float pix_diff_4(const uchar4 l, __global const uchar *rs)
@@ -174,8 +174,8 @@ __kernel void comp_data(__global uchar *left,  int left_rows,  int left_cols,  i
 ///////////////////////////////////////////////////////////////
 //////////////////////// data step down ///////////////////////
 ///////////////////////////////////////////////////////////////
-__kernel void data_step_down(__global T *src, int src_rows, 
-                             __global T *dst, int dst_rows, int dst_cols, 
+__kernel void data_step_down(__global T *src, int src_rows,
+                             __global T *dst, int dst_rows, int dst_cols,
                              int src_step, int dst_step,
                              int cndisp)
 {
@@ -289,7 +289,7 @@ void message(__global T *us_, __global T *ds_, __global T *ls_, __global T *rs_,
     }
 
     minimum += cmax_disc_term;
-    
+
     float4 sum = 0;
     prev = convert_float4(t_dst[CNDISP - 1]);
     for (int disp = CNDISP - 2; disp >= 0; disp--)
@@ -322,7 +322,7 @@ void message(__global T *us_, __global T *ds_, __global T *ls_, __global T *rs_,
 __kernel void one_iteration(__global T *u,    int u_step,
                             __global T *data, int data_step,
                             __global T *d,    __global T *l, __global T *r,
-                            int t, int cols, int rows, 
+                            int t, int cols, int rows,
                             float cmax_disc_term, float cdisc_single_jump)
 {
     const int y = get_global_id(1);
index ea7af62..89f2bb8 100644 (file)
@@ -129,7 +129,7 @@ __kernel void get_first_k_initial_global_1(__global  float *data_cost_selected_,
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////get_first_k_initial_local////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
-__kernel void get_first_k_initial_local_0(__global  short *data_cost_selected_, __global short *selected_disp_pyr, 
+__kernel void get_first_k_initial_local_0(__global  short *data_cost_selected_, __global short *selected_disp_pyr,
     __global  short *ctemp,int h, int w, int nr_plane,
     int cmsg_step1, int cdisp_step1, int cndisp)
 {
@@ -187,7 +187,7 @@ __kernel void get_first_k_initial_local_0(__global  short *data_cost_selected_,
     }
 }
 
-__kernel void get_first_k_initial_local_1(__global float *data_cost_selected_, __global float *selected_disp_pyr, 
+__kernel void get_first_k_initial_local_1(__global float *data_cost_selected_, __global float *selected_disp_pyr,
     __global float *ctemp,int h, int w, int nr_plane,
     int cmsg_step1,  int cdisp_step1, int cndisp)
 {
@@ -257,20 +257,20 @@ float compute_3(__global uchar* left, __global uchar* right,
 
     return fmin(cdata_weight * (tr + tg + tb), cdata_weight * cmax_data_term);
 }
-float compute_1(__global uchar* left, __global uchar* right, 
+float compute_1(__global uchar* left, __global uchar* right,
     float cdata_weight,  float cmax_data_term)
 {
     return fmin(cdata_weight * abs((int)*left - (int)*right), cdata_weight * cmax_data_term);
 }
 short round_short(float v){
-    return convert_short_sat_rte(v); 
+    return convert_short_sat_rte(v);
 }
 ///////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////init_data_cost///////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////
-__kernel void init_data_cost_0(__global short *ctemp, __global uchar *cleft, __global uchar *cright, 
+__kernel void init_data_cost_0(__global short *ctemp, __global uchar *cleft, __global uchar *cright,
     int h, int w, int level, int channels,
-    int cmsg_step1, float cdata_weight, float cmax_data_term, int cdisp_step1, 
+    int cmsg_step1, float cdata_weight, float cmax_data_term, int cdisp_step1,
     int cth, int cimg_step, int cndisp)
 {
     int x = get_global_id(0);
@@ -312,9 +312,9 @@ __kernel void init_data_cost_0(__global short *ctemp, __global uchar *cleft, __g
         }
     }
 }
-__kernel void init_data_cost_1(__global float *ctemp, __global uchar *cleft, __global uchar *cright, 
+__kernel void init_data_cost_1(__global float *ctemp, __global uchar *cleft, __global uchar *cright,
     int h, int w, int level, int channels,
-    int cmsg_step1, float cdata_weight, float cmax_data_term, int cdisp_step1, 
+    int cmsg_step1, float cdata_weight, float cmax_data_term, int cdisp_step1,
     int cth, int cimg_step, int cndisp)
 {
     int x = get_global_id(0);
@@ -361,13 +361,13 @@ __kernel void init_data_cost_1(__global float *ctemp, __global uchar *cleft, __g
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 __kernel void init_data_cost_reduce_0(__global short *ctemp, __global uchar *cleft, __global uchar *cright,
     __local float *smem, int level, int rows, int cols, int h, int winsz, int channels,
-    int cndisp,int cimg_step, float cdata_weight, float cmax_data_term, int cth, 
+    int cndisp,int cimg_step, float cdata_weight, float cmax_data_term, int cth,
     int cdisp_step1, int cmsg_step1)
 {
     int x_out = get_group_id(0);
     int y_out = get_group_id(1) % h;
     //int d = (blockIdx.y / h) * blockDim.z + threadIdx.z;
-    int d = (get_group_id(1) / h ) * get_local_size(2) + get_local_id(2); 
+    int d = (get_group_id(1) / h ) * get_local_size(2) + get_local_id(2);
 
     int tid = get_local_id(0);
 
@@ -411,39 +411,39 @@ __kernel void init_data_cost_reduce_0(__global short *ctemp, __global uchar *cle
     if(d < cndisp)
     {
         __local float* dline = smem + winsz * get_local_id(2);
-        if (winsz >= 256) 
+        if (winsz >= 256)
         {
-            if (tid < 128) 
-                dline[tid] += dline[tid + 128]; 
+            if (tid < 128)
+                dline[tid] += dline[tid + 128];
         }
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local float* dline = smem + winsz * get_local_id(2);
-        if (winsz >= 128) 
+        if (winsz >= 128)
         {
-            if (tid <  64) 
-                dline[tid] += dline[tid + 64]; 
+            if (tid <  64)
+                dline[tid] += dline[tid + 64];
         }
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 64) 
-            if (tid < 32) 
+        if (winsz >= 64)
+            if (tid < 32)
                 vdline[tid] += vdline[tid + 32];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 32) 
-            if (tid < 16) 
+        if (winsz >= 32)
+            if (tid < 16)
                 vdline[tid] += vdline[tid + 16];
     }
     barrier(CLK_LOCAL_MEM_FENCE);
@@ -452,7 +452,7 @@ __kernel void init_data_cost_reduce_0(__global short *ctemp, __global uchar *cle
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
         if (winsz >= 16)
-            if (tid <  8) 
+            if (tid <  8)
                 vdline[tid] += vdline[tid + 8];
     }
     barrier(CLK_LOCAL_MEM_FENCE);
@@ -461,7 +461,7 @@ __kernel void init_data_cost_reduce_0(__global short *ctemp, __global uchar *cle
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
         if (winsz >= 8)
-            if (tid <  4) 
+            if (tid <  4)
                 vdline[tid] += vdline[tid + 4];
     }
     barrier(CLK_LOCAL_MEM_FENCE);
@@ -470,7 +470,7 @@ __kernel void init_data_cost_reduce_0(__global short *ctemp, __global uchar *cle
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
         if (winsz >= 4)
-            if (tid <  2) 
+            if (tid <  2)
                 vdline[tid] += vdline[tid + 2];
     }
     barrier(CLK_LOCAL_MEM_FENCE);
@@ -479,7 +479,7 @@ __kernel void init_data_cost_reduce_0(__global short *ctemp, __global uchar *cle
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
         if (winsz >= 2)
-            if (tid <  1) 
+            if (tid <  1)
                 vdline[tid] += vdline[tid + 1];
     }
     barrier(CLK_LOCAL_MEM_FENCE);
@@ -500,7 +500,7 @@ __kernel void init_data_cost_reduce_1(__global float *ctemp, __global uchar *cle
 {
     int x_out = get_group_id(0);
     int y_out = get_group_id(1) % h;
-    int d = (get_group_id(1) / h ) * get_local_size(2) + get_local_id(2); 
+    int d = (get_group_id(1) / h ) * get_local_size(2) + get_local_id(2);
 
     int tid = get_local_id(0);
 
@@ -545,74 +545,74 @@ __kernel void init_data_cost_reduce_1(__global float *ctemp, __global uchar *cle
     if(d < cndisp)
     {
         __local float* dline = smem + winsz * get_local_id(2);
-        if (winsz >= 256) 
-            if (tid < 128) 
-                dline[tid] += dline[tid + 128]; 
+        if (winsz >= 256)
+            if (tid < 128)
+                dline[tid] += dline[tid + 128];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local float* dline = smem + winsz * get_local_id(2);
-        if (winsz >= 128) 
-            if (tid < 64) 
-                dline[tid] += dline[tid + 64]; 
+        if (winsz >= 128)
+            if (tid < 64)
+                dline[tid] += dline[tid + 64];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 64) 
-            if (tid < 32) 
-                vdline[tid] += vdline[tid + 32]; 
+        if (winsz >= 64)
+            if (tid < 32)
+                vdline[tid] += vdline[tid + 32];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 32) 
-            if (tid < 16) 
-                vdline[tid] += vdline[tid + 16]; 
+        if (winsz >= 32)
+            if (tid < 16)
+                vdline[tid] += vdline[tid + 16];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 16) 
-            if (tid < 8) 
-                vdline[tid] += vdline[tid + 8]; 
+        if (winsz >= 16)
+            if (tid < 8)
+                vdline[tid] += vdline[tid + 8];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 8) 
-            if (tid < 4) 
-                vdline[tid] += vdline[tid + 4]; 
+        if (winsz >= 8)
+            if (tid < 4)
+                vdline[tid] += vdline[tid + 4];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 4) 
-            if (tid < 2) 
-                vdline[tid] += vdline[tid + 2]; 
+        if (winsz >= 4)
+            if (tid < 2)
+                vdline[tid] += vdline[tid + 2];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 2) 
-            if (tid < 1) 
-                vdline[tid] += vdline[tid + 1]; 
+        if (winsz >= 2)
+            if (tid < 1)
+                vdline[tid] += vdline[tid + 1];
     }
-    barrier(CLK_LOCAL_MEM_FENCE); 
+    barrier(CLK_LOCAL_MEM_FENCE);
 
     if(d < cndisp)
     {
@@ -626,10 +626,10 @@ __kernel void init_data_cost_reduce_1(__global float *ctemp, __global uchar *cle
 ///////////////////////////////////////////////////////////////
 ////////////////////// compute data cost //////////////////////
 ///////////////////////////////////////////////////////////////
-__kernel void compute_data_cost_0(__global const short *selected_disp_pyr, __global short *data_cost_, 
+__kernel void compute_data_cost_0(__global const short *selected_disp_pyr, __global short *data_cost_,
     __global uchar *cleft, __global uchar *cright,
     int h, int w, int level, int nr_plane, int channels,
-    int cmsg_step1, int cmsg_step2, int cdisp_step1, int cdisp_step2, float cdata_weight, 
+    int cmsg_step1, int cmsg_step2, int cdisp_step1, int cdisp_step2, float cdata_weight,
     float cmax_data_term, int cimg_step, int cth)
 {
 
@@ -676,10 +676,10 @@ __kernel void compute_data_cost_0(__global const short *selected_disp_pyr, __glo
         }
     }
 }
-__kernel void compute_data_cost_1(__global const float *selected_disp_pyr, __global float *data_cost_, 
+__kernel void compute_data_cost_1(__global const float *selected_disp_pyr, __global float *data_cost_,
     __global uchar *cleft, __global uchar *cright,
     int h, int w, int level, int nr_plane, int channels,
-    int cmsg_step1, int cmsg_step2, int cdisp_step1, int cdisp_step2, float cdata_weight, 
+    int cmsg_step1, int cmsg_step2, int cdisp_step1, int cdisp_step2, float cdata_weight,
     float cmax_data_term, int cimg_step, int cth)
 {
 
@@ -728,11 +728,11 @@ __kernel void compute_data_cost_1(__global const float *selected_disp_pyr, __glo
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////compute_data_cost_reduce//////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
-__kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr, __global short* data_cost_, 
+__kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr, __global short* data_cost_,
     __global uchar *cleft, __global uchar *cright,__local float *smem,
-    int level, int rows, int cols, int h, int nr_plane, 
+    int level, int rows, int cols, int h, int nr_plane,
     int channels, int winsz,
-    int cmsg_step1, int cmsg_step2, int cdisp_step1, int cdisp_step2, 
+    int cmsg_step1, int cmsg_step2, int cdisp_step1, int cdisp_step2,
     float cdata_weight,  float cmax_data_term, int cimg_step,int cth)
 
 {
@@ -788,9 +788,9 @@ __kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 64) 
+        if (winsz >= 64)
         {
-            if (tid < 32) 
+            if (tid < 32)
                 vdline[tid] += vdline[tid + 32];
         }
     }
@@ -799,9 +799,9 @@ __kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 32) 
+        if (winsz >= 32)
         {
-            if (tid < 16) 
+            if (tid < 16)
                 vdline[tid] += vdline[tid + 16];
         }
     }
@@ -810,9 +810,9 @@ __kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 16) 
+        if (winsz >= 16)
         {
-            if (tid < 8) 
+            if (tid < 8)
                 vdline[tid] += vdline[tid + 8];
         }
     }
@@ -821,9 +821,9 @@ __kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 8) 
+        if (winsz >= 8)
         {
-            if (tid < 4) 
+            if (tid < 4)
                 vdline[tid] += vdline[tid + 4];
         }
     }
@@ -832,9 +832,9 @@ __kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 4) 
+        if (winsz >= 4)
         {
-            if (tid < 2) 
+            if (tid < 2)
                 vdline[tid] += vdline[tid + 2];
         }
     }
@@ -843,9 +843,9 @@ __kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 2) 
+        if (winsz >= 2)
         {
-            if (tid < 1) 
+            if (tid < 1)
                 vdline[tid] += vdline[tid + 1];
         }
     }
@@ -859,11 +859,11 @@ __kernel void compute_data_cost_reduce_0(__global const short* selected_disp_pyr
     }
 }
 
-__kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr, __global float *data_cost_, 
+__kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr, __global float *data_cost_,
     __global uchar *cleft, __global uchar *cright, __local float *smem,
-    int level, int rows, int cols, int h, int nr_plane, 
+    int level, int rows, int cols, int h, int nr_plane,
     int channels, int winsz,
-    int cmsg_step1, int cmsg_step2, int cdisp_step1,int cdisp_step2, float cdata_weight, 
+    int cmsg_step1, int cmsg_step2, int cdisp_step1,int cdisp_step2, float cdata_weight,
     float cmax_data_term, int cimg_step, int cth)
 
 {
@@ -918,21 +918,21 @@ __kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 64) 
+        if (winsz >= 64)
         {
-            if (tid < 32) 
+            if (tid < 32)
                 vdline[tid] += vdline[tid + 32];
         }
     }
     barrier(CLK_LOCAL_MEM_FENCE);
 
 
-    if(d < nr_plane)   
+    if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 32) 
+        if (winsz >= 32)
         {
-            if (tid < 16) 
+            if (tid < 16)
                 vdline[tid] += vdline[tid + 16];
         }
     }
@@ -941,9 +941,9 @@ __kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >= 16) 
+        if (winsz >= 16)
         {
-            if (tid <  8) 
+            if (tid <  8)
                 vdline[tid] += vdline[tid + 8];
         }
     }
@@ -952,9 +952,9 @@ __kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >=  8) 
+        if (winsz >=  8)
         {
-            if (tid <  4) 
+            if (tid <  4)
                 vdline[tid] += vdline[tid + 4];
         }
     }
@@ -963,9 +963,9 @@ __kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >=  4) 
+        if (winsz >=  4)
         {
-            if (tid <  2) 
+            if (tid <  2)
                 vdline[tid] += vdline[tid + 2];
         }
     }
@@ -974,9 +974,9 @@ __kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr
     if(d < nr_plane)
     {
         __local volatile float* vdline = smem + winsz * get_local_id(2);
-        if (winsz >=  2) 
+        if (winsz >=  2)
         {
-            if (tid <  1) 
+            if (tid <  1)
                 vdline[tid] += vdline[tid + 1];
         }
     }
@@ -993,11 +993,11 @@ __kernel void compute_data_cost_reduce_1(__global const float *selected_disp_pyr
 ///////////////////////////////////////////////////////////////
 //////////////////////// init message /////////////////////////
 ///////////////////////////////////////////////////////////////
-void get_first_k_element_increase_0(__global short* u_new, __global short *d_new, __global short *l_new, 
-    __global short *r_new, __global const short *u_cur, __global const short *d_cur, 
-    __global const short *l_cur, __global const short *r_cur, 
-    __global short *data_cost_selected, __global short *disparity_selected_new, 
-    __global short *data_cost_new, __global const short* data_cost_cur, 
+void get_first_k_element_increase_0(__global short* u_new, __global short *d_new, __global short *l_new,
+    __global short *r_new, __global const short *u_cur, __global const short *d_cur,
+    __global const short *l_cur, __global const short *r_cur,
+    __global short *data_cost_selected, __global short *disparity_selected_new,
+    __global short *data_cost_new, __global const short* data_cost_cur,
     __global const short *disparity_selected_cur,
     int nr_plane, int nr_plane2,
     int cdisp_step1, int cdisp_step2)
@@ -1027,11 +1027,11 @@ void get_first_k_element_increase_0(__global short* u_new, __global short *d_new
         data_cost_new[id * cdisp_step1] = SHRT_MAX;
     }
 }
-void get_first_k_element_increase_1(__global float *u_new, __global float *d_new, __global float *l_new, 
-    __global float *r_new, __global const float *u_cur, __global const float *d_cur, 
+void get_first_k_element_increase_1(__global float *u_new, __global float *d_new, __global float *l_new,
+    __global float *r_new, __global const float *u_cur, __global const float *d_cur,
     __global const float *l_cur, __global const float *r_cur,
-    __global float *data_cost_selected, __global float *disparity_selected_new, 
-    __global float *data_cost_new, __global const float *data_cost_cur, 
+    __global float *data_cost_selected, __global float *disparity_selected_new,
+    __global float *data_cost_new, __global const float *data_cost_cur,
     __global const float *disparity_selected_cur,
     int nr_plane, int nr_plane2,
     int cdisp_step1, int cdisp_step2)
@@ -1057,13 +1057,13 @@ void get_first_k_element_increase_1(__global float *u_new, __global float *d_new
         u_new[i * cdisp_step1] = u_cur[id * cdisp_step2];
         d_new[i * cdisp_step1] = d_cur[id * cdisp_step2];
         l_new[i * cdisp_step1] = l_cur[id * cdisp_step2];
-        r_new[i * cdisp_step1] = r_cur[id * cdisp_step2];   
+        r_new[i * cdisp_step1] = r_cur[id * cdisp_step2];
         data_cost_new[id * cdisp_step1] = FLT_MAX;
 
     }
 }
 __kernel void init_message_0(__global short *u_new_, __global short *d_new_, __global short *l_new_,
-    __global short *r_new_, __global  short *u_cur_, __global const short *d_cur_, 
+    __global short *r_new_, __global  short *u_cur_, __global const short *d_cur_,
     __global const short *l_cur_, __global const short *r_cur_, __global short *ctemp,
     __global short *selected_disp_pyr_new, __global const short *selected_disp_pyr_cur,
     __global short *data_cost_selected_, __global const short *data_cost_,
@@ -1113,7 +1113,7 @@ __kernel void init_message_0(__global short *u_new_, __global short *d_new_, __g
     }
 }
 __kernel void init_message_1(__global float *u_new_, __global float *d_new_, __global float *l_new_,
-    __global float *r_new_, __global const float *u_cur_, __global const float *d_cur_, 
+    __global float *r_new_, __global const float *u_cur_, __global const float *d_cur_,
     __global const float *l_cur_, __global const float *r_cur_, __global float *ctemp,
     __global float *selected_disp_pyr_new, __global const float *selected_disp_pyr_cur,
     __global float *data_cost_selected_, __global const float *data_cost_,
@@ -1176,28 +1176,28 @@ __kernel void init_message_1(__global float *u_new_, __global float *d_new_, __g
                     id = j;
                 }
             }
-            data_cost_selected[i * cdisp_step1] = data_cost[id * cdisp_step1]; 
+            data_cost_selected[i * cdisp_step1] = data_cost[id * cdisp_step1];
             disparity_selected_new[i * cdisp_step1] = disparity_selected_cur[id * cdisp_step2];
             u_new[i * cdisp_step1] = u_cur[id * cdisp_step2];
             d_new[i * cdisp_step1] = d_cur[id * cdisp_step2];
             l_new[i * cdisp_step1] = l_cur[id * cdisp_step2];
-            r_new[i * cdisp_step1] = r_cur[id * cdisp_step2]; 
+            r_new[i * cdisp_step1] = r_cur[id * cdisp_step2];
             data_cost_new[id * cdisp_step1] = FLT_MAX;
-        }  
+        }
     }
 }
 
 ///////////////////////////////////////////////////////////////
 ////////////////////  calc all iterations /////////////////////
 ///////////////////////////////////////////////////////////////
-void message_per_pixel_0(__global const short *data, __global short *msg_dst, __global const short *msg1, 
+void message_per_pixel_0(__global const short *data, __global short *msg_dst, __global const short *msg1,
     __global const short *msg2, __global const short *msg3,
-    __global const short *dst_disp, __global const short *src_disp, 
+    __global const short *dst_disp, __global const short *src_disp,
     int nr_plane, __global short *temp,
     float cmax_disc_term, int cdisp_step1, float cdisc_single_jump)
 {
     short minimum = SHRT_MAX;
-    for(int d = 0; d < nr_plane; d++)     
+    for(int d = 0; d < nr_plane; d++)
     {
         int idx = d * cdisp_step1;
         short val  = data[idx] + msg1[idx] + msg2[idx] + msg3[idx];
@@ -1215,7 +1215,7 @@ void message_per_pixel_0(__global const short *data, __global short *msg_dst, __
         short src_disp_reg = src_disp[d * cdisp_step1];
 
         for(int d2 = 0; d2 < nr_plane; d2++)
-            cost_min = fmin(cost_min, (msg_dst[d2 * cdisp_step1] + 
+            cost_min = fmin(cost_min, (msg_dst[d2 * cdisp_step1] +
             cdisc_single_jump * abs(dst_disp[d2 * cdisp_step1] - src_disp_reg)));
 
         temp[d * cdisp_step1] = convert_short_sat_rte(cost_min);
@@ -1226,14 +1226,14 @@ void message_per_pixel_0(__global const short *data, __global short *msg_dst, __
     for(int d = 0; d < nr_plane; d++)
         msg_dst[d * cdisp_step1] = convert_short_sat_rte(temp[d * cdisp_step1] - sum);
 }
-void message_per_pixel_1(__global const float *data, __global float *msg_dst, __global const float *msg1, 
+void message_per_pixel_1(__global const float *data, __global float *msg_dst, __global const float *msg1,
     __global const float *msg2, __global const float *msg3,
-    __global const float *dst_disp, __global const float *src_disp, 
+    __global const float *dst_disp, __global const float *src_disp,
     int nr_plane, __global float *temp,
     float cmax_disc_term, int cdisp_step1, float cdisc_single_jump)
 {
     float minimum = FLT_MAX;
-    for(int d = 0; d < nr_plane; d++)     
+    for(int d = 0; d < nr_plane; d++)
     {
         int idx = d * cdisp_step1;
         float val  = data[idx] + msg1[idx] + msg2[idx] + msg3[idx];
@@ -1251,7 +1251,7 @@ void message_per_pixel_1(__global const float *data, __global float *msg_dst, __
         float src_disp_reg = src_disp[d * cdisp_step1];
 
         for(int d2 = 0; d2 < nr_plane; d2++)
-            cost_min = fmin(cost_min, (msg_dst[d2 * cdisp_step1] + 
+            cost_min = fmin(cost_min, (msg_dst[d2 * cdisp_step1] +
             cdisc_single_jump * fabs(dst_disp[d2 * cdisp_step1] - src_disp_reg)));
 
         temp[d * cdisp_step1] = cost_min;
@@ -1262,9 +1262,9 @@ void message_per_pixel_1(__global const float *data, __global float *msg_dst, __
     for(int d = 0; d < nr_plane; d++)
         msg_dst[d * cdisp_step1] = temp[d * cdisp_step1] - sum;
 }
-__kernel void compute_message_0(__global short *u_, __global short *d_, __global short *l_, __global short *r_, 
-    __global const short *data_cost_selected, __global const short *selected_disp_pyr_cur, 
-    __global short *ctemp, int h, int w, int nr_plane, int i, 
+__kernel void compute_message_0(__global short *u_, __global short *d_, __global short *l_, __global short *r_,
+    __global const short *data_cost_selected, __global const short *selected_disp_pyr_cur,
+    __global short *ctemp, int h, int w, int nr_plane, int i,
     float cmax_disc_term, int cdisp_step1, int cmsg_step1, float cdisc_single_jump)
 {
     int y = get_global_id(1);
@@ -1283,7 +1283,7 @@ __kernel void compute_message_0(__global short *u_, __global short *d_, __global
 
         __global short *temp = ctemp + y * cmsg_step1 + x;
 
-        message_per_pixel_0(data, u, r - 1, u + cmsg_step1, l + 1, disp, disp - cmsg_step1, nr_plane, temp, 
+        message_per_pixel_0(data, u, r - 1, u + cmsg_step1, l + 1, disp, disp - cmsg_step1, nr_plane, temp,
             cmax_disc_term, cdisp_step1, cdisc_single_jump);
         message_per_pixel_0(data, d, d - cmsg_step1, r - 1, l + 1, disp, disp + cmsg_step1, nr_plane, temp,
             cmax_disc_term, cdisp_step1, cdisc_single_jump);
@@ -1293,9 +1293,9 @@ __kernel void compute_message_0(__global short *u_, __global short *d_, __global
             cmax_disc_term, cdisp_step1, cdisc_single_jump);
     }
 }
-__kernel void compute_message_1(__global float *u_, __global float *d_, __global float *l_, __global float *r_, 
-    __global const float *data_cost_selected, __global const float *selected_disp_pyr_cur, 
-    __global float *ctemp, int h, int w, int nr_plane, int i, 
+__kernel void compute_message_1(__global float *u_, __global float *d_, __global float *l_, __global float *r_,
+    __global const float *data_cost_selected, __global const float *selected_disp_pyr_cur,
+    __global float *ctemp, int h, int w, int nr_plane, int i,
     float cmax_disc_term, int cdisp_step1, int cmsg_step1, float cdisc_single_jump)
 {
     int y = get_global_id(1);
@@ -1313,7 +1313,7 @@ __kernel void compute_message_1(__global float *u_, __global float *d_, __global
         __global const float *disp = selected_disp_pyr_cur + y * cmsg_step1 + x;
         __global float *temp = ctemp + y * cmsg_step1 + x;
 
-        message_per_pixel_1(data, u, r - 1, u + cmsg_step1, l + 1, disp, disp - cmsg_step1, nr_plane, temp, 
+        message_per_pixel_1(data, u, r - 1, u + cmsg_step1, l + 1, disp, disp - cmsg_step1, nr_plane, temp,
             cmax_disc_term, cdisp_step1, cdisc_single_jump);
         message_per_pixel_1(data, d, d - cmsg_step1, r - 1, l + 1, disp, disp + cmsg_step1, nr_plane, temp,
             cmax_disc_term, cdisp_step1, cdisc_single_jump);
@@ -1327,10 +1327,10 @@ __kernel void compute_message_1(__global float *u_, __global float *d_, __global
 ///////////////////////////////////////////////////////////////
 /////////////////////////// output ////////////////////////////
 ///////////////////////////////////////////////////////////////
-__kernel void compute_disp_0(__global const short *u_, __global const short *d_, __global const short *l_, 
-    __global const short *r_, __global const short * data_cost_selected, 
+__kernel void compute_disp_0(__global const short *u_, __global const short *d_, __global const short *l_,
+    __global const short *r_, __global const short * data_cost_selected,
     __global const short *disp_selected_pyr,
-    __global short* disp, 
+    __global short* disp,
     int res_step, int cols, int rows, int nr_plane,
     int cmsg_step1, int cdisp_step1)
 {
@@ -1364,10 +1364,10 @@ __kernel void compute_disp_0(__global const short *u_, __global const short *d_,
         disp[res_step * y + x] = best;
     }
 }
-__kernel void compute_disp_1(__global const float *u_, __global const float *d_, __global const float *l_, 
-    __global const float *r_, __global const float *data_cost_selected, 
+__kernel void compute_disp_1(__global const float *u_, __global const float *d_, __global const float *l_,
+    __global const float *r_, __global const float *data_cost_selected,
     __global const float *disp_selected_pyr,
-    __global short *disp, 
+    __global short *disp,
     int res_step, int cols, int rows, int nr_plane,
     int cmsg_step1, int cdisp_step1)
 {
index e0ff730..4d41032 100644 (file)
@@ -43,7 +43,7 @@
 //
 //M*/
 
-__kernel void centeredGradientKernel(__global const float* src, int src_col, int src_row, int src_step, 
+__kernel void centeredGradientKernel(__global const float* src, int src_col, int src_row, int src_step,
 __global float* dx, __global float* dy, int dx_step)
 {
     int x = get_global_id(0);
@@ -53,7 +53,7 @@ __global float* dx, __global float* dy, int dx_step)
     {
                int src_x1 = (x + 1) < (src_col -1)? (x + 1) : (src_col - 1);
        int src_x2 = (x - 1) > 0 ? (x -1) : 0;
-        
+
         //if(src[y * src_step + src_x1] == src[y * src_step+ src_x2])
         //{
         //    printf("y = %d\n", y);
@@ -61,7 +61,7 @@ __global float* dx, __global float* dy, int dx_step)
         //    printf("src_x2 = %d\n", src_x2);
         //}
         dx[y * dx_step+ x] = 0.5f * (src[y * src_step + src_x1] - src[y * src_step+ src_x2]);
-        
+
                int src_y1 = (y+1) < (src_row - 1) ? (y + 1) : (src_row - 1);
         int src_y2 = (y - 1) > 0 ? (y - 1) : 0;
         dy[y * dx_step+ x] = 0.5f * (src[src_y1 * src_step + x] - src[src_y2 * src_step+ x]);
@@ -89,8 +89,8 @@ float bicubicCoeff(float x_)
 }
 
 __kernel void warpBackwardKernel(__global const float* I0, int I0_step, int I0_col, int I0_row,
-       image2d_t tex_I1, image2d_t tex_I1x, image2d_t tex_I1y,  
-    __global const float* u1, int u1_step, 
+       image2d_t tex_I1, image2d_t tex_I1x, image2d_t tex_I1y,
+    __global const float* u1, int u1_step,
     __global const float* u2,
     __global float* I1w,
        __global float* I1wx, /*int I1wx_step,*/
@@ -181,8 +181,8 @@ float readImage(__global const float *image,  const int x,  const int y,  const
 }
 
 __kernel void warpBackwardKernelNoImage2d(__global const float* I0, int I0_step, int I0_col, int I0_row,
-       __global const float* tex_I1, __global const float* tex_I1x, __global const float* tex_I1y,  
-    __global const float* u1, int u1_step, 
+       __global const float* tex_I1, __global const float* tex_I1x, __global const float* tex_I1y,
+    __global const float* u1, int u1_step,
     __global const float* u2,
     __global float* I1w,
        __global float* I1wx, /*int I1wx_step,*/
@@ -256,12 +256,12 @@ __kernel void warpBackwardKernelNoImage2d(__global const float* I0, int I0_step,
 }
 
 
-__kernel void estimateDualVariablesKernel(__global const float* u1, int u1_col, int u1_row, int u1_step, 
-    __global const float* u2, 
-    __global float* p11, int p11_step, 
+__kernel void estimateDualVariablesKernel(__global const float* u1, int u1_col, int u1_row, int u1_step,
+    __global const float* u2,
+    __global float* p11, int p11_step,
     __global float* p12,
     __global float* p21,
-    __global float* p22, 
+    __global float* p22,
     const float taut,
        int u2_step,
        int u1_offset_x,
@@ -279,7 +279,7 @@ __kernel void estimateDualVariablesKernel(__global const float* u1, int u1_col,
     {
                int src_x1 = (x + 1) < (u1_col - 1) ? (x + 1) : (u1_col - 1);
         const float u1x = u1[(y + u1_offset_y) * u1_step + src_x1 + u1_offset_x] - u1[(y + u1_offset_y) * u1_step + x + u1_offset_x];
-        
+
                int src_y1 = (y + 1) < (u1_row - 1) ? (y + 1) : (u1_row - 1);
         const float u1y = u1[(src_y1 + u1_offset_y) * u1_step + x + u1_offset_x] - u1[(y + u1_offset_y) * u1_step + x + u1_offset_x];
 
@@ -329,14 +329,14 @@ float divergence(__global const float* v1, __global const float* v2, int y, int
 
 __kernel void estimateUKernel(__global const float* I1wx, int I1wx_col, int I1wx_row, int I1wx_step,
     __global const float* I1wy, /*int I1wy_step,*/
-    __global const float* grad, /*int grad_step,*/ 
+    __global const float* grad, /*int grad_step,*/
     __global const float* rho_c, /*int rho_c_step,*/
     __global const float* p11, /*int p11_step,*/
     __global const float* p12, /*int p12_step,*/
     __global const float* p21, /*int p21_step,*/
     __global const float* p22, /*int p22_step,*/
-    __global float* u1, int u1_step, 
-    __global float* u2, 
+    __global float* u1, int u1_step,
+    __global float* u2,
     __global float* error, const float l_t, const float theta, int u2_step,
        int u1_offset_x,
        int u1_offset_y,
index 8e94204..cdcc8f2 100644 (file)
@@ -145,7 +145,7 @@ static void lkSparse_run(oclMat &I, oclMat &J,
             static char opt[32] = {0};
             sprintf(opt, " -D WAVE_SIZE=%d", wave_size);
 
-            openCLExecuteKernel(clCxt, &pyrlk, kernelName, globalThreads, localThreads, 
+            openCLExecuteKernel(clCxt, &pyrlk, kernelName, globalThreads, localThreads,
                                 args, I.oclchannels(), I.depth(), opt);
             releaseTexture(ITex);
             releaseTexture(JTex);
index 32af2a2..0025f0d 100644 (file)
@@ -160,7 +160,7 @@ static void sortByKey(oclMat& keys, oclMat& vals, size_t vecSize, bool isGreater
 
 namespace radix_sort
 {
-//FIXME(pengx17): 
+//FIXME(pengx17):
 // exclusive scan, need to be optimized as this is too naive...
 //void naive_scan_addition(oclMat& input, oclMat& output)
 //{
@@ -247,8 +247,8 @@ static void sortByKey(oclMat& keys, oclMat& vals, size_t origVecSize, bool isGre
             }
         }
         ocl::copyMakeBorder(
-            keys(Rect(0,0,origVecSize,1)), buffer_keys, 
-            0, 0, 0, vecSize - origVecSize, 
+            keys(Rect(0,0,origVecSize,1)), buffer_keys,
+            0, 0, 0, vecSize - origVecSize,
             BORDER_CONSTANT, padding_value);
         vals(Rect(0,0,origVecSize,1)).copyTo(roi_buffer_vals);
         newBuffer = true;
@@ -274,7 +274,7 @@ static void sortByKey(oclMat& keys, oclMat& vals, size_t origVecSize, bool isGre
     genSortBuildOption(keys, vals, isGreaterThan, build_opt_buf);
 
     //additional build option for radix sort
-    sprintf(build_opt_buf + strlen(build_opt_buf), " -D K_%s", isKeyFloat?"FLT":"INT"); 
+    sprintf(build_opt_buf + strlen(build_opt_buf), " -D K_%s", isKeyFloat?"FLT":"INT");
 
     String kernelnames[2] = {String("histogramRadixN"), String("permuteRadixN")};
 
index 44662ea..1ae70c0 100644 (file)
@@ -624,11 +624,11 @@ static void csbp_operator(StereoConstantSpaceBP &rthis, oclMat u[2], oclMat d[2]
     const Scalar zero = Scalar::all(0);
 
     ////////////////////////////////////Init///////////////////////////////////////////////////
-    int rows = left.rows;  
-    int cols = left.cols; 
+    int rows = left.rows;
+    int cols = left.cols;
 
     rthis.levels = min(rthis.levels, int(log((double)rthis.ndisp) / log(2.0)));
-    int levels = rthis.levels; 
+    int levels = rthis.levels;
 
     AutoBuffer<int> buf(levels * 4);
 
@@ -639,10 +639,10 @@ static void csbp_operator(StereoConstantSpaceBP &rthis, oclMat u[2], oclMat d[2]
 
     cols_pyr[0] = cols;
     rows_pyr[0] = rows;
-    nr_plane_pyr[0] = rthis.nr_plane; 
+    nr_plane_pyr[0] = rthis.nr_plane;
 
     const int n = 64;
-    step_pyr[0] = alignSize(cols * sizeof(T), n) / sizeof(T); 
+    step_pyr[0] = alignSize(cols * sizeof(T), n) / sizeof(T);
     for (int i = 1; i < levels; i++)
     {
         cols_pyr[i] = cols_pyr[i - 1]  / 2;
@@ -688,7 +688,7 @@ static void csbp_operator(StereoConstantSpaceBP &rthis, oclMat u[2], oclMat d[2]
     d[0] = zero;
     r[0] = zero;
     u[0] = zero;
-    disp_selected_pyr[0] = zero; 
+    disp_selected_pyr[0] = zero;
 
     l[1] = zero;
     d[1] = zero;
index cca1db3..1a10b07 100644 (file)
@@ -136,7 +136,7 @@ namespace cv
 
                 const int OPT_SIZE = 50;
                 char cn_opt [OPT_SIZE] = "";
-                sprintf( cn_opt, "%s -D CN=%d", 
+                sprintf( cn_opt, "%s -D CN=%d",
                     (data_type == CV_16S ? "-D T_SHORT":"-D T_FLOAT"),
                     channels
                     );
index a322f62..4978055 100644 (file)
@@ -165,16 +165,16 @@ namespace ocl_tvl1flow
 {
     void centeredGradient(const oclMat &src, oclMat &dx, oclMat &dy);
 
-    void warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x, oclMat &I1y, 
-        oclMat &u1, oclMat &u2, oclMat &I1w, oclMat &I1wx, oclMat &I1wy, 
+    void warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x, oclMat &I1y,
+        oclMat &u1, oclMat &u2, oclMat &I1w, oclMat &I1wx, oclMat &I1wy,
         oclMat &grad, oclMat &rho);
 
-    void estimateU(oclMat &I1wx, oclMat &I1wy, oclMat &grad, 
-        oclMat &rho_c, oclMat &p11, oclMat &p12, 
-        oclMat &p21, oclMat &p22, oclMat &u1, 
+    void estimateU(oclMat &I1wx, oclMat &I1wy, oclMat &grad,
+        oclMat &rho_c, oclMat &p11, oclMat &p12,
+        oclMat &p21, oclMat &p22, oclMat &u1,
         oclMat &u2, oclMat &error, float l_t, float theta);
 
-    void estimateDualVariables(oclMat &u1, oclMat &u2, 
+    void estimateDualVariables(oclMat &u1, oclMat &u2,
         oclMat &p11, oclMat &p12, oclMat &p21, oclMat &p22, float taut);
 }
 
@@ -231,7 +231,7 @@ void cv::ocl::OpticalFlowDual_TVL1_OCL::procOneScale(const oclMat &I0, const ocl
         double error = numeric_limits<double>::max();
         for (int n = 0; error > scaledEpsilon && n < iterations; ++n)
         {
-            estimateU(I1wx, I1wy, grad, rho_c, p11, p12, p21, p22, 
+            estimateU(I1wx, I1wy, grad, rho_c, p11, p12, p21, p22,
                 u1, u2, diff, l_t, static_cast<float>(theta));
 
             error = ocl::sum(diff)[0];
@@ -299,9 +299,9 @@ void ocl_tvl1flow::estimateDualVariables(oclMat &u1, oclMat &u2, oclMat &p11, oc
     Context *clCxt = u1.clCxt;
 
     size_t localThread[] = {32, 8, 1};
-    size_t globalThread[] = 
+    size_t globalThread[] =
     {
-        u1.cols, 
+        u1.cols,
         u1.rows,
         1
     };
@@ -345,17 +345,17 @@ void ocl_tvl1flow::estimateDualVariables(oclMat &u1, oclMat &u2, oclMat &p11, oc
     openCLExecuteKernel(clCxt, &tvl1flow, kernelName, globalThread, localThread, args, -1, -1);
 }
 
-void ocl_tvl1flow::estimateU(oclMat &I1wx, oclMat &I1wy, oclMat &grad, 
-    oclMat &rho_c, oclMat &p11, oclMat &p12, 
-    oclMat &p21, oclMat &p22, oclMat &u1, 
+void ocl_tvl1flow::estimateU(oclMat &I1wx, oclMat &I1wy, oclMat &grad,
+    oclMat &rho_c, oclMat &p11, oclMat &p12,
+    oclMat &p21, oclMat &p22, oclMat &u1,
     oclMat &u2, oclMat &error, float l_t, float theta)
 {
     Context* clCxt = I1wx.clCxt;
 
     size_t localThread[] = {32, 8, 1};
-    size_t globalThread[] = 
+    size_t globalThread[] =
     {
-        I1wx.cols, 
+        I1wx.cols,
         I1wx.rows,
         1
     };
@@ -409,7 +409,7 @@ void ocl_tvl1flow::warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x,
 {
     Context* clCxt = I0.clCxt;
     const bool isImgSupported = support_image2d(clCxt);
-    
+
     CV_Assert(isImgSupported);
 
     int u1ElementSize = u1.elemSize();
@@ -433,9 +433,9 @@ void ocl_tvl1flow::warpBackward(const oclMat &I0, const oclMat &I1, oclMat &I1x,
     u2_offset_x = u2_offset_x/u2.elemSize();
 
     size_t localThread[] = {32, 8, 1};
-    size_t globalThread[] = 
+    size_t globalThread[] =
     {
-        I0.cols, 
+        I0.cols,
         I0.rows,
         1
     };
index 149c172..fa9d099 100644 (file)
@@ -178,7 +178,7 @@ PARAM_TEST_CASE(ArithmTestBase, MatType, bool)
     }
 
     void Near1(double threshold = 0.)
-    {     
+    {
         EXPECT_MAT_NEAR(dst1, Mat(gdst1_whole), threshold);
     }
 
index 7d8fc36..4d0b45f 100644 (file)
@@ -189,20 +189,20 @@ namespace
         ASSERT_EQ(0, badCount);
     }
 
-    INSTANTIATE_TEST_CASE_P(OCL_Features2D, BruteForceMatcher, 
+    INSTANTIATE_TEST_CASE_P(OCL_Features2D, BruteForceMatcher,
         testing::Combine(
         testing::Values(
             DistType(cv::ocl::BruteForceMatcher_OCL_base::L1Dist),
-            DistType(cv::ocl::BruteForceMatcher_OCL_base::L2Dist)/*, 
+            DistType(cv::ocl::BruteForceMatcher_OCL_base::L2Dist)/*,
             DistType(cv::ocl::BruteForceMatcher_OCL_base::HammingDist)*/
         ),
         testing::Values(
-            DescriptorSize(57), 
-            DescriptorSize(64), 
-            DescriptorSize(83), 
-            DescriptorSize(128), 
-            DescriptorSize(179), 
-            DescriptorSize(256), 
+            DescriptorSize(57),
+            DescriptorSize(64),
+            DescriptorSize(83),
+            DescriptorSize(128),
+            DescriptorSize(179),
+            DescriptorSize(256),
             DescriptorSize(304))
         )
     );
index 9a1264f..c98c8f4 100644 (file)
@@ -57,8 +57,8 @@ using namespace testing;
 using namespace std;
 
 
-PARAM_TEST_CASE(FilterTestBase, 
-                MatType, 
+PARAM_TEST_CASE(FilterTestBase,
+                MatType,
                 cv::Size, // kernel size
                 cv::Size, // dx,dy
                 int       // border type, or iteration
@@ -367,7 +367,7 @@ INSTANTIATE_TEST_CASE_P(Filter, Laplacian, Combine(
                         Values(0)));        //not use
 
 INSTANTIATE_TEST_CASE_P(Filter, ErodeDilate, Combine(
-                        Values(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4), 
+                        Values(CV_8UC1, CV_8UC4, CV_32FC1, CV_32FC4),
                         Values(Size(0, 0)), //not use
                         Values(Size(0, 0)), //not use
                         Values(1)));
@@ -383,7 +383,7 @@ INSTANTIATE_TEST_CASE_P(Filter, Sobel, Combine(
 INSTANTIATE_TEST_CASE_P(Filter, Scharr, Combine(
                         Values(CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1, CV_32FC4),
                         Values(Size(0, 0)), //not use
-                        Values(Size(0, 1), Size(1, 0)), 
+                        Values(Size(0, 1), Size(1, 0)),
                         Values((MatType)cv::BORDER_CONSTANT, (MatType)cv::BORDER_REPLICATE)));
 
 INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, Combine(
@@ -395,7 +395,7 @@ INSTANTIATE_TEST_CASE_P(Filter, GaussianBlur, Combine(
 
 
 INSTANTIATE_TEST_CASE_P(Filter, Filter2D, testing::Combine(
-                        Values(CV_8UC1, CV_32FC1, CV_32FC4), 
+                        Values(CV_8UC1, CV_32FC1, CV_32FC4),
                         Values(Size(3, 3), Size(15, 15), Size(25, 25)),
                         Values(Size(0, 0)), //not use
                         Values((MatType)cv::BORDER_CONSTANT, (MatType)cv::BORDER_REFLECT101, (MatType)cv::BORDER_REPLICATE, (MatType)cv::BORDER_REFLECT)));
index 225925c..46cd257 100644 (file)
@@ -448,7 +448,7 @@ PARAM_TEST_CASE(ImgprocTestBase, MatType, MatType, MatType, MatType, MatType, bo
     {
         cv::Mat cpu_cldst;
         cldst.download(cpu_cldst);
-        EXPECT_MAT_NEAR(dst, cpu_cldst, threshold);       
+        EXPECT_MAT_NEAR(dst, cpu_cldst, threshold);
     }
 };
 ////////////////////////////////equalizeHist//////////////////////////////////////////
index a3e472b..1ea0b1c 100644 (file)
@@ -87,7 +87,7 @@ PARAM_TEST_CASE(Kmeans, int, int, int)
             for(int j = 0; j < nchannel; j++)
                 center_row_header.at<float>(0, i*nchannel+j) = 50000.0;
 
-            for(int j = 0; (j < max_neighbour) || 
+            for(int j = 0; (j < max_neighbour) ||
                            (i == K-1 && j < max_neighbour + MHEIGHT%K); j ++)
             {
                 Mat cur_row_header = src.row(row_idx + 1 + j);
@@ -121,15 +121,15 @@ TEST_P(Kmeans, Mat){
         ocl::kmeans(d_src, K, d_labels,
             TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 100, 0),
             1, flags, d_centers);
-  
+
         Mat dd_labels(d_labels);
         Mat dd_centers(d_centers);
         if(flags & KMEANS_USE_INITIAL_LABELS)
         {
             EXPECT_MAT_NEAR(labels, dd_labels, 0);
             EXPECT_MAT_NEAR(centers, dd_centers, 1e-3);
-        } 
-        else 
+        }
+        else
         {
             int row_idx = 0;
             for(int i = 0; i < K; i++)
@@ -157,6 +157,6 @@ TEST_P(Kmeans, Mat){
 INSTANTIATE_TEST_CASE_P(OCL_ML, Kmeans, Combine(
     Values(3, 5, 8),
     Values(CV_32FC1, CV_32FC2, CV_32FC4),
-    Values(OCL_KMEANS_USE_INITIAL_LABELS/*, OCL_KMEANS_PP_CENTERS*/))); 
+    Values(OCL_KMEANS_USE_INITIAL_LABELS/*, OCL_KMEANS_PP_CENTERS*/)));
 
 #endif
index d75d991..7a5fc64 100644 (file)
@@ -222,13 +222,13 @@ TEST_P(Haar, FaceDetect)
 {
     MemStorage storage(cvCreateMemStorage(0));
     CvSeq *_objects;
-    _objects = cascade.oclHaarDetectObjects(d_img, storage, 1.1, 3, 
+    _objects = cascade.oclHaarDetectObjects(d_img, storage, 1.1, 3,
                                             flags, Size(30, 30), Size(0, 0));
     vector<CvAvgComp> vecAvgComp;
     Seq<CvAvgComp>(_objects).copyTo(vecAvgComp);
     oclfaces.resize(vecAvgComp.size());
     std::transform(vecAvgComp.begin(), vecAvgComp.end(), oclfaces.begin(), getRect());
-    
+
     cpucascade.detectMultiScale(img, faces,  1.1, 3,
                                 flags,
                                 Size(30, 30), Size(0, 0));
@@ -261,7 +261,7 @@ TEST_P(Haar, FaceDetectUseBuf)
 }
 
 INSTANTIATE_TEST_CASE_P(OCL_ObjDetect, Haar,
-    Combine(Values(CV_HAAR_SCALE_IMAGE, 0), 
+    Combine(Values(CV_HAAR_SCALE_IMAGE, 0),
             Values(cascade_frontalface_alt/*, cascade_frontalface_alt2*/)));
 
 #endif //HAVE_OPENCL
\ No newline at end of file
index 4693d46..bc08e02 100644 (file)
@@ -89,7 +89,7 @@ TEST_P(GoodFeaturesToTrack, Accuracy)
     ASSERT_FALSE(d_pts.empty());
 
     std::vector<cv::Point2f> pts(d_pts.cols);
-    
+
     detector.downloadPoints(d_pts, pts);
 
     std::vector<cv::Point2f> pts_gold;
@@ -129,7 +129,7 @@ TEST_P(GoodFeaturesToTrack, EmptyCorners)
     ASSERT_TRUE(corners.empty());
 }
 
-INSTANTIATE_TEST_CASE_P(OCL_Video, GoodFeaturesToTrack, 
+INSTANTIATE_TEST_CASE_P(OCL_Video, GoodFeaturesToTrack,
     testing::Values(MinDistance(0.0), MinDistance(3.0)));
 
 //////////////////////////////////////////////////////////////////////////
index b7bc752..58179ac 100644 (file)
@@ -79,7 +79,7 @@ TEST_P(PyrDown, Mat)
         Size size(MWIDTH, MHEIGHT);
         Mat src = randomMat(size, CV_MAKETYPE(type, channels));
         oclMat gsrc(src);
-        
+
         pyrDown(src, dst_cpu);
         pyrDown(gsrc, gdst);
 
index 83326a5..d303665 100644 (file)
@@ -59,7 +59,7 @@ IMPLEMENT_PARAM_CLASS(InputSize, int)
 IMPLEMENT_PARAM_CLASS(SortMethod, int)
 
 
-template<class T> 
+template<class T>
 struct KV_CVTYPE{ static int toType() {return 0;} };
 
 template<> struct KV_CVTYPE<int>  { static int toType() {return CV_32SC1;} };
@@ -101,7 +101,7 @@ void kvquicksort(Mat& keys, Mat& vals, bool isGreater = false)
 {
     vector<pair<key_type, val_type> > kvres;
     toKVPair(keys.begin<key_type>(), vals.begin<val_type>(), keys.cols, kvres);
-    
+
     if(isGreater)
     {
         std::sort(kvres.begin(), kvres.end(), kvgreater<key_type, val_type>);
@@ -180,7 +180,7 @@ bool checkUnstableSorterResult(const Mat& gkeys_, const Mat& gvals_,
         {
             ++ iden_count;
         }
-        
+
         // sort dv and gv
         int num_of_val = (iden_count + 1) * cn_val;
         std::sort(gvptr + i * cn_val, gvptr + i * cn_val + num_of_val);
index 440a89d..7031d99 100644 (file)
@@ -225,7 +225,7 @@ double checkRectSimilarity(Size sz, std::vector<Rect>& ob1, std::vector<Rect>& o
         cpu_result.setTo(0);
 
         for(vector<Rect>::const_iterator r = ob1.begin(); r != ob1.end(); r++)
-        {      
+        {
             cv::Mat cpu_result_roi(cpu_result, *r);
             cpu_result_roi.setTo(1);
             cpu_result.copyTo(cpu_result);
index 6f05239..fa2aa1e 100644 (file)
@@ -7,5 +7,5 @@ photo. Computational Photography
 .. toctree::
     :maxdepth: 2
 
-    inpainting 
+    inpainting
     denoising
index 745914c..3a6137a 100644 (file)
@@ -124,7 +124,7 @@ typedef Ptr<FeatureDetector> Ptr_FeatureDetector;
 typedef Ptr<DescriptorExtractor> Ptr_DescriptorExtractor;
 typedef Ptr<Feature2D> Ptr_Feature2D;
 typedef Ptr<DescriptorMatcher> Ptr_DescriptorMatcher;
-typedef Ptr<CLAHE> Ptr_CLAHE; 
+typedef Ptr<CLAHE> Ptr_CLAHE;
 
 typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
 
index a96be4f..9d19dea 100644 (file)
@@ -35,14 +35,14 @@ class NewOpenCVTests(unittest.TestCase):
 # Tests to run first; check the handful of basic operations that the later tests rely on
 
 class Hackathon244Tests(NewOpenCVTests):
-    
+
     def test_int_array(self):
         a = np.array([-1, 2, -3, 4, -5])
         absa0 = np.abs(a)
         self.assert_(cv2.norm(a, cv2.NORM_L1) == 15)
         absa1 = cv2.absdiff(a, 0)
         self.assertEqual(cv2.norm(absa1, absa0, cv2.NORM_INF), 0)
-        
+
     def test_imencode(self):
         a = np.zeros((480, 640), dtype=np.uint8)
         flag, ajpg = cv2.imencode("img_q90.jpg", a, [cv2.IMWRITE_JPEG_QUALITY, 90])
@@ -50,7 +50,7 @@ class Hackathon244Tests(NewOpenCVTests):
         self.assertEqual(ajpg.dtype, np.uint8)
         self.assertGreater(ajpg.shape[0], 1)
         self.assertEqual(ajpg.shape[1], 1)
-    
+
     def test_projectPoints(self):
         objpt = np.float64([[1,2,3]])
         imgpt0, jac0 = cv2.projectPoints(objpt, np.zeros(3), np.zeros(3), np.eye(3), np.float64([]))
@@ -59,7 +59,7 @@ class Hackathon244Tests(NewOpenCVTests):
         self.assertEqual(imgpt1.shape, imgpt0.shape)
         self.assertEqual(jac0.shape, jac1.shape)
         self.assertEqual(jac0.shape[0], 2*objpt.shape[0])
-        
+
     def test_estimateAffine3D(self):
         pattern_size = (11, 8)
         pattern_points = np.zeros((np.prod(pattern_size), 3), np.float32)
@@ -71,7 +71,7 @@ class Hackathon244Tests(NewOpenCVTests):
             out[2,2]=1
         self.assertLess(cv2.norm(out, np.float64([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]])), 1e-3)
         self.assertEqual(cv2.countNonZero(inliers), pattern_size[0]*pattern_size[1])
-        
+
     def test_fast(self):
         fd = cv2.FastFeatureDetector(30, True)
         img = self.get_sample("samples/cpp/right02.jpg", 0)
@@ -104,11 +104,11 @@ class Hackathon244Tests(NewOpenCVTests):
         be = cv2.fitEllipse(a)
         br = cv2.minAreaRect(a)
         mc, mr = cv2.minEnclosingCircle(a)
-        
+
         be0 = ((150.2511749267578, 150.77322387695312), (158.024658203125, 197.57696533203125), 37.57804489135742)
         br0 = ((161.2974090576172, 154.41793823242188), (199.2301483154297, 207.7177734375), -9.164555549621582)
         mc0, mr0 = (160.41790771484375, 144.55152893066406), 136.713500977
-        
+
         self.check_close_boxes(be, be0, 5, 15)
         self.check_close_boxes(br, br0, 5, 15)
         self.check_close_pairs(mc, mc0, 5)
index dc0b99e..f6e9f73 100644 (file)
@@ -9,7 +9,7 @@ detail::CameraParams
 
 Describes camera parameters.
 
-.. note:: Translation is assumed to be zero during the whole stitching pipeline. 
+.. note:: Translation is assumed to be zero during the whole stitching pipeline.
 
 ::
 
index 07e7850..bd75765 100644 (file)
@@ -57,9 +57,9 @@ High level image stitcher. It's possible to use this class without being aware o
 
         const cv::Mat& matchingMask() const { return matching_mask_; }
         void setMatchingMask(const cv::Mat &mask)
-        { 
+        {
             CV_Assert(mask.type() == CV_8U && mask.cols == mask.rows);
-            matching_mask_ = mask.clone(); 
+            matching_mask_ = mask.clone();
         }
 
         Ptr<detail::BundleAdjusterBase> bundleAdjuster() { return bundle_adjuster_; }
@@ -84,7 +84,7 @@ High level image stitcher. It's possible to use this class without being aware o
         const Ptr<detail::Blender> blender() const { return blender_; }
         void setBlender(Ptr<detail::Blender> blender) { blender_ = blender; }
 
-    private: 
+    private:
         /* hidden */
     };
 
@@ -117,7 +117,7 @@ These functions try to match the given images and to estimate rotations of each
     :param images: Input images.
 
     :param rois: Region of interest rectangles.
-    
+
     :return: Status code.
 
 Stitcher::composePanorama
@@ -132,7 +132,7 @@ These functions try to compose the given images (or images stored internally fro
 .. ocv:function:: Status Stitcher::composePanorama(InputArray images, OutputArray pano)
 
     :param images: Input images.
-    
+
     :param pano: Final pano.
 
     :return: Status code.
@@ -147,7 +147,7 @@ These functions try to stitch the given images.
 .. ocv:function:: Status Stitcher::stitch(InputArray images, const std::vector<std::vector<Rect> > &rois, OutputArray pano)
 
     :param images: Input images.
-    
+
     :param rois: Region of interest rectangles.
 
     :param pano: Final pano.
index f2b1240..119fb1e 100644 (file)
@@ -130,6 +130,6 @@ Minimum graph cut-based seam estimator. See details in [V03]_. ::
         /* hidden */
     };
 
-.. seealso:: 
+.. seealso::
     :ocv:class:`detail::GraphCutSeamFinderBase`,
     :ocv:class:`detail::SeamFinder`
index eb1577d..983b310 100644 (file)
@@ -4,7 +4,7 @@ stitching. Images stitching
 
 .. toctree::
     :maxdepth: 2
-    
+
     introduction
     high_level
     camera
index 5f9e326..c458b24 100644 (file)
@@ -160,7 +160,7 @@ void btv_l1_device_ocl::upscale(const oclMat& src, oclMat& dst, int scale)
     args.push_back(make_pair(sizeof(cl_int), (void*)&src.rows));
     args.push_back(make_pair(sizeof(cl_int), (void*)&src.cols));
     args.push_back(make_pair(sizeof(cl_int), (void*)&scale));
-    args.push_back(make_pair(sizeof(cl_int), (void*)&cn));    
+    args.push_back(make_pair(sizeof(cl_int), (void*)&cn));
 
     openCLExecuteKernel(clCxt, &superres_btvl1, kernel_name, global_thread, local_thread, args, -1, -1);
 
@@ -465,8 +465,8 @@ namespace
 
         // calc motions between input frames
 
-        calcRelativeMotions(forwardMotions, backwardMotions, 
-            lowResForwardMotions_, lowResBackwardMotions_, 
+        calcRelativeMotions(forwardMotions, backwardMotions,
+            lowResForwardMotions_, lowResBackwardMotions_,
             baseIdx, src[0].size());
 
         upscaleMotions(lowResForwardMotions_, highResForwardMotions_, scale_);
index 0efa170..0a8c62f 100644 (file)
@@ -110,7 +110,7 @@ __kernel void upscaleKernel(__global float* src,
             dst[y * channels * scale * dst_step + 4 * x * scale + 0] = src[y * channels * src_step + 4 * x + 0];
             dst[y * channels * scale * dst_step + 4 * x * scale + 1] = src[y * channels * src_step + 4 * x + 1];
             dst[y * channels * scale * dst_step + 4 * x * scale + 2] = src[y * channels * src_step + 4 * x + 2];
-            dst[y * channels * scale * dst_step + 4 * x * scale + 3] = src[y * channels * src_step + 4 * x + 3];            
+            dst[y * channels * scale * dst_step + 4 * x * scale + 3] = src[y * channels * src_step + 4 * x + 3];
         }
     }
 }
index 9aa9a44..1530d6d 100644 (file)
@@ -282,4 +282,4 @@ TEST_F(SuperResolution, BTVL1_OCL)
     cv::ocl::getDevice(infos);
     RunTest(cv::superres::createSuperResolution_BTVL1_OCL());
 }
-#endif 
+#endif
index 23901bf..f18635e 100644 (file)
@@ -95,19 +95,19 @@ macro(ios_include_3party_libs)
       get_filename_component(srcname_we ${srcname} NAME_WE)
       string(REGEX REPLACE <SRC_NAME_WE> "${srcname_we}" objpath2 "${objpath1}")
       string(REGEX REPLACE <RELATIVE_SRC_NAME> "${srcname}" objpath3 "${objpath2}")
-      
+
       list(APPEND objlist "\"${objpath3}\"")
     endforeach() # (srcname ${sources})
-  endforeach() 
+  endforeach()
 endmacro()
 
 if(IOS AND WITH_PNG)
   ios_include_3party_libs(zlib libpng)
-endif() 
+endif()
 
 if(IOS AND WITH_JPEG)
   ios_include_3party_libs(libjpeg)
-endif() 
+endif()
 
 string(REPLACE ";" " " objlist "${objlist}")
 
index 3c2dc42..11f433e 100644 (file)
@@ -11,16 +11,16 @@ to build a universal binary framework. Invoke this script from Terminal.app, wai
 and you are done.
 
 OpenCV is a Private Framework:
-On Mac OS X the concept of Framework bundles is meant to simplify distribution of shared libraries, 
-accompanying headers and documentation. There are however to subtly different 'flavours' of 
-Frameworks: public and private ones. The public frameworks get installed into the Frameworks 
-diretories in /Library, /System/Library or ~/Library and are meant to be shared amongst 
-applications. The private frameworks are only distributed as parts of an Application Bundle. 
-This makes it easier to deploy applications because they bring their own framework invisibly to 
-the user. No installation of the framework is necessary and different applications can bring 
+On Mac OS X the concept of Framework bundles is meant to simplify distribution of shared libraries,
+accompanying headers and documentation. There are however to subtly different 'flavours' of
+Frameworks: public and private ones. The public frameworks get installed into the Frameworks
+diretories in /Library, /System/Library or ~/Library and are meant to be shared amongst
+applications. The private frameworks are only distributed as parts of an Application Bundle.
+This makes it easier to deploy applications because they bring their own framework invisibly to
+the user. No installation of the framework is necessary and different applications can bring
 different versions of the same framework without any conflict.
-Since OpenCV is still a moving target, it seems best to avoid any installation and versioning issues 
-for an end user. The OpenCV framework that currently comes with this demo application therefore 
+Since OpenCV is still a moving target, it seems best to avoid any installation and versioning issues
+for an end user. The OpenCV framework that currently comes with this demo application therefore
 is a Private Framework.
 
 Use it for targets that result in an Application Bundle:
index 787474a..f5835ef 100755 (executable)
@@ -3,7 +3,7 @@
 if [ $# -gt 0 ] ; then
        base=`basename $1 .c`
        echo "compiling $base"
-       gcc -ggdb `pkg-config opencv --cflags --libs` $base.c -o $base 
+       gcc -ggdb `pkg-config opencv --cflags --libs` $base.c -o $base
 else
        for i in *.c; do
            echo "compiling $i"
index b33908f..7bf53e7 100755 (executable)
@@ -16,10 +16,10 @@ Then create the binary directory for the example with:
 
 Then, if "make install" have been executed, directly running
  $ cmake <OPENCV_SRC_PATH>/samples/c/example_cmake/
+
 will detect the "OpenCVConfig.cmake" file and the project is ready to compile.
 
-If "make install" has not been executed, you'll have to manually pick the opencv 
+If "make install" has not been executed, you'll have to manually pick the opencv
 binary directory (Under Windows CMake may remember the correct directory). Open
 the CMake gui with:
  $ cmake-gui <OPENCV_SRC_PATH>/samples/c/example_cmake/
@@ -27,6 +27,6 @@ the CMake gui with:
 And pick the correct value for OpenCV_DIR.
 
 
+
 
 
index 80889fb..a87461f 100644 (file)
@@ -27,7 +27,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
   if(HAVE_OPENCL)
     ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/ocl/include")
   endif()
-  
+
   if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
   endif()
@@ -47,7 +47,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
     if(HAVE_OPENCL)
       target_link_libraries(${the_target} opencv_ocl)
     endif()
-    
+
     set_target_properties(${the_target} PROPERTIES
       OUTPUT_NAME "${project}-example-${name}"
       PROJECT_LABEL "(EXAMPLE_${project_upper}) ${name}")
index d62b42a..4e83c71 100644 (file)
@@ -138,7 +138,7 @@ int main(int argc, const char* argv[])
         CV_Assert(!useOcl);
         info.clear();
     }
-    
+
     if(useOcl)
     {
         CV_Assert(!useCuda);
@@ -171,7 +171,7 @@ int main(int argc, const char* argv[])
             superRes = createSuperResolution_BTVL1();
 
         Ptr<DenseOpticalFlowExt> of = createOptFlow(optFlow, useCuda);
-        
+
         if (of.empty())
             exit(-1);
         superRes->set("opticalFlow", of);
index 72fc2fb..c2f4b27 100644 (file)
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
     createTrackbar("Clip Limit", "CLAHE", &cliplimit, 20, (TrackbarCallback)Clip_Callback);
     Mat frame, outframe;
     ocl::oclMat d_outframe;
-    
+
     int cur_clip;
     Size cur_tilesize;
     if(use_cpu)
index 49148bd..711e257 100644 (file)
@@ -258,7 +258,7 @@ void Draw(Mat& img, vector<Rect>& faces, double scale)
         resize(img, img, Size((int)(img.cols/scale), (int)(img.rows/scale)));
     }
     imshow( "result", img );
-    
+
 }
 
 
index 73df84d..0a5ca65 100644 (file)
@@ -8,51 +8,51 @@ import sys
 def shift_dft(src, dst=None):
     '''
         Rearrange the quadrants of Fourier image so that the origin is at
-        the image center. Swaps quadrant 1 with 3, and 2 with 4. 
-       
+        the image center. Swaps quadrant 1 with 3, and 2 with 4.
+
         src and dst arrays must be equal size & type
     '''
-    
+
     if dst is None:
         dst = np.empty(src.shape, src.dtype)
     elif src.shape != dst.shape:
         raise ValueError("src and dst must have equal sizes")
     elif src.dtype != dst.dtype:
         raise TypeError("src and dst must have equal types")
-    
+
     if src is dst:
         ret = np.empty(src.shape, src.dtype)
     else:
         ret = dst
-    
+
     h, w = src.shape[:2]
-    
+
     cx1 = cx2 = w/2
     cy1 = cy2 = h/2
-    
+
     # if the size is odd, then adjust the bottom/right quadrants
     if w % 2 != 0:
         cx2 += 1
     if h % 2 != 0:
-        cy2 += 1 
-        
+        cy2 += 1
+
     # swap quadrants
-    
+
     # swap q1 and q3
     ret[h-cy1:, w-cx1:] = src[0:cy1 , 0:cx1 ]   # q1 -> q3
     ret[0:cy2 , 0:cx2 ] = src[h-cy2:, w-cx2:]   # q3 -> q1
-    
+
     # swap q2 and q4
     ret[0:cy2 , w-cx2:] = src[h-cy2:, 0:cx2 ]   # q2 -> q4
     ret[h-cy1:, 0:cx1 ] = src[0:cy1 , w-cx1:]   # q4 -> q2
-    
+
     if src is dst:
         dst[:,:] = ret
-    
+
     return dst
 
 if __name__ == "__main__":
-        
+
     if len(sys.argv)>1:
         im = cv2.imread(sys.argv[1])
     else :
@@ -62,9 +62,9 @@ if __name__ == "__main__":
     # convert to grayscale
     im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
     h, w = im.shape[:2]
-    
+
     realInput = im.astype(np.float64)
-    
+
     # perform an optimally sized dft
     dft_M = cv2.getOptimalDFTSize(w)
     dft_N = cv2.getOptimalDFTSize(h)
@@ -72,22 +72,22 @@ if __name__ == "__main__":
     # copy A to dft_A and pad dft_A with zeros
     dft_A = np.zeros((dft_N, dft_M, 2), dtype=np.float64)
     dft_A[:h, :w, 0] = realInput
-    
+
     # no need to pad bottom part of dft_A with zeros because of
     # use of nonzeroRows parameter in cv2.dft()
     cv2.dft(dft_A, dst=dft_A, nonzeroRows=h)
-    
+
     cv2.imshow("win", im)
-    
+
     # Split fourier into real and imaginary parts
     image_Re, image_Im = cv2.split(dft_A)
-    
+
     # Compute the magnitude of the spectrum Mag = sqrt(Re^2 + Im^2)
     magnitude = cv2.sqrt(image_Re**2.0 + image_Im**2.0)
-    
+
     # Compute log(1 + Mag)
     log_spectrum = cv2.log(1.0 + magnitude)
-    
+
     # Rearrange the quadrants of Fourier image so that the origin is at
     # the image center
     shift_dft(log_spectrum, log_spectrum)
index 9fc1280..1d5b823 100644 (file)
@@ -8,12 +8,12 @@ This sample shows interactive image segmentation using grabcut algorithm.
 USAGE :
     python grabcut.py <filename>
 
-README FIRST:    
+README FIRST:
     Two windows will show up, one for input and one for output.
-    
-    At first, in input window, draw a rectangle around the object using 
+
+    At first, in input window, draw a rectangle around the object using
 mouse right button. Then press 'n' to segment the object (once or a few times)
-For any finer touch-ups, you can press any of the keys below and draw lines on 
+For any finer touch-ups, you can press any of the keys below and draw lines on
 the areas you want. Then again press 'n' for updating the output.
 
 Key '0' - To select areas of sure background
@@ -53,7 +53,7 @@ thickness = 3           # brush thickness
 
 def onmouse(event,x,y,flags,param):
     global img,img2,drawing,value,mask,rectangle,rect,rect_or_mask,ix,iy,rect_over
-    
+
     # Draw Rectangle
     if event == cv2.EVENT_RBUTTONDOWN:
         rectangle = True
@@ -73,9 +73,9 @@ def onmouse(event,x,y,flags,param):
         rect = (ix,iy,abs(ix-x),abs(iy-y))
         rect_or_mask = 0
         print " Now press the key 'n' a few times until no further change \n"
-        
+
     # draw touchup curves
-    
+
     if event == cv2.EVENT_LBUTTONDOWN:
         if rect_over == False:
             print "first draw rectangle \n"
@@ -94,7 +94,7 @@ def onmouse(event,x,y,flags,param):
             drawing = False
             cv2.circle(img,(x,y),thickness,value['color'],-1)
             cv2.circle(mask,(x,y),thickness,value['val'],-1)
-        
+
 # print documentation
 print __doc__
 
@@ -125,7 +125,7 @@ while(1):
     cv2.imshow('output',output)
     cv2.imshow('input',img)
     k = 0xFF & cv2.waitKey(1)
-    
+
     # key bindings
     if k == 27:         # esc to exit
         break
@@ -147,11 +147,11 @@ while(1):
     elif k == ord('r'): # reset everything
         print "resetting \n"
         rect = (0,0,1,1)
-        drawing = False         
-        rectangle = False       
-        rect_or_mask = 100 
-        rect_over = False     
-        value = DRAW_FG         
+        drawing = False
+        rectangle = False
+        rect_or_mask = 100
+        rect_over = False
+        value = DRAW_FG
         img = img2.copy()
         mask = np.zeros(img.shape[:2],dtype = np.uint8) # mask initialized to PR_BG
         output = np.zeros(img.shape,np.uint8)           # output image to be shown
@@ -160,15 +160,15 @@ while(1):
         and again press 'n' \n"""
         if (rect_or_mask == 0):         # grabcut with rect
             bgdmodel = np.zeros((1,65),np.float64)
-            fgdmodel = np.zeros((1,65),np.float64)    
+            fgdmodel = np.zeros((1,65),np.float64)
             cv2.grabCut(img2,mask,rect,bgdmodel,fgdmodel,1,cv2.GC_INIT_WITH_RECT)
             rect_or_mask = 1
         elif rect_or_mask == 1:         # grabcut with mask
             bgdmodel = np.zeros((1,65),np.float64)
-            fgdmodel = np.zeros((1,65),np.float64) 
+            fgdmodel = np.zeros((1,65),np.float64)
             cv2.grabCut(img2,mask,rect,bgdmodel,fgdmodel,1,cv2.GC_INIT_WITH_MASK)
 
     mask2 = np.where((mask==1) + (mask==3),255,0).astype('uint8')
-    output = cv2.bitwise_and(img2,img2,mask=mask2)   
+    output = cv2.bitwise_and(img2,img2,mask=mask2)
 
 cv2.destroyAllWindows()
index 2edfd77..769f440 100644 (file)
 -->
 
 <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     x:Class="SDKSample.App"
     RequestedTheme="Light">
     <Application.Resources>
 
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
-                <!-- 
+                <!--
                     Styles that define common aspects of the platform look and feel
                     Required by Visual Studio project and item templates
                  -->
index e0ed0d7..66ce571 100644 (file)
@@ -10,7 +10,7 @@
 //*********************************************************
 -->
 
-<common:LayoutAwarePage 
+<common:LayoutAwarePage
     x:Class="SDKSample.MainPage"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -80,7 +80,7 @@
                             <TextBlock Grid.Row="0" Text="Input" Style="{StaticResource H2Style}"/>
 
                             <TextBlock x:Name="ScenarioListLabel" Text="Select Scenario:" Grid.Row="1"  Style="{StaticResource SubheaderTextStyle}" Margin="0,5,0,0" />
-                            <ListBox x:Name="Scenarios" Margin="0,0,20,0" Grid.Row="2" AutomationProperties.Name="Scenarios" HorizontalAlignment="Left" 
+                            <ListBox x:Name="Scenarios" Margin="0,0,20,0" Grid.Row="2" AutomationProperties.Name="Scenarios" HorizontalAlignment="Left"
                                          VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                          AutomationProperties.LabeledBy="{Binding ElementName=ScenarioListLabel}" MaxHeight="125">
                                 <ListBox.ItemTemplate>
index 04ff69e..3321b47 100644 (file)
@@ -3,7 +3,7 @@
 //////////////////////////////////////////////////////////////////////////
 //  AsyncCallback [template]
 //
-//  Description: 
+//  Description:
 //  Helper class that routes IMFAsyncCallback::Invoke calls to a class
 //  method on the parent class.
 //
@@ -24,7 +24,7 @@
 template<class T>
 class AsyncCallback : public IMFAsyncCallback
 {
-public: 
+public:
     typedef HRESULT (T::*InvokeFn)(IMFAsyncResult *pAsyncResult);
 
     AsyncCallback(T *pParent, InvokeFn fn) : m_pParent(pParent), m_pInvokeFn(fn)
@@ -32,13 +32,13 @@ public:
     }
 
     // IUnknown
-    STDMETHODIMP_(ULONG) AddRef() { 
+    STDMETHODIMP_(ULONG) AddRef() {
         // Delegate to parent class.
-        return m_pParent->AddRef(); 
+        return m_pParent->AddRef();
     }
-    STDMETHODIMP_(ULONG) Release() { 
+    STDMETHODIMP_(ULONG) Release() {
         // Delegate to parent class.
-        return m_pParent->Release(); 
+        return m_pParent->Release();
     }
     STDMETHODIMP QueryInterface(REFIID iid, void** ppv)
     {
index d5ea05b..cd6c6ef 100644 (file)
@@ -36,7 +36,7 @@ public:
 
 //////////////////////////////////////////////////////////////////////////
 //  AutoLock
-//  Description: Provides automatic locking and unlocking of a 
+//  Description: Provides automatic locking and unlocking of a
 //               of a critical section.
 //
 //  Note: The AutoLock object must go out of scope before the CritSec.
index c67c0f2..3657b3d 100644 (file)
@@ -13,9 +13,9 @@
 #pragma once
 
 // Notes:
-// 
-// The List class template implements a simple double-linked list. 
-// It uses STL's copy semantics. 
+//
+// The List class template implements a simple double-linked list.
+// It uses STL's copy semantics.
 
 // There are two versions of the Clear() method:
 //  Clear(void) clears the list w/out cleaning up the object.
@@ -90,7 +90,7 @@ public:
     private:
         const Node *pNode;
 
-        POSITION(Node *p) : pNode(p) 
+        POSITION(Node *p) : pNode(p)
         {
         }
     };
@@ -123,7 +123,7 @@ protected:
         }
 
         Node *pAfter = pBefore->next;
-            
+
         pBefore->next = pNode;
         pAfter->prev = pNode;
 
@@ -336,12 +336,12 @@ public:
     }
 
     HRESULT GetItemPos(POSITION pos, T *ppItem)
-    {   
+    {
         if (pos.pNode)
         {
             return GetItem(pos.pNode, ppItem);
         }
-        else 
+        else
         {
             return E_FAIL;
         }
@@ -359,7 +359,7 @@ public:
         }
     }
 
-    // Remove an item at a position. 
+    // Remove an item at a position.
     // The item is returns in ppItem, unless ppItem is nullptr.
     // NOTE: This method invalidates the POSITION object.
     HRESULT Remove(POSITION& pos, T *ppItem)
@@ -390,7 +390,7 @@ public:
 
 class ComAutoRelease
 {
-public: 
+public:
     void operator()(IUnknown *p)
     {
         if (p)
@@ -399,10 +399,10 @@ public:
         }
     }
 };
-        
+
 class MemDelete
 {
-public: 
+public:
     void operator()(void *p)
     {
         if (p)
@@ -416,9 +416,9 @@ public:
 // ComPtrList class
 // Derived class that makes it safer to store COM pointers in the List<> class.
 // It automatically AddRef's the pointers that are inserted onto the list
-// (unless the insertion method fails). 
+// (unless the insertion method fails).
 //
-// T must be a COM interface type. 
+// T must be a COM interface type.
 // example: ComPtrList<IUnknown>
 //
 // NULLABLE: If true, client can insert nullptr pointers. This means GetItem can
@@ -487,7 +487,7 @@ protected:
     HRESULT RemoveItem(Node *pNode, Ptr *ppItem)
     {
         // ppItem can be nullptr, but we need to get the
-        // item so that we can release it. 
+        // item so that we can release it.
 
         // If ppItem is not nullptr, we will AddRef it on the way out.
 
index 120ef7d..8e33c4a 100644 (file)
@@ -5,7 +5,7 @@ import "Windows.Media.idl";
 namespace OcvTransform
 {
        [version(NTDDI_WIN8)]
-       runtimeclass OcvImageManipulations 
+       runtimeclass OcvImageManipulations
     {
        }
 }
\ No newline at end of file
index bf98128..c96c042 100644 (file)
@@ -1333,7 +1333,7 @@ HRESULT OcvImageManipulations::OnProcessOutput(IMFMediaBuffer *pIn, IMFMediaBuff
             const int mHistSize[] = {25};
             const float baseRabge[] = {0.f,256.f};
             const float* ranges[] = {baseRabge};
-            
+
                        const cv::Scalar mColorsY[] = { cv::Scalar(76), cv::Scalar(149), cv::Scalar(29) };
                        const cv::Scalar mColorsUV[] = { cv::Scalar(84, 255), cv::Scalar(43, 21), cv::Scalar(255, 107) };
 
@@ -1370,7 +1370,7 @@ HRESULT OcvImageManipulations::OnProcessOutput(IMFMediaBuffer *pIn, IMFMediaBuff
                     mP2.y /= 2;
                                        cv::line(OutputUV, mP1, mP2, mColorsUV[c], thikness/2);
                 }
-            }            
+            }
         } break;
     default:
         break;
index d11bcea..dd4d4bf 100644 (file)
@@ -47,7 +47,7 @@ HRESULT WINAPI DllGetActivationFactory( _In_ HSTRING activatibleClassId, _Outptr
 
 HRESULT WINAPI DllCanUnloadNow()
 {
-    auto &module = Microsoft::WRL::Module<Microsoft::WRL::InProc>::GetModule();    
+    auto &module = Microsoft::WRL::Module<Microsoft::WRL::InProc>::GetModule();
     return (module.Terminate()) ? S_OK : S_FALSE;
 }
 
index 7c3d238..b4edc81 100644 (file)
@@ -15,7 +15,7 @@
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 
     <!-- Non-brush values that vary across themes -->
-    
+
     <ResourceDictionary.ThemeDictionaries>
         <ResourceDictionary x:Key="Default">
             <x:String x:Key="BackButtonGlyph">&#xE071;</x:String>
     </Style>
 
     <!-- Standard App Bar buttons -->
-  
+
     <Style x:Key="SkipBackAppBarButtonStyle" TargetType="Button" BasedOn="{StaticResource AppBarButtonStyle}">
         <Setter Property="AutomationProperties.AutomationId" Value="SkipBackAppBarButton"/>
         <Setter Property="AutomationProperties.Name" Value="Skip Back"/>
     <!--
         SnappedBackButtonStyle is used to style a Button for use in the title area of a snapped page.  Margins appropriate
         for the conventional page layout are included as part of the style.
-        
+
         The obvious duplication here is necessary as the glyphs used in snapped are not merely smaller versions of the same
         glyph but are actually distinct.
     -->
                         <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" Style="{StaticResource BodyTextStyle}"/>
                         <TextBlock Text="{Binding Description}" MaxHeight="140" Foreground="{StaticResource ApplicationSecondaryForegroundThemeBrush}" Style="{StaticResource BodyTextStyle}"/>
                     </StackPanel>
-                </Grid>                    
+                </Grid>
             </ToolTipService.ToolTip>
         </Grid>
     </DataTemplate>
index ec2c1a7..cddb264 100644 (file)
@@ -10,7 +10,7 @@
 //*********************************************************
 -->
 <ResourceDictionary
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 
     <Style x:Key="TitleTextStyle" TargetType="TextBlock">