openCV library for Renesas RZ/A
Dependents: RZ_A2M_Mbed_samples
include/opencv2/imgproc.hpp@0:0e0631af0305, 2021-01-29 (annotated)
- Committer:
- RyoheiHagimoto
- Date:
- Fri Jan 29 04:53:38 2021 +0000
- Revision:
- 0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| RyoheiHagimoto | 0:0e0631af0305 | 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// |
| RyoheiHagimoto | 0:0e0631af0305 | 2 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. |
| RyoheiHagimoto | 0:0e0631af0305 | 4 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 5 | // By downloading, copying, installing or using the software you agree to this license. |
| RyoheiHagimoto | 0:0e0631af0305 | 6 | // If you do not agree to this license, do not download, install, |
| RyoheiHagimoto | 0:0e0631af0305 | 7 | // copy or use the software. |
| RyoheiHagimoto | 0:0e0631af0305 | 8 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 9 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 10 | // License Agreement |
| RyoheiHagimoto | 0:0e0631af0305 | 11 | // For Open Source Computer Vision Library |
| RyoheiHagimoto | 0:0e0631af0305 | 12 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. |
| RyoheiHagimoto | 0:0e0631af0305 | 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. |
| RyoheiHagimoto | 0:0e0631af0305 | 15 | // Third party copyrights are property of their respective owners. |
| RyoheiHagimoto | 0:0e0631af0305 | 16 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 17 | // Redistribution and use in source and binary forms, with or without modification, |
| RyoheiHagimoto | 0:0e0631af0305 | 18 | // are permitted provided that the following conditions are met: |
| RyoheiHagimoto | 0:0e0631af0305 | 19 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 20 | // * Redistribution's of source code must retain the above copyright notice, |
| RyoheiHagimoto | 0:0e0631af0305 | 21 | // this list of conditions and the following disclaimer. |
| RyoheiHagimoto | 0:0e0631af0305 | 22 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 23 | // * Redistribution's in binary form must reproduce the above copyright notice, |
| RyoheiHagimoto | 0:0e0631af0305 | 24 | // this list of conditions and the following disclaimer in the documentation |
| RyoheiHagimoto | 0:0e0631af0305 | 25 | // and/or other materials provided with the distribution. |
| RyoheiHagimoto | 0:0e0631af0305 | 26 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 27 | // * The name of the copyright holders may not be used to endorse or promote products |
| RyoheiHagimoto | 0:0e0631af0305 | 28 | // derived from this software without specific prior written permission. |
| RyoheiHagimoto | 0:0e0631af0305 | 29 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 30 | // This software is provided by the copyright holders and contributors "as is" and |
| RyoheiHagimoto | 0:0e0631af0305 | 31 | // any express or implied warranties, including, but not limited to, the implied |
| RyoheiHagimoto | 0:0e0631af0305 | 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. |
| RyoheiHagimoto | 0:0e0631af0305 | 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, |
| RyoheiHagimoto | 0:0e0631af0305 | 34 | // indirect, incidental, special, exemplary, or consequential damages |
| RyoheiHagimoto | 0:0e0631af0305 | 35 | // (including, but not limited to, procurement of substitute goods or services; |
| RyoheiHagimoto | 0:0e0631af0305 | 36 | // loss of use, data, or profits; or business interruption) however caused |
| RyoheiHagimoto | 0:0e0631af0305 | 37 | // and on any theory of liability, whether in contract, strict liability, |
| RyoheiHagimoto | 0:0e0631af0305 | 38 | // or tort (including negligence or otherwise) arising in any way out of |
| RyoheiHagimoto | 0:0e0631af0305 | 39 | // the use of this software, even if advised of the possibility of such damage. |
| RyoheiHagimoto | 0:0e0631af0305 | 40 | // |
| RyoheiHagimoto | 0:0e0631af0305 | 41 | //M*/ |
| RyoheiHagimoto | 0:0e0631af0305 | 42 | |
| RyoheiHagimoto | 0:0e0631af0305 | 43 | #ifndef OPENCV_IMGPROC_HPP |
| RyoheiHagimoto | 0:0e0631af0305 | 44 | #define OPENCV_IMGPROC_HPP |
| RyoheiHagimoto | 0:0e0631af0305 | 45 | |
| RyoheiHagimoto | 0:0e0631af0305 | 46 | #include "opencv2/core.hpp" |
| RyoheiHagimoto | 0:0e0631af0305 | 47 | |
| RyoheiHagimoto | 0:0e0631af0305 | 48 | /** |
| RyoheiHagimoto | 0:0e0631af0305 | 49 | @defgroup imgproc Image processing |
| RyoheiHagimoto | 0:0e0631af0305 | 50 | @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 51 | @defgroup imgproc_filter Image Filtering |
| RyoheiHagimoto | 0:0e0631af0305 | 52 | |
| RyoheiHagimoto | 0:0e0631af0305 | 53 | Functions and classes described in this section are used to perform various linear or non-linear |
| RyoheiHagimoto | 0:0e0631af0305 | 54 | filtering operations on 2D images (represented as Mat's). It means that for each pixel location |
| RyoheiHagimoto | 0:0e0631af0305 | 55 | \f$(x,y)\f$ in the source image (normally, rectangular), its neighborhood is considered and used to |
| RyoheiHagimoto | 0:0e0631af0305 | 56 | compute the response. In case of a linear filter, it is a weighted sum of pixel values. In case of |
| RyoheiHagimoto | 0:0e0631af0305 | 57 | morphological operations, it is the minimum or maximum values, and so on. The computed response is |
| RyoheiHagimoto | 0:0e0631af0305 | 58 | stored in the destination image at the same location \f$(x,y)\f$. It means that the output image |
| RyoheiHagimoto | 0:0e0631af0305 | 59 | will be of the same size as the input image. Normally, the functions support multi-channel arrays, |
| RyoheiHagimoto | 0:0e0631af0305 | 60 | in which case every channel is processed independently. Therefore, the output image will also have |
| RyoheiHagimoto | 0:0e0631af0305 | 61 | the same number of channels as the input one. |
| RyoheiHagimoto | 0:0e0631af0305 | 62 | |
| RyoheiHagimoto | 0:0e0631af0305 | 63 | Another common feature of the functions and classes described in this section is that, unlike |
| RyoheiHagimoto | 0:0e0631af0305 | 64 | simple arithmetic functions, they need to extrapolate values of some non-existing pixels. For |
| RyoheiHagimoto | 0:0e0631af0305 | 65 | example, if you want to smooth an image using a Gaussian \f$3 \times 3\f$ filter, then, when |
| RyoheiHagimoto | 0:0e0631af0305 | 66 | processing the left-most pixels in each row, you need pixels to the left of them, that is, outside |
| RyoheiHagimoto | 0:0e0631af0305 | 67 | of the image. You can let these pixels be the same as the left-most image pixels ("replicated |
| RyoheiHagimoto | 0:0e0631af0305 | 68 | border" extrapolation method), or assume that all the non-existing pixels are zeros ("constant |
| RyoheiHagimoto | 0:0e0631af0305 | 69 | border" extrapolation method), and so on. OpenCV enables you to specify the extrapolation method. |
| RyoheiHagimoto | 0:0e0631af0305 | 70 | For details, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 71 | |
| RyoheiHagimoto | 0:0e0631af0305 | 72 | @anchor filter_depths |
| RyoheiHagimoto | 0:0e0631af0305 | 73 | ### Depth combinations |
| RyoheiHagimoto | 0:0e0631af0305 | 74 | Input depth (src.depth()) | Output depth (ddepth) |
| RyoheiHagimoto | 0:0e0631af0305 | 75 | --------------------------|---------------------- |
| RyoheiHagimoto | 0:0e0631af0305 | 76 | CV_8U | -1/CV_16S/CV_32F/CV_64F |
| RyoheiHagimoto | 0:0e0631af0305 | 77 | CV_16U/CV_16S | -1/CV_32F/CV_64F |
| RyoheiHagimoto | 0:0e0631af0305 | 78 | CV_32F | -1/CV_32F/CV_64F |
| RyoheiHagimoto | 0:0e0631af0305 | 79 | CV_64F | -1/CV_64F |
| RyoheiHagimoto | 0:0e0631af0305 | 80 | |
| RyoheiHagimoto | 0:0e0631af0305 | 81 | @note when ddepth=-1, the output image will have the same depth as the source. |
| RyoheiHagimoto | 0:0e0631af0305 | 82 | |
| RyoheiHagimoto | 0:0e0631af0305 | 83 | @defgroup imgproc_transform Geometric Image Transformations |
| RyoheiHagimoto | 0:0e0631af0305 | 84 | |
| RyoheiHagimoto | 0:0e0631af0305 | 85 | The functions in this section perform various geometrical transformations of 2D images. They do not |
| RyoheiHagimoto | 0:0e0631af0305 | 86 | change the image content but deform the pixel grid and map this deformed grid to the destination |
| RyoheiHagimoto | 0:0e0631af0305 | 87 | image. In fact, to avoid sampling artifacts, the mapping is done in the reverse order, from |
| RyoheiHagimoto | 0:0e0631af0305 | 88 | destination to the source. That is, for each pixel \f$(x, y)\f$ of the destination image, the |
| RyoheiHagimoto | 0:0e0631af0305 | 89 | functions compute coordinates of the corresponding "donor" pixel in the source image and copy the |
| RyoheiHagimoto | 0:0e0631af0305 | 90 | pixel value: |
| RyoheiHagimoto | 0:0e0631af0305 | 91 | |
| RyoheiHagimoto | 0:0e0631af0305 | 92 | \f[\texttt{dst} (x,y)= \texttt{src} (f_x(x,y), f_y(x,y))\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 93 | |
| RyoheiHagimoto | 0:0e0631af0305 | 94 | In case when you specify the forward mapping \f$\left<g_x, g_y\right>: \texttt{src} \rightarrow |
| RyoheiHagimoto | 0:0e0631af0305 | 95 | \texttt{dst}\f$, the OpenCV functions first compute the corresponding inverse mapping |
| RyoheiHagimoto | 0:0e0631af0305 | 96 | \f$\left<f_x, f_y\right>: \texttt{dst} \rightarrow \texttt{src}\f$ and then use the above formula. |
| RyoheiHagimoto | 0:0e0631af0305 | 97 | |
| RyoheiHagimoto | 0:0e0631af0305 | 98 | The actual implementations of the geometrical transformations, from the most generic remap and to |
| RyoheiHagimoto | 0:0e0631af0305 | 99 | the simplest and the fastest resize, need to solve two main problems with the above formula: |
| RyoheiHagimoto | 0:0e0631af0305 | 100 | |
| RyoheiHagimoto | 0:0e0631af0305 | 101 | - Extrapolation of non-existing pixels. Similarly to the filtering functions described in the |
| RyoheiHagimoto | 0:0e0631af0305 | 102 | previous section, for some \f$(x,y)\f$, either one of \f$f_x(x,y)\f$, or \f$f_y(x,y)\f$, or both |
| RyoheiHagimoto | 0:0e0631af0305 | 103 | of them may fall outside of the image. In this case, an extrapolation method needs to be used. |
| RyoheiHagimoto | 0:0e0631af0305 | 104 | OpenCV provides the same selection of extrapolation methods as in the filtering functions. In |
| RyoheiHagimoto | 0:0e0631af0305 | 105 | addition, it provides the method BORDER_TRANSPARENT. This means that the corresponding pixels in |
| RyoheiHagimoto | 0:0e0631af0305 | 106 | the destination image will not be modified at all. |
| RyoheiHagimoto | 0:0e0631af0305 | 107 | |
| RyoheiHagimoto | 0:0e0631af0305 | 108 | - Interpolation of pixel values. Usually \f$f_x(x,y)\f$ and \f$f_y(x,y)\f$ are floating-point |
| RyoheiHagimoto | 0:0e0631af0305 | 109 | numbers. This means that \f$\left<f_x, f_y\right>\f$ can be either an affine or perspective |
| RyoheiHagimoto | 0:0e0631af0305 | 110 | transformation, or radial lens distortion correction, and so on. So, a pixel value at fractional |
| RyoheiHagimoto | 0:0e0631af0305 | 111 | coordinates needs to be retrieved. In the simplest case, the coordinates can be just rounded to the |
| RyoheiHagimoto | 0:0e0631af0305 | 112 | nearest integer coordinates and the corresponding pixel can be used. This is called a |
| RyoheiHagimoto | 0:0e0631af0305 | 113 | nearest-neighbor interpolation. However, a better result can be achieved by using more |
| RyoheiHagimoto | 0:0e0631af0305 | 114 | sophisticated [interpolation methods](http://en.wikipedia.org/wiki/Multivariate_interpolation) , |
| RyoheiHagimoto | 0:0e0631af0305 | 115 | where a polynomial function is fit into some neighborhood of the computed pixel \f$(f_x(x,y), |
| RyoheiHagimoto | 0:0e0631af0305 | 116 | f_y(x,y))\f$, and then the value of the polynomial at \f$(f_x(x,y), f_y(x,y))\f$ is taken as the |
| RyoheiHagimoto | 0:0e0631af0305 | 117 | interpolated pixel value. In OpenCV, you can choose between several interpolation methods. See |
| RyoheiHagimoto | 0:0e0631af0305 | 118 | resize for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 119 | |
| RyoheiHagimoto | 0:0e0631af0305 | 120 | @defgroup imgproc_misc Miscellaneous Image Transformations |
| RyoheiHagimoto | 0:0e0631af0305 | 121 | @defgroup imgproc_draw Drawing Functions |
| RyoheiHagimoto | 0:0e0631af0305 | 122 | |
| RyoheiHagimoto | 0:0e0631af0305 | 123 | Drawing functions work with matrices/images of arbitrary depth. The boundaries of the shapes can be |
| RyoheiHagimoto | 0:0e0631af0305 | 124 | rendered with antialiasing (implemented only for 8-bit images for now). All the functions include |
| RyoheiHagimoto | 0:0e0631af0305 | 125 | the parameter color that uses an RGB value (that may be constructed with the Scalar constructor ) |
| RyoheiHagimoto | 0:0e0631af0305 | 126 | for color images and brightness for grayscale images. For color images, the channel ordering is |
| RyoheiHagimoto | 0:0e0631af0305 | 127 | normally *Blue, Green, Red*. This is what imshow, imread, and imwrite expect. So, if you form a |
| RyoheiHagimoto | 0:0e0631af0305 | 128 | color using the Scalar constructor, it should look like: |
| RyoheiHagimoto | 0:0e0631af0305 | 129 | |
| RyoheiHagimoto | 0:0e0631af0305 | 130 | \f[\texttt{Scalar} (blue \_ component, green \_ component, red \_ component[, alpha \_ component])\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 131 | |
| RyoheiHagimoto | 0:0e0631af0305 | 132 | If you are using your own image rendering and I/O functions, you can use any channel ordering. The |
| RyoheiHagimoto | 0:0e0631af0305 | 133 | drawing functions process each channel independently and do not depend on the channel order or even |
| RyoheiHagimoto | 0:0e0631af0305 | 134 | on the used color space. The whole image can be converted from BGR to RGB or to a different color |
| RyoheiHagimoto | 0:0e0631af0305 | 135 | space using cvtColor . |
| RyoheiHagimoto | 0:0e0631af0305 | 136 | |
| RyoheiHagimoto | 0:0e0631af0305 | 137 | If a drawn figure is partially or completely outside the image, the drawing functions clip it. Also, |
| RyoheiHagimoto | 0:0e0631af0305 | 138 | many drawing functions can handle pixel coordinates specified with sub-pixel accuracy. This means |
| RyoheiHagimoto | 0:0e0631af0305 | 139 | that the coordinates can be passed as fixed-point numbers encoded as integers. The number of |
| RyoheiHagimoto | 0:0e0631af0305 | 140 | fractional bits is specified by the shift parameter and the real point coordinates are calculated as |
| RyoheiHagimoto | 0:0e0631af0305 | 141 | \f$\texttt{Point}(x,y)\rightarrow\texttt{Point2f}(x*2^{-shift},y*2^{-shift})\f$ . This feature is |
| RyoheiHagimoto | 0:0e0631af0305 | 142 | especially effective when rendering antialiased shapes. |
| RyoheiHagimoto | 0:0e0631af0305 | 143 | |
| RyoheiHagimoto | 0:0e0631af0305 | 144 | @note The functions do not support alpha-transparency when the target image is 4-channel. In this |
| RyoheiHagimoto | 0:0e0631af0305 | 145 | case, the color[3] is simply copied to the repainted pixels. Thus, if you want to paint |
| RyoheiHagimoto | 0:0e0631af0305 | 146 | semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main |
| RyoheiHagimoto | 0:0e0631af0305 | 147 | image. |
| RyoheiHagimoto | 0:0e0631af0305 | 148 | |
| RyoheiHagimoto | 0:0e0631af0305 | 149 | @defgroup imgproc_colormap ColorMaps in OpenCV |
| RyoheiHagimoto | 0:0e0631af0305 | 150 | |
| RyoheiHagimoto | 0:0e0631af0305 | 151 | The human perception isn't built for observing fine changes in grayscale images. Human eyes are more |
| RyoheiHagimoto | 0:0e0631af0305 | 152 | sensitive to observing changes between colors, so you often need to recolor your grayscale images to |
| RyoheiHagimoto | 0:0e0631af0305 | 153 | get a clue about them. OpenCV now comes with various colormaps to enhance the visualization in your |
| RyoheiHagimoto | 0:0e0631af0305 | 154 | computer vision application. |
| RyoheiHagimoto | 0:0e0631af0305 | 155 | |
| RyoheiHagimoto | 0:0e0631af0305 | 156 | In OpenCV you only need applyColorMap to apply a colormap on a given image. The following sample |
| RyoheiHagimoto | 0:0e0631af0305 | 157 | code reads the path to an image from command line, applies a Jet colormap on it and shows the |
| RyoheiHagimoto | 0:0e0631af0305 | 158 | result: |
| RyoheiHagimoto | 0:0e0631af0305 | 159 | |
| RyoheiHagimoto | 0:0e0631af0305 | 160 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 161 | #include <opencv2/core.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 162 | #include <opencv2/imgproc.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 163 | #include <opencv2/imgcodecs.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 164 | #include <opencv2/highgui.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 165 | using namespace cv; |
| RyoheiHagimoto | 0:0e0631af0305 | 166 | |
| RyoheiHagimoto | 0:0e0631af0305 | 167 | #include <iostream> |
| RyoheiHagimoto | 0:0e0631af0305 | 168 | using namespace std; |
| RyoheiHagimoto | 0:0e0631af0305 | 169 | |
| RyoheiHagimoto | 0:0e0631af0305 | 170 | int main(int argc, const char *argv[]) |
| RyoheiHagimoto | 0:0e0631af0305 | 171 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 172 | // We need an input image. (can be grayscale or color) |
| RyoheiHagimoto | 0:0e0631af0305 | 173 | if (argc < 2) |
| RyoheiHagimoto | 0:0e0631af0305 | 174 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 175 | cerr << "We need an image to process here. Please run: colorMap [path_to_image]" << endl; |
| RyoheiHagimoto | 0:0e0631af0305 | 176 | return -1; |
| RyoheiHagimoto | 0:0e0631af0305 | 177 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 178 | Mat img_in = imread(argv[1]); |
| RyoheiHagimoto | 0:0e0631af0305 | 179 | if(img_in.empty()) |
| RyoheiHagimoto | 0:0e0631af0305 | 180 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 181 | cerr << "Sample image (" << argv[1] << ") is empty. Please adjust your path, so it points to a valid input image!" << endl; |
| RyoheiHagimoto | 0:0e0631af0305 | 182 | return -1; |
| RyoheiHagimoto | 0:0e0631af0305 | 183 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 184 | // Holds the colormap version of the image: |
| RyoheiHagimoto | 0:0e0631af0305 | 185 | Mat img_color; |
| RyoheiHagimoto | 0:0e0631af0305 | 186 | // Apply the colormap: |
| RyoheiHagimoto | 0:0e0631af0305 | 187 | applyColorMap(img_in, img_color, COLORMAP_JET); |
| RyoheiHagimoto | 0:0e0631af0305 | 188 | // Show the result: |
| RyoheiHagimoto | 0:0e0631af0305 | 189 | imshow("colorMap", img_color); |
| RyoheiHagimoto | 0:0e0631af0305 | 190 | waitKey(0); |
| RyoheiHagimoto | 0:0e0631af0305 | 191 | return 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 192 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 193 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 194 | |
| RyoheiHagimoto | 0:0e0631af0305 | 195 | @see cv::ColormapTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 196 | |
| RyoheiHagimoto | 0:0e0631af0305 | 197 | @defgroup imgproc_subdiv2d Planar Subdivision |
| RyoheiHagimoto | 0:0e0631af0305 | 198 | |
| RyoheiHagimoto | 0:0e0631af0305 | 199 | The Subdiv2D class described in this section is used to perform various planar subdivision on |
| RyoheiHagimoto | 0:0e0631af0305 | 200 | a set of 2D points (represented as vector of Point2f). OpenCV subdivides a plane into triangles |
| RyoheiHagimoto | 0:0e0631af0305 | 201 | using the Delaunay’s algorithm, which corresponds to the dual graph of the Voronoi diagram. |
| RyoheiHagimoto | 0:0e0631af0305 | 202 | In the figure below, the Delaunay’s triangulation is marked with black lines and the Voronoi |
| RyoheiHagimoto | 0:0e0631af0305 | 203 | diagram with red lines. |
| RyoheiHagimoto | 0:0e0631af0305 | 204 | |
| RyoheiHagimoto | 0:0e0631af0305 | 205 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 206 | |
| RyoheiHagimoto | 0:0e0631af0305 | 207 | The subdivisions can be used for the 3D piece-wise transformation of a plane, morphing, fast |
| RyoheiHagimoto | 0:0e0631af0305 | 208 | location of points on the plane, building special graphs (such as NNG,RNG), and so forth. |
| RyoheiHagimoto | 0:0e0631af0305 | 209 | |
| RyoheiHagimoto | 0:0e0631af0305 | 210 | @defgroup imgproc_hist Histograms |
| RyoheiHagimoto | 0:0e0631af0305 | 211 | @defgroup imgproc_shape Structural Analysis and Shape Descriptors |
| RyoheiHagimoto | 0:0e0631af0305 | 212 | @defgroup imgproc_motion Motion Analysis and Object Tracking |
| RyoheiHagimoto | 0:0e0631af0305 | 213 | @defgroup imgproc_feature Feature Detection |
| RyoheiHagimoto | 0:0e0631af0305 | 214 | @defgroup imgproc_object Object Detection |
| RyoheiHagimoto | 0:0e0631af0305 | 215 | @defgroup imgproc_c C API |
| RyoheiHagimoto | 0:0e0631af0305 | 216 | @defgroup imgproc_hal Hardware Acceleration Layer |
| RyoheiHagimoto | 0:0e0631af0305 | 217 | @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 218 | @defgroup imgproc_hal_functions Functions |
| RyoheiHagimoto | 0:0e0631af0305 | 219 | @defgroup imgproc_hal_interface Interface |
| RyoheiHagimoto | 0:0e0631af0305 | 220 | @} |
| RyoheiHagimoto | 0:0e0631af0305 | 221 | @} |
| RyoheiHagimoto | 0:0e0631af0305 | 222 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 223 | |
| RyoheiHagimoto | 0:0e0631af0305 | 224 | namespace cv |
| RyoheiHagimoto | 0:0e0631af0305 | 225 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 226 | |
| RyoheiHagimoto | 0:0e0631af0305 | 227 | /** @addtogroup imgproc |
| RyoheiHagimoto | 0:0e0631af0305 | 228 | @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 229 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 230 | |
| RyoheiHagimoto | 0:0e0631af0305 | 231 | //! @addtogroup imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 232 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 233 | |
| RyoheiHagimoto | 0:0e0631af0305 | 234 | //! type of morphological operation |
| RyoheiHagimoto | 0:0e0631af0305 | 235 | enum MorphTypes{ |
| RyoheiHagimoto | 0:0e0631af0305 | 236 | MORPH_ERODE = 0, //!< see cv::erode |
| RyoheiHagimoto | 0:0e0631af0305 | 237 | MORPH_DILATE = 1, //!< see cv::dilate |
| RyoheiHagimoto | 0:0e0631af0305 | 238 | MORPH_OPEN = 2, //!< an opening operation |
| RyoheiHagimoto | 0:0e0631af0305 | 239 | //!< \f[\texttt{dst} = \mathrm{open} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \mathrm{erode} ( \texttt{src} , \texttt{element} ))\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 240 | MORPH_CLOSE = 3, //!< a closing operation |
| RyoheiHagimoto | 0:0e0631af0305 | 241 | //!< \f[\texttt{dst} = \mathrm{close} ( \texttt{src} , \texttt{element} )= \mathrm{erode} ( \mathrm{dilate} ( \texttt{src} , \texttt{element} ))\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 242 | MORPH_GRADIENT = 4, //!< a morphological gradient |
| RyoheiHagimoto | 0:0e0631af0305 | 243 | //!< \f[\texttt{dst} = \mathrm{morph\_grad} ( \texttt{src} , \texttt{element} )= \mathrm{dilate} ( \texttt{src} , \texttt{element} )- \mathrm{erode} ( \texttt{src} , \texttt{element} )\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 244 | MORPH_TOPHAT = 5, //!< "top hat" |
| RyoheiHagimoto | 0:0e0631af0305 | 245 | //!< \f[\texttt{dst} = \mathrm{tophat} ( \texttt{src} , \texttt{element} )= \texttt{src} - \mathrm{open} ( \texttt{src} , \texttt{element} )\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 246 | MORPH_BLACKHAT = 6, //!< "black hat" |
| RyoheiHagimoto | 0:0e0631af0305 | 247 | //!< \f[\texttt{dst} = \mathrm{blackhat} ( \texttt{src} , \texttt{element} )= \mathrm{close} ( \texttt{src} , \texttt{element} )- \texttt{src}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 248 | MORPH_HITMISS = 7 //!< "hit and miss" |
| RyoheiHagimoto | 0:0e0631af0305 | 249 | //!< .- Only supported for CV_8UC1 binary images. Tutorial can be found in [this page](https://web.archive.org/web/20160316070407/http://opencv-code.com/tutorials/hit-or-miss-transform-in-opencv/) |
| RyoheiHagimoto | 0:0e0631af0305 | 250 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 251 | |
| RyoheiHagimoto | 0:0e0631af0305 | 252 | //! shape of the structuring element |
| RyoheiHagimoto | 0:0e0631af0305 | 253 | enum MorphShapes { |
| RyoheiHagimoto | 0:0e0631af0305 | 254 | MORPH_RECT = 0, //!< a rectangular structuring element: \f[E_{ij}=1\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 255 | MORPH_CROSS = 1, //!< a cross-shaped structuring element: |
| RyoheiHagimoto | 0:0e0631af0305 | 256 | //!< \f[E_{ij} = \fork{1}{if i=\texttt{anchor.y} or j=\texttt{anchor.x}}{0}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 257 | MORPH_ELLIPSE = 2 //!< an elliptic structuring element, that is, a filled ellipse inscribed |
| RyoheiHagimoto | 0:0e0631af0305 | 258 | //!< into the rectangle Rect(0, 0, esize.width, 0.esize.height) |
| RyoheiHagimoto | 0:0e0631af0305 | 259 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 260 | |
| RyoheiHagimoto | 0:0e0631af0305 | 261 | //! @} imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 262 | |
| RyoheiHagimoto | 0:0e0631af0305 | 263 | //! @addtogroup imgproc_transform |
| RyoheiHagimoto | 0:0e0631af0305 | 264 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 265 | |
| RyoheiHagimoto | 0:0e0631af0305 | 266 | //! interpolation algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 267 | enum InterpolationFlags{ |
| RyoheiHagimoto | 0:0e0631af0305 | 268 | /** nearest neighbor interpolation */ |
| RyoheiHagimoto | 0:0e0631af0305 | 269 | INTER_NEAREST = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 270 | /** bilinear interpolation */ |
| RyoheiHagimoto | 0:0e0631af0305 | 271 | INTER_LINEAR = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 272 | /** bicubic interpolation */ |
| RyoheiHagimoto | 0:0e0631af0305 | 273 | INTER_CUBIC = 2, |
| RyoheiHagimoto | 0:0e0631af0305 | 274 | /** resampling using pixel area relation. It may be a preferred method for image decimation, as |
| RyoheiHagimoto | 0:0e0631af0305 | 275 | it gives moire'-free results. But when the image is zoomed, it is similar to the INTER_NEAREST |
| RyoheiHagimoto | 0:0e0631af0305 | 276 | method. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 277 | INTER_AREA = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 278 | /** Lanczos interpolation over 8x8 neighborhood */ |
| RyoheiHagimoto | 0:0e0631af0305 | 279 | INTER_LANCZOS4 = 4, |
| RyoheiHagimoto | 0:0e0631af0305 | 280 | /** mask for interpolation codes */ |
| RyoheiHagimoto | 0:0e0631af0305 | 281 | INTER_MAX = 7, |
| RyoheiHagimoto | 0:0e0631af0305 | 282 | /** flag, fills all of the destination image pixels. If some of them correspond to outliers in the |
| RyoheiHagimoto | 0:0e0631af0305 | 283 | source image, they are set to zero */ |
| RyoheiHagimoto | 0:0e0631af0305 | 284 | WARP_FILL_OUTLIERS = 8, |
| RyoheiHagimoto | 0:0e0631af0305 | 285 | /** flag, inverse transformation |
| RyoheiHagimoto | 0:0e0631af0305 | 286 | |
| RyoheiHagimoto | 0:0e0631af0305 | 287 | For example, @ref cv::linearPolar or @ref cv::logPolar transforms: |
| RyoheiHagimoto | 0:0e0631af0305 | 288 | - flag is __not__ set: \f$dst( \rho , \phi ) = src(x,y)\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 289 | - flag is set: \f$dst(x,y) = src( \rho , \phi )\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 290 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 291 | WARP_INVERSE_MAP = 16 |
| RyoheiHagimoto | 0:0e0631af0305 | 292 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 293 | |
| RyoheiHagimoto | 0:0e0631af0305 | 294 | enum InterpolationMasks { |
| RyoheiHagimoto | 0:0e0631af0305 | 295 | INTER_BITS = 5, |
| RyoheiHagimoto | 0:0e0631af0305 | 296 | INTER_BITS2 = INTER_BITS * 2, |
| RyoheiHagimoto | 0:0e0631af0305 | 297 | INTER_TAB_SIZE = 1 << INTER_BITS, |
| RyoheiHagimoto | 0:0e0631af0305 | 298 | INTER_TAB_SIZE2 = INTER_TAB_SIZE * INTER_TAB_SIZE |
| RyoheiHagimoto | 0:0e0631af0305 | 299 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 300 | |
| RyoheiHagimoto | 0:0e0631af0305 | 301 | //! @} imgproc_transform |
| RyoheiHagimoto | 0:0e0631af0305 | 302 | |
| RyoheiHagimoto | 0:0e0631af0305 | 303 | //! @addtogroup imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 304 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 305 | |
| RyoheiHagimoto | 0:0e0631af0305 | 306 | //! Distance types for Distance Transform and M-estimators |
| RyoheiHagimoto | 0:0e0631af0305 | 307 | //! @see cv::distanceTransform, cv::fitLine |
| RyoheiHagimoto | 0:0e0631af0305 | 308 | enum DistanceTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 309 | DIST_USER = -1, //!< User defined distance |
| RyoheiHagimoto | 0:0e0631af0305 | 310 | DIST_L1 = 1, //!< distance = |x1-x2| + |y1-y2| |
| RyoheiHagimoto | 0:0e0631af0305 | 311 | DIST_L2 = 2, //!< the simple euclidean distance |
| RyoheiHagimoto | 0:0e0631af0305 | 312 | DIST_C = 3, //!< distance = max(|x1-x2|,|y1-y2|) |
| RyoheiHagimoto | 0:0e0631af0305 | 313 | DIST_L12 = 4, //!< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) |
| RyoheiHagimoto | 0:0e0631af0305 | 314 | DIST_FAIR = 5, //!< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 |
| RyoheiHagimoto | 0:0e0631af0305 | 315 | DIST_WELSCH = 6, //!< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 |
| RyoheiHagimoto | 0:0e0631af0305 | 316 | DIST_HUBER = 7 //!< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 |
| RyoheiHagimoto | 0:0e0631af0305 | 317 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 318 | |
| RyoheiHagimoto | 0:0e0631af0305 | 319 | //! Mask size for distance transform |
| RyoheiHagimoto | 0:0e0631af0305 | 320 | enum DistanceTransformMasks { |
| RyoheiHagimoto | 0:0e0631af0305 | 321 | DIST_MASK_3 = 3, //!< mask=3 |
| RyoheiHagimoto | 0:0e0631af0305 | 322 | DIST_MASK_5 = 5, //!< mask=5 |
| RyoheiHagimoto | 0:0e0631af0305 | 323 | DIST_MASK_PRECISE = 0 //!< |
| RyoheiHagimoto | 0:0e0631af0305 | 324 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 325 | |
| RyoheiHagimoto | 0:0e0631af0305 | 326 | //! type of the threshold operation |
| RyoheiHagimoto | 0:0e0631af0305 | 327 | //!  |
| RyoheiHagimoto | 0:0e0631af0305 | 328 | enum ThresholdTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 329 | THRESH_BINARY = 0, //!< \f[\texttt{dst} (x,y) = \fork{\texttt{maxval}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 330 | THRESH_BINARY_INV = 1, //!< \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{maxval}}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 331 | THRESH_TRUNC = 2, //!< \f[\texttt{dst} (x,y) = \fork{\texttt{threshold}}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 332 | THRESH_TOZERO = 3, //!< \f[\texttt{dst} (x,y) = \fork{\texttt{src}(x,y)}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{0}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 333 | THRESH_TOZERO_INV = 4, //!< \f[\texttt{dst} (x,y) = \fork{0}{if \(\texttt{src}(x,y) > \texttt{thresh}\)}{\texttt{src}(x,y)}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 334 | THRESH_MASK = 7, |
| RyoheiHagimoto | 0:0e0631af0305 | 335 | THRESH_OTSU = 8, //!< flag, use Otsu algorithm to choose the optimal threshold value |
| RyoheiHagimoto | 0:0e0631af0305 | 336 | THRESH_TRIANGLE = 16 //!< flag, use Triangle algorithm to choose the optimal threshold value |
| RyoheiHagimoto | 0:0e0631af0305 | 337 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 338 | |
| RyoheiHagimoto | 0:0e0631af0305 | 339 | //! adaptive threshold algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 340 | //! see cv::adaptiveThreshold |
| RyoheiHagimoto | 0:0e0631af0305 | 341 | enum AdaptiveThresholdTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 342 | /** the threshold value \f$T(x,y)\f$ is a mean of the \f$\texttt{blockSize} \times |
| RyoheiHagimoto | 0:0e0631af0305 | 343 | \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$ minus C */ |
| RyoheiHagimoto | 0:0e0631af0305 | 344 | ADAPTIVE_THRESH_MEAN_C = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 345 | /** the threshold value \f$T(x, y)\f$ is a weighted sum (cross-correlation with a Gaussian |
| RyoheiHagimoto | 0:0e0631af0305 | 346 | window) of the \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood of \f$(x, y)\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 347 | minus C . The default sigma (standard deviation) is used for the specified blockSize . See |
| RyoheiHagimoto | 0:0e0631af0305 | 348 | cv::getGaussianKernel*/ |
| RyoheiHagimoto | 0:0e0631af0305 | 349 | ADAPTIVE_THRESH_GAUSSIAN_C = 1 |
| RyoheiHagimoto | 0:0e0631af0305 | 350 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 351 | |
| RyoheiHagimoto | 0:0e0631af0305 | 352 | //! cv::undistort mode |
| RyoheiHagimoto | 0:0e0631af0305 | 353 | enum UndistortTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 354 | PROJ_SPHERICAL_ORTHO = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 355 | PROJ_SPHERICAL_EQRECT = 1 |
| RyoheiHagimoto | 0:0e0631af0305 | 356 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 357 | |
| RyoheiHagimoto | 0:0e0631af0305 | 358 | //! class of the pixel in GrabCut algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 359 | enum GrabCutClasses { |
| RyoheiHagimoto | 0:0e0631af0305 | 360 | GC_BGD = 0, //!< an obvious background pixels |
| RyoheiHagimoto | 0:0e0631af0305 | 361 | GC_FGD = 1, //!< an obvious foreground (object) pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 362 | GC_PR_BGD = 2, //!< a possible background pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 363 | GC_PR_FGD = 3 //!< a possible foreground pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 364 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 365 | |
| RyoheiHagimoto | 0:0e0631af0305 | 366 | //! GrabCut algorithm flags |
| RyoheiHagimoto | 0:0e0631af0305 | 367 | enum GrabCutModes { |
| RyoheiHagimoto | 0:0e0631af0305 | 368 | /** The function initializes the state and the mask using the provided rectangle. After that it |
| RyoheiHagimoto | 0:0e0631af0305 | 369 | runs iterCount iterations of the algorithm. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 370 | GC_INIT_WITH_RECT = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 371 | /** The function initializes the state using the provided mask. Note that GC_INIT_WITH_RECT |
| RyoheiHagimoto | 0:0e0631af0305 | 372 | and GC_INIT_WITH_MASK can be combined. Then, all the pixels outside of the ROI are |
| RyoheiHagimoto | 0:0e0631af0305 | 373 | automatically initialized with GC_BGD .*/ |
| RyoheiHagimoto | 0:0e0631af0305 | 374 | GC_INIT_WITH_MASK = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 375 | /** The value means that the algorithm should just resume. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 376 | GC_EVAL = 2 |
| RyoheiHagimoto | 0:0e0631af0305 | 377 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 378 | |
| RyoheiHagimoto | 0:0e0631af0305 | 379 | //! distanceTransform algorithm flags |
| RyoheiHagimoto | 0:0e0631af0305 | 380 | enum DistanceTransformLabelTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 381 | /** each connected component of zeros in src (as well as all the non-zero pixels closest to the |
| RyoheiHagimoto | 0:0e0631af0305 | 382 | connected component) will be assigned the same label */ |
| RyoheiHagimoto | 0:0e0631af0305 | 383 | DIST_LABEL_CCOMP = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 384 | /** each zero pixel (and all the non-zero pixels closest to it) gets its own label. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 385 | DIST_LABEL_PIXEL = 1 |
| RyoheiHagimoto | 0:0e0631af0305 | 386 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 387 | |
| RyoheiHagimoto | 0:0e0631af0305 | 388 | //! floodfill algorithm flags |
| RyoheiHagimoto | 0:0e0631af0305 | 389 | enum FloodFillFlags { |
| RyoheiHagimoto | 0:0e0631af0305 | 390 | /** If set, the difference between the current pixel and seed pixel is considered. Otherwise, |
| RyoheiHagimoto | 0:0e0631af0305 | 391 | the difference between neighbor pixels is considered (that is, the range is floating). */ |
| RyoheiHagimoto | 0:0e0631af0305 | 392 | FLOODFILL_FIXED_RANGE = 1 << 16, |
| RyoheiHagimoto | 0:0e0631af0305 | 393 | /** If set, the function does not change the image ( newVal is ignored), and only fills the |
| RyoheiHagimoto | 0:0e0631af0305 | 394 | mask with the value specified in bits 8-16 of flags as described above. This option only make |
| RyoheiHagimoto | 0:0e0631af0305 | 395 | sense in function variants that have the mask parameter. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 396 | FLOODFILL_MASK_ONLY = 1 << 17 |
| RyoheiHagimoto | 0:0e0631af0305 | 397 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 398 | |
| RyoheiHagimoto | 0:0e0631af0305 | 399 | //! @} imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 400 | |
| RyoheiHagimoto | 0:0e0631af0305 | 401 | //! @addtogroup imgproc_shape |
| RyoheiHagimoto | 0:0e0631af0305 | 402 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 403 | |
| RyoheiHagimoto | 0:0e0631af0305 | 404 | //! connected components algorithm output formats |
| RyoheiHagimoto | 0:0e0631af0305 | 405 | enum ConnectedComponentsTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 406 | CC_STAT_LEFT = 0, //!< The leftmost (x) coordinate which is the inclusive start of the bounding |
| RyoheiHagimoto | 0:0e0631af0305 | 407 | //!< box in the horizontal direction. |
| RyoheiHagimoto | 0:0e0631af0305 | 408 | CC_STAT_TOP = 1, //!< The topmost (y) coordinate which is the inclusive start of the bounding |
| RyoheiHagimoto | 0:0e0631af0305 | 409 | //!< box in the vertical direction. |
| RyoheiHagimoto | 0:0e0631af0305 | 410 | CC_STAT_WIDTH = 2, //!< The horizontal size of the bounding box |
| RyoheiHagimoto | 0:0e0631af0305 | 411 | CC_STAT_HEIGHT = 3, //!< The vertical size of the bounding box |
| RyoheiHagimoto | 0:0e0631af0305 | 412 | CC_STAT_AREA = 4, //!< The total area (in pixels) of the connected component |
| RyoheiHagimoto | 0:0e0631af0305 | 413 | CC_STAT_MAX = 5 |
| RyoheiHagimoto | 0:0e0631af0305 | 414 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 415 | |
| RyoheiHagimoto | 0:0e0631af0305 | 416 | //! connected components algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 417 | enum ConnectedComponentsAlgorithmsTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 418 | CCL_WU = 0, //!< SAUF algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity |
| RyoheiHagimoto | 0:0e0631af0305 | 419 | CCL_DEFAULT = -1, //!< BBDT algortihm for 8-way connectivity, SAUF algorithm for 4-way connectivity |
| RyoheiHagimoto | 0:0e0631af0305 | 420 | CCL_GRANA = 1 //!< BBDT algorithm for 8-way connectivity, SAUF algorithm for 4-way connectivity |
| RyoheiHagimoto | 0:0e0631af0305 | 421 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 422 | |
| RyoheiHagimoto | 0:0e0631af0305 | 423 | //! mode of the contour retrieval algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 424 | enum RetrievalModes { |
| RyoheiHagimoto | 0:0e0631af0305 | 425 | /** retrieves only the extreme outer contours. It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for |
| RyoheiHagimoto | 0:0e0631af0305 | 426 | all the contours. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 427 | RETR_EXTERNAL = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 428 | /** retrieves all of the contours without establishing any hierarchical relationships. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 429 | RETR_LIST = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 430 | /** retrieves all of the contours and organizes them into a two-level hierarchy. At the top |
| RyoheiHagimoto | 0:0e0631af0305 | 431 | level, there are external boundaries of the components. At the second level, there are |
| RyoheiHagimoto | 0:0e0631af0305 | 432 | boundaries of the holes. If there is another contour inside a hole of a connected component, it |
| RyoheiHagimoto | 0:0e0631af0305 | 433 | is still put at the top level. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 434 | RETR_CCOMP = 2, |
| RyoheiHagimoto | 0:0e0631af0305 | 435 | /** retrieves all of the contours and reconstructs a full hierarchy of nested contours.*/ |
| RyoheiHagimoto | 0:0e0631af0305 | 436 | RETR_TREE = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 437 | RETR_FLOODFILL = 4 //!< |
| RyoheiHagimoto | 0:0e0631af0305 | 438 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 439 | |
| RyoheiHagimoto | 0:0e0631af0305 | 440 | //! the contour approximation algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 441 | enum ContourApproximationModes { |
| RyoheiHagimoto | 0:0e0631af0305 | 442 | /** stores absolutely all the contour points. That is, any 2 subsequent points (x1,y1) and |
| RyoheiHagimoto | 0:0e0631af0305 | 443 | (x2,y2) of the contour will be either horizontal, vertical or diagonal neighbors, that is, |
| RyoheiHagimoto | 0:0e0631af0305 | 444 | max(abs(x1-x2),abs(y2-y1))==1. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 445 | CHAIN_APPROX_NONE = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 446 | /** compresses horizontal, vertical, and diagonal segments and leaves only their end points. |
| RyoheiHagimoto | 0:0e0631af0305 | 447 | For example, an up-right rectangular contour is encoded with 4 points. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 448 | CHAIN_APPROX_SIMPLE = 2, |
| RyoheiHagimoto | 0:0e0631af0305 | 449 | /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */ |
| RyoheiHagimoto | 0:0e0631af0305 | 450 | CHAIN_APPROX_TC89_L1 = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 451 | /** applies one of the flavors of the Teh-Chin chain approximation algorithm @cite TehChin89 */ |
| RyoheiHagimoto | 0:0e0631af0305 | 452 | CHAIN_APPROX_TC89_KCOS = 4 |
| RyoheiHagimoto | 0:0e0631af0305 | 453 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 454 | |
| RyoheiHagimoto | 0:0e0631af0305 | 455 | //! @} imgproc_shape |
| RyoheiHagimoto | 0:0e0631af0305 | 456 | |
| RyoheiHagimoto | 0:0e0631af0305 | 457 | //! Variants of a Hough transform |
| RyoheiHagimoto | 0:0e0631af0305 | 458 | enum HoughModes { |
| RyoheiHagimoto | 0:0e0631af0305 | 459 | |
| RyoheiHagimoto | 0:0e0631af0305 | 460 | /** classical or standard Hough transform. Every line is represented by two floating-point |
| RyoheiHagimoto | 0:0e0631af0305 | 461 | numbers \f$(\rho, \theta)\f$ , where \f$\rho\f$ is a distance between (0,0) point and the line, |
| RyoheiHagimoto | 0:0e0631af0305 | 462 | and \f$\theta\f$ is the angle between x-axis and the normal to the line. Thus, the matrix must |
| RyoheiHagimoto | 0:0e0631af0305 | 463 | be (the created sequence will be) of CV_32FC2 type */ |
| RyoheiHagimoto | 0:0e0631af0305 | 464 | HOUGH_STANDARD = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 465 | /** probabilistic Hough transform (more efficient in case if the picture contains a few long |
| RyoheiHagimoto | 0:0e0631af0305 | 466 | linear segments). It returns line segments rather than the whole line. Each segment is |
| RyoheiHagimoto | 0:0e0631af0305 | 467 | represented by starting and ending points, and the matrix must be (the created sequence will |
| RyoheiHagimoto | 0:0e0631af0305 | 468 | be) of the CV_32SC4 type. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 469 | HOUGH_PROBABILISTIC = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 470 | /** multi-scale variant of the classical Hough transform. The lines are encoded the same way as |
| RyoheiHagimoto | 0:0e0631af0305 | 471 | HOUGH_STANDARD. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 472 | HOUGH_MULTI_SCALE = 2, |
| RyoheiHagimoto | 0:0e0631af0305 | 473 | HOUGH_GRADIENT = 3 //!< basically *21HT*, described in @cite Yuen90 |
| RyoheiHagimoto | 0:0e0631af0305 | 474 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 475 | |
| RyoheiHagimoto | 0:0e0631af0305 | 476 | //! Variants of Line Segment %Detector |
| RyoheiHagimoto | 0:0e0631af0305 | 477 | //! @ingroup imgproc_feature |
| RyoheiHagimoto | 0:0e0631af0305 | 478 | enum LineSegmentDetectorModes { |
| RyoheiHagimoto | 0:0e0631af0305 | 479 | LSD_REFINE_NONE = 0, //!< No refinement applied |
| RyoheiHagimoto | 0:0e0631af0305 | 480 | LSD_REFINE_STD = 1, //!< Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations. |
| RyoheiHagimoto | 0:0e0631af0305 | 481 | LSD_REFINE_ADV = 2 //!< Advanced refinement. Number of false alarms is calculated, lines are |
| RyoheiHagimoto | 0:0e0631af0305 | 482 | //!< refined through increase of precision, decrement in size, etc. |
| RyoheiHagimoto | 0:0e0631af0305 | 483 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 484 | |
| RyoheiHagimoto | 0:0e0631af0305 | 485 | /** Histogram comparison methods |
| RyoheiHagimoto | 0:0e0631af0305 | 486 | @ingroup imgproc_hist |
| RyoheiHagimoto | 0:0e0631af0305 | 487 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 488 | enum HistCompMethods { |
| RyoheiHagimoto | 0:0e0631af0305 | 489 | /** Correlation |
| RyoheiHagimoto | 0:0e0631af0305 | 490 | \f[d(H_1,H_2) = \frac{\sum_I (H_1(I) - \bar{H_1}) (H_2(I) - \bar{H_2})}{\sqrt{\sum_I(H_1(I) - \bar{H_1})^2 \sum_I(H_2(I) - \bar{H_2})^2}}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 491 | where |
| RyoheiHagimoto | 0:0e0631af0305 | 492 | \f[\bar{H_k} = \frac{1}{N} \sum _J H_k(J)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 493 | and \f$N\f$ is a total number of histogram bins. */ |
| RyoheiHagimoto | 0:0e0631af0305 | 494 | HISTCMP_CORREL = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 495 | /** Chi-Square |
| RyoheiHagimoto | 0:0e0631af0305 | 496 | \f[d(H_1,H_2) = \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)}\f] */ |
| RyoheiHagimoto | 0:0e0631af0305 | 497 | HISTCMP_CHISQR = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 498 | /** Intersection |
| RyoheiHagimoto | 0:0e0631af0305 | 499 | \f[d(H_1,H_2) = \sum _I \min (H_1(I), H_2(I))\f] */ |
| RyoheiHagimoto | 0:0e0631af0305 | 500 | HISTCMP_INTERSECT = 2, |
| RyoheiHagimoto | 0:0e0631af0305 | 501 | /** Bhattacharyya distance |
| RyoheiHagimoto | 0:0e0631af0305 | 502 | (In fact, OpenCV computes Hellinger distance, which is related to Bhattacharyya coefficient.) |
| RyoheiHagimoto | 0:0e0631af0305 | 503 | \f[d(H_1,H_2) = \sqrt{1 - \frac{1}{\sqrt{\bar{H_1} \bar{H_2} N^2}} \sum_I \sqrt{H_1(I) \cdot H_2(I)}}\f] */ |
| RyoheiHagimoto | 0:0e0631af0305 | 504 | HISTCMP_BHATTACHARYYA = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 505 | HISTCMP_HELLINGER = HISTCMP_BHATTACHARYYA, //!< Synonym for HISTCMP_BHATTACHARYYA |
| RyoheiHagimoto | 0:0e0631af0305 | 506 | /** Alternative Chi-Square |
| RyoheiHagimoto | 0:0e0631af0305 | 507 | \f[d(H_1,H_2) = 2 * \sum _I \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 508 | This alternative formula is regularly used for texture comparison. See e.g. @cite Puzicha1997 */ |
| RyoheiHagimoto | 0:0e0631af0305 | 509 | HISTCMP_CHISQR_ALT = 4, |
| RyoheiHagimoto | 0:0e0631af0305 | 510 | /** Kullback-Leibler divergence |
| RyoheiHagimoto | 0:0e0631af0305 | 511 | \f[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\f] */ |
| RyoheiHagimoto | 0:0e0631af0305 | 512 | HISTCMP_KL_DIV = 5 |
| RyoheiHagimoto | 0:0e0631af0305 | 513 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 514 | |
| RyoheiHagimoto | 0:0e0631af0305 | 515 | /** the color conversion code |
| RyoheiHagimoto | 0:0e0631af0305 | 516 | @see @ref imgproc_color_conversions |
| RyoheiHagimoto | 0:0e0631af0305 | 517 | @ingroup imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 518 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 519 | enum ColorConversionCodes { |
| RyoheiHagimoto | 0:0e0631af0305 | 520 | COLOR_BGR2BGRA = 0, //!< add alpha channel to RGB or BGR image |
| RyoheiHagimoto | 0:0e0631af0305 | 521 | COLOR_RGB2RGBA = COLOR_BGR2BGRA, |
| RyoheiHagimoto | 0:0e0631af0305 | 522 | |
| RyoheiHagimoto | 0:0e0631af0305 | 523 | COLOR_BGRA2BGR = 1, //!< remove alpha channel from RGB or BGR image |
| RyoheiHagimoto | 0:0e0631af0305 | 524 | COLOR_RGBA2RGB = COLOR_BGRA2BGR, |
| RyoheiHagimoto | 0:0e0631af0305 | 525 | |
| RyoheiHagimoto | 0:0e0631af0305 | 526 | COLOR_BGR2RGBA = 2, //!< convert between RGB and BGR color spaces (with or without alpha channel) |
| RyoheiHagimoto | 0:0e0631af0305 | 527 | COLOR_RGB2BGRA = COLOR_BGR2RGBA, |
| RyoheiHagimoto | 0:0e0631af0305 | 528 | |
| RyoheiHagimoto | 0:0e0631af0305 | 529 | COLOR_RGBA2BGR = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 530 | COLOR_BGRA2RGB = COLOR_RGBA2BGR, |
| RyoheiHagimoto | 0:0e0631af0305 | 531 | |
| RyoheiHagimoto | 0:0e0631af0305 | 532 | COLOR_BGR2RGB = 4, |
| RyoheiHagimoto | 0:0e0631af0305 | 533 | COLOR_RGB2BGR = COLOR_BGR2RGB, |
| RyoheiHagimoto | 0:0e0631af0305 | 534 | |
| RyoheiHagimoto | 0:0e0631af0305 | 535 | COLOR_BGRA2RGBA = 5, |
| RyoheiHagimoto | 0:0e0631af0305 | 536 | COLOR_RGBA2BGRA = COLOR_BGRA2RGBA, |
| RyoheiHagimoto | 0:0e0631af0305 | 537 | |
| RyoheiHagimoto | 0:0e0631af0305 | 538 | COLOR_BGR2GRAY = 6, //!< convert between RGB/BGR and grayscale, @ref color_convert_rgb_gray "color conversions" |
| RyoheiHagimoto | 0:0e0631af0305 | 539 | COLOR_RGB2GRAY = 7, |
| RyoheiHagimoto | 0:0e0631af0305 | 540 | COLOR_GRAY2BGR = 8, |
| RyoheiHagimoto | 0:0e0631af0305 | 541 | COLOR_GRAY2RGB = COLOR_GRAY2BGR, |
| RyoheiHagimoto | 0:0e0631af0305 | 542 | COLOR_GRAY2BGRA = 9, |
| RyoheiHagimoto | 0:0e0631af0305 | 543 | COLOR_GRAY2RGBA = COLOR_GRAY2BGRA, |
| RyoheiHagimoto | 0:0e0631af0305 | 544 | COLOR_BGRA2GRAY = 10, |
| RyoheiHagimoto | 0:0e0631af0305 | 545 | COLOR_RGBA2GRAY = 11, |
| RyoheiHagimoto | 0:0e0631af0305 | 546 | |
| RyoheiHagimoto | 0:0e0631af0305 | 547 | COLOR_BGR2BGR565 = 12, //!< convert between RGB/BGR and BGR565 (16-bit images) |
| RyoheiHagimoto | 0:0e0631af0305 | 548 | COLOR_RGB2BGR565 = 13, |
| RyoheiHagimoto | 0:0e0631af0305 | 549 | COLOR_BGR5652BGR = 14, |
| RyoheiHagimoto | 0:0e0631af0305 | 550 | COLOR_BGR5652RGB = 15, |
| RyoheiHagimoto | 0:0e0631af0305 | 551 | COLOR_BGRA2BGR565 = 16, |
| RyoheiHagimoto | 0:0e0631af0305 | 552 | COLOR_RGBA2BGR565 = 17, |
| RyoheiHagimoto | 0:0e0631af0305 | 553 | COLOR_BGR5652BGRA = 18, |
| RyoheiHagimoto | 0:0e0631af0305 | 554 | COLOR_BGR5652RGBA = 19, |
| RyoheiHagimoto | 0:0e0631af0305 | 555 | |
| RyoheiHagimoto | 0:0e0631af0305 | 556 | COLOR_GRAY2BGR565 = 20, //!< convert between grayscale to BGR565 (16-bit images) |
| RyoheiHagimoto | 0:0e0631af0305 | 557 | COLOR_BGR5652GRAY = 21, |
| RyoheiHagimoto | 0:0e0631af0305 | 558 | |
| RyoheiHagimoto | 0:0e0631af0305 | 559 | COLOR_BGR2BGR555 = 22, //!< convert between RGB/BGR and BGR555 (16-bit images) |
| RyoheiHagimoto | 0:0e0631af0305 | 560 | COLOR_RGB2BGR555 = 23, |
| RyoheiHagimoto | 0:0e0631af0305 | 561 | COLOR_BGR5552BGR = 24, |
| RyoheiHagimoto | 0:0e0631af0305 | 562 | COLOR_BGR5552RGB = 25, |
| RyoheiHagimoto | 0:0e0631af0305 | 563 | COLOR_BGRA2BGR555 = 26, |
| RyoheiHagimoto | 0:0e0631af0305 | 564 | COLOR_RGBA2BGR555 = 27, |
| RyoheiHagimoto | 0:0e0631af0305 | 565 | COLOR_BGR5552BGRA = 28, |
| RyoheiHagimoto | 0:0e0631af0305 | 566 | COLOR_BGR5552RGBA = 29, |
| RyoheiHagimoto | 0:0e0631af0305 | 567 | |
| RyoheiHagimoto | 0:0e0631af0305 | 568 | COLOR_GRAY2BGR555 = 30, //!< convert between grayscale and BGR555 (16-bit images) |
| RyoheiHagimoto | 0:0e0631af0305 | 569 | COLOR_BGR5552GRAY = 31, |
| RyoheiHagimoto | 0:0e0631af0305 | 570 | |
| RyoheiHagimoto | 0:0e0631af0305 | 571 | COLOR_BGR2XYZ = 32, //!< convert RGB/BGR to CIE XYZ, @ref color_convert_rgb_xyz "color conversions" |
| RyoheiHagimoto | 0:0e0631af0305 | 572 | COLOR_RGB2XYZ = 33, |
| RyoheiHagimoto | 0:0e0631af0305 | 573 | COLOR_XYZ2BGR = 34, |
| RyoheiHagimoto | 0:0e0631af0305 | 574 | COLOR_XYZ2RGB = 35, |
| RyoheiHagimoto | 0:0e0631af0305 | 575 | |
| RyoheiHagimoto | 0:0e0631af0305 | 576 | COLOR_BGR2YCrCb = 36, //!< convert RGB/BGR to luma-chroma (aka YCC), @ref color_convert_rgb_ycrcb "color conversions" |
| RyoheiHagimoto | 0:0e0631af0305 | 577 | COLOR_RGB2YCrCb = 37, |
| RyoheiHagimoto | 0:0e0631af0305 | 578 | COLOR_YCrCb2BGR = 38, |
| RyoheiHagimoto | 0:0e0631af0305 | 579 | COLOR_YCrCb2RGB = 39, |
| RyoheiHagimoto | 0:0e0631af0305 | 580 | |
| RyoheiHagimoto | 0:0e0631af0305 | 581 | COLOR_BGR2HSV = 40, //!< convert RGB/BGR to HSV (hue saturation value), @ref color_convert_rgb_hsv "color conversions" |
| RyoheiHagimoto | 0:0e0631af0305 | 582 | COLOR_RGB2HSV = 41, |
| RyoheiHagimoto | 0:0e0631af0305 | 583 | |
| RyoheiHagimoto | 0:0e0631af0305 | 584 | COLOR_BGR2Lab = 44, //!< convert RGB/BGR to CIE Lab, @ref color_convert_rgb_lab "color conversions" |
| RyoheiHagimoto | 0:0e0631af0305 | 585 | COLOR_RGB2Lab = 45, |
| RyoheiHagimoto | 0:0e0631af0305 | 586 | |
| RyoheiHagimoto | 0:0e0631af0305 | 587 | COLOR_BGR2Luv = 50, //!< convert RGB/BGR to CIE Luv, @ref color_convert_rgb_luv "color conversions" |
| RyoheiHagimoto | 0:0e0631af0305 | 588 | COLOR_RGB2Luv = 51, |
| RyoheiHagimoto | 0:0e0631af0305 | 589 | COLOR_BGR2HLS = 52, //!< convert RGB/BGR to HLS (hue lightness saturation), @ref color_convert_rgb_hls "color conversions" |
| RyoheiHagimoto | 0:0e0631af0305 | 590 | COLOR_RGB2HLS = 53, |
| RyoheiHagimoto | 0:0e0631af0305 | 591 | |
| RyoheiHagimoto | 0:0e0631af0305 | 592 | COLOR_HSV2BGR = 54, //!< backward conversions to RGB/BGR |
| RyoheiHagimoto | 0:0e0631af0305 | 593 | COLOR_HSV2RGB = 55, |
| RyoheiHagimoto | 0:0e0631af0305 | 594 | |
| RyoheiHagimoto | 0:0e0631af0305 | 595 | COLOR_Lab2BGR = 56, |
| RyoheiHagimoto | 0:0e0631af0305 | 596 | COLOR_Lab2RGB = 57, |
| RyoheiHagimoto | 0:0e0631af0305 | 597 | COLOR_Luv2BGR = 58, |
| RyoheiHagimoto | 0:0e0631af0305 | 598 | COLOR_Luv2RGB = 59, |
| RyoheiHagimoto | 0:0e0631af0305 | 599 | COLOR_HLS2BGR = 60, |
| RyoheiHagimoto | 0:0e0631af0305 | 600 | COLOR_HLS2RGB = 61, |
| RyoheiHagimoto | 0:0e0631af0305 | 601 | |
| RyoheiHagimoto | 0:0e0631af0305 | 602 | COLOR_BGR2HSV_FULL = 66, //!< |
| RyoheiHagimoto | 0:0e0631af0305 | 603 | COLOR_RGB2HSV_FULL = 67, |
| RyoheiHagimoto | 0:0e0631af0305 | 604 | COLOR_BGR2HLS_FULL = 68, |
| RyoheiHagimoto | 0:0e0631af0305 | 605 | COLOR_RGB2HLS_FULL = 69, |
| RyoheiHagimoto | 0:0e0631af0305 | 606 | |
| RyoheiHagimoto | 0:0e0631af0305 | 607 | COLOR_HSV2BGR_FULL = 70, |
| RyoheiHagimoto | 0:0e0631af0305 | 608 | COLOR_HSV2RGB_FULL = 71, |
| RyoheiHagimoto | 0:0e0631af0305 | 609 | COLOR_HLS2BGR_FULL = 72, |
| RyoheiHagimoto | 0:0e0631af0305 | 610 | COLOR_HLS2RGB_FULL = 73, |
| RyoheiHagimoto | 0:0e0631af0305 | 611 | |
| RyoheiHagimoto | 0:0e0631af0305 | 612 | COLOR_LBGR2Lab = 74, |
| RyoheiHagimoto | 0:0e0631af0305 | 613 | COLOR_LRGB2Lab = 75, |
| RyoheiHagimoto | 0:0e0631af0305 | 614 | COLOR_LBGR2Luv = 76, |
| RyoheiHagimoto | 0:0e0631af0305 | 615 | COLOR_LRGB2Luv = 77, |
| RyoheiHagimoto | 0:0e0631af0305 | 616 | |
| RyoheiHagimoto | 0:0e0631af0305 | 617 | COLOR_Lab2LBGR = 78, |
| RyoheiHagimoto | 0:0e0631af0305 | 618 | COLOR_Lab2LRGB = 79, |
| RyoheiHagimoto | 0:0e0631af0305 | 619 | COLOR_Luv2LBGR = 80, |
| RyoheiHagimoto | 0:0e0631af0305 | 620 | COLOR_Luv2LRGB = 81, |
| RyoheiHagimoto | 0:0e0631af0305 | 621 | |
| RyoheiHagimoto | 0:0e0631af0305 | 622 | COLOR_BGR2YUV = 82, //!< convert between RGB/BGR and YUV |
| RyoheiHagimoto | 0:0e0631af0305 | 623 | COLOR_RGB2YUV = 83, |
| RyoheiHagimoto | 0:0e0631af0305 | 624 | COLOR_YUV2BGR = 84, |
| RyoheiHagimoto | 0:0e0631af0305 | 625 | COLOR_YUV2RGB = 85, |
| RyoheiHagimoto | 0:0e0631af0305 | 626 | |
| RyoheiHagimoto | 0:0e0631af0305 | 627 | //! YUV 4:2:0 family to RGB |
| RyoheiHagimoto | 0:0e0631af0305 | 628 | COLOR_YUV2RGB_NV12 = 90, |
| RyoheiHagimoto | 0:0e0631af0305 | 629 | COLOR_YUV2BGR_NV12 = 91, |
| RyoheiHagimoto | 0:0e0631af0305 | 630 | COLOR_YUV2RGB_NV21 = 92, |
| RyoheiHagimoto | 0:0e0631af0305 | 631 | COLOR_YUV2BGR_NV21 = 93, |
| RyoheiHagimoto | 0:0e0631af0305 | 632 | COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21, |
| RyoheiHagimoto | 0:0e0631af0305 | 633 | COLOR_YUV420sp2BGR = COLOR_YUV2BGR_NV21, |
| RyoheiHagimoto | 0:0e0631af0305 | 634 | |
| RyoheiHagimoto | 0:0e0631af0305 | 635 | COLOR_YUV2RGBA_NV12 = 94, |
| RyoheiHagimoto | 0:0e0631af0305 | 636 | COLOR_YUV2BGRA_NV12 = 95, |
| RyoheiHagimoto | 0:0e0631af0305 | 637 | COLOR_YUV2RGBA_NV21 = 96, |
| RyoheiHagimoto | 0:0e0631af0305 | 638 | COLOR_YUV2BGRA_NV21 = 97, |
| RyoheiHagimoto | 0:0e0631af0305 | 639 | COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21, |
| RyoheiHagimoto | 0:0e0631af0305 | 640 | COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21, |
| RyoheiHagimoto | 0:0e0631af0305 | 641 | |
| RyoheiHagimoto | 0:0e0631af0305 | 642 | COLOR_YUV2RGB_YV12 = 98, |
| RyoheiHagimoto | 0:0e0631af0305 | 643 | COLOR_YUV2BGR_YV12 = 99, |
| RyoheiHagimoto | 0:0e0631af0305 | 644 | COLOR_YUV2RGB_IYUV = 100, |
| RyoheiHagimoto | 0:0e0631af0305 | 645 | COLOR_YUV2BGR_IYUV = 101, |
| RyoheiHagimoto | 0:0e0631af0305 | 646 | COLOR_YUV2RGB_I420 = COLOR_YUV2RGB_IYUV, |
| RyoheiHagimoto | 0:0e0631af0305 | 647 | COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV, |
| RyoheiHagimoto | 0:0e0631af0305 | 648 | COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12, |
| RyoheiHagimoto | 0:0e0631af0305 | 649 | COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12, |
| RyoheiHagimoto | 0:0e0631af0305 | 650 | |
| RyoheiHagimoto | 0:0e0631af0305 | 651 | COLOR_YUV2RGBA_YV12 = 102, |
| RyoheiHagimoto | 0:0e0631af0305 | 652 | COLOR_YUV2BGRA_YV12 = 103, |
| RyoheiHagimoto | 0:0e0631af0305 | 653 | COLOR_YUV2RGBA_IYUV = 104, |
| RyoheiHagimoto | 0:0e0631af0305 | 654 | COLOR_YUV2BGRA_IYUV = 105, |
| RyoheiHagimoto | 0:0e0631af0305 | 655 | COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV, |
| RyoheiHagimoto | 0:0e0631af0305 | 656 | COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV, |
| RyoheiHagimoto | 0:0e0631af0305 | 657 | COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12, |
| RyoheiHagimoto | 0:0e0631af0305 | 658 | COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12, |
| RyoheiHagimoto | 0:0e0631af0305 | 659 | |
| RyoheiHagimoto | 0:0e0631af0305 | 660 | COLOR_YUV2GRAY_420 = 106, |
| RyoheiHagimoto | 0:0e0631af0305 | 661 | COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420, |
| RyoheiHagimoto | 0:0e0631af0305 | 662 | COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420, |
| RyoheiHagimoto | 0:0e0631af0305 | 663 | COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420, |
| RyoheiHagimoto | 0:0e0631af0305 | 664 | COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420, |
| RyoheiHagimoto | 0:0e0631af0305 | 665 | COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420, |
| RyoheiHagimoto | 0:0e0631af0305 | 666 | COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420, |
| RyoheiHagimoto | 0:0e0631af0305 | 667 | COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420, |
| RyoheiHagimoto | 0:0e0631af0305 | 668 | |
| RyoheiHagimoto | 0:0e0631af0305 | 669 | //! YUV 4:2:2 family to RGB |
| RyoheiHagimoto | 0:0e0631af0305 | 670 | COLOR_YUV2RGB_UYVY = 107, |
| RyoheiHagimoto | 0:0e0631af0305 | 671 | COLOR_YUV2BGR_UYVY = 108, |
| RyoheiHagimoto | 0:0e0631af0305 | 672 | //COLOR_YUV2RGB_VYUY = 109, |
| RyoheiHagimoto | 0:0e0631af0305 | 673 | //COLOR_YUV2BGR_VYUY = 110, |
| RyoheiHagimoto | 0:0e0631af0305 | 674 | COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 675 | COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 676 | COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 677 | COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 678 | |
| RyoheiHagimoto | 0:0e0631af0305 | 679 | COLOR_YUV2RGBA_UYVY = 111, |
| RyoheiHagimoto | 0:0e0631af0305 | 680 | COLOR_YUV2BGRA_UYVY = 112, |
| RyoheiHagimoto | 0:0e0631af0305 | 681 | //COLOR_YUV2RGBA_VYUY = 113, |
| RyoheiHagimoto | 0:0e0631af0305 | 682 | //COLOR_YUV2BGRA_VYUY = 114, |
| RyoheiHagimoto | 0:0e0631af0305 | 683 | COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 684 | COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 685 | COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 686 | COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 687 | |
| RyoheiHagimoto | 0:0e0631af0305 | 688 | COLOR_YUV2RGB_YUY2 = 115, |
| RyoheiHagimoto | 0:0e0631af0305 | 689 | COLOR_YUV2BGR_YUY2 = 116, |
| RyoheiHagimoto | 0:0e0631af0305 | 690 | COLOR_YUV2RGB_YVYU = 117, |
| RyoheiHagimoto | 0:0e0631af0305 | 691 | COLOR_YUV2BGR_YVYU = 118, |
| RyoheiHagimoto | 0:0e0631af0305 | 692 | COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 693 | COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 694 | COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 695 | COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 696 | |
| RyoheiHagimoto | 0:0e0631af0305 | 697 | COLOR_YUV2RGBA_YUY2 = 119, |
| RyoheiHagimoto | 0:0e0631af0305 | 698 | COLOR_YUV2BGRA_YUY2 = 120, |
| RyoheiHagimoto | 0:0e0631af0305 | 699 | COLOR_YUV2RGBA_YVYU = 121, |
| RyoheiHagimoto | 0:0e0631af0305 | 700 | COLOR_YUV2BGRA_YVYU = 122, |
| RyoheiHagimoto | 0:0e0631af0305 | 701 | COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 702 | COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 703 | COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 704 | COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 705 | |
| RyoheiHagimoto | 0:0e0631af0305 | 706 | COLOR_YUV2GRAY_UYVY = 123, |
| RyoheiHagimoto | 0:0e0631af0305 | 707 | COLOR_YUV2GRAY_YUY2 = 124, |
| RyoheiHagimoto | 0:0e0631af0305 | 708 | //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 709 | COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 710 | COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY, |
| RyoheiHagimoto | 0:0e0631af0305 | 711 | COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 712 | COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 713 | COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2, |
| RyoheiHagimoto | 0:0e0631af0305 | 714 | |
| RyoheiHagimoto | 0:0e0631af0305 | 715 | //! alpha premultiplication |
| RyoheiHagimoto | 0:0e0631af0305 | 716 | COLOR_RGBA2mRGBA = 125, |
| RyoheiHagimoto | 0:0e0631af0305 | 717 | COLOR_mRGBA2RGBA = 126, |
| RyoheiHagimoto | 0:0e0631af0305 | 718 | |
| RyoheiHagimoto | 0:0e0631af0305 | 719 | //! RGB to YUV 4:2:0 family |
| RyoheiHagimoto | 0:0e0631af0305 | 720 | COLOR_RGB2YUV_I420 = 127, |
| RyoheiHagimoto | 0:0e0631af0305 | 721 | COLOR_BGR2YUV_I420 = 128, |
| RyoheiHagimoto | 0:0e0631af0305 | 722 | COLOR_RGB2YUV_IYUV = COLOR_RGB2YUV_I420, |
| RyoheiHagimoto | 0:0e0631af0305 | 723 | COLOR_BGR2YUV_IYUV = COLOR_BGR2YUV_I420, |
| RyoheiHagimoto | 0:0e0631af0305 | 724 | |
| RyoheiHagimoto | 0:0e0631af0305 | 725 | COLOR_RGBA2YUV_I420 = 129, |
| RyoheiHagimoto | 0:0e0631af0305 | 726 | COLOR_BGRA2YUV_I420 = 130, |
| RyoheiHagimoto | 0:0e0631af0305 | 727 | COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420, |
| RyoheiHagimoto | 0:0e0631af0305 | 728 | COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420, |
| RyoheiHagimoto | 0:0e0631af0305 | 729 | COLOR_RGB2YUV_YV12 = 131, |
| RyoheiHagimoto | 0:0e0631af0305 | 730 | COLOR_BGR2YUV_YV12 = 132, |
| RyoheiHagimoto | 0:0e0631af0305 | 731 | COLOR_RGBA2YUV_YV12 = 133, |
| RyoheiHagimoto | 0:0e0631af0305 | 732 | COLOR_BGRA2YUV_YV12 = 134, |
| RyoheiHagimoto | 0:0e0631af0305 | 733 | |
| RyoheiHagimoto | 0:0e0631af0305 | 734 | //! Demosaicing |
| RyoheiHagimoto | 0:0e0631af0305 | 735 | COLOR_BayerBG2BGR = 46, |
| RyoheiHagimoto | 0:0e0631af0305 | 736 | COLOR_BayerGB2BGR = 47, |
| RyoheiHagimoto | 0:0e0631af0305 | 737 | COLOR_BayerRG2BGR = 48, |
| RyoheiHagimoto | 0:0e0631af0305 | 738 | COLOR_BayerGR2BGR = 49, |
| RyoheiHagimoto | 0:0e0631af0305 | 739 | |
| RyoheiHagimoto | 0:0e0631af0305 | 740 | COLOR_BayerBG2RGB = COLOR_BayerRG2BGR, |
| RyoheiHagimoto | 0:0e0631af0305 | 741 | COLOR_BayerGB2RGB = COLOR_BayerGR2BGR, |
| RyoheiHagimoto | 0:0e0631af0305 | 742 | COLOR_BayerRG2RGB = COLOR_BayerBG2BGR, |
| RyoheiHagimoto | 0:0e0631af0305 | 743 | COLOR_BayerGR2RGB = COLOR_BayerGB2BGR, |
| RyoheiHagimoto | 0:0e0631af0305 | 744 | |
| RyoheiHagimoto | 0:0e0631af0305 | 745 | COLOR_BayerBG2GRAY = 86, |
| RyoheiHagimoto | 0:0e0631af0305 | 746 | COLOR_BayerGB2GRAY = 87, |
| RyoheiHagimoto | 0:0e0631af0305 | 747 | COLOR_BayerRG2GRAY = 88, |
| RyoheiHagimoto | 0:0e0631af0305 | 748 | COLOR_BayerGR2GRAY = 89, |
| RyoheiHagimoto | 0:0e0631af0305 | 749 | |
| RyoheiHagimoto | 0:0e0631af0305 | 750 | //! Demosaicing using Variable Number of Gradients |
| RyoheiHagimoto | 0:0e0631af0305 | 751 | COLOR_BayerBG2BGR_VNG = 62, |
| RyoheiHagimoto | 0:0e0631af0305 | 752 | COLOR_BayerGB2BGR_VNG = 63, |
| RyoheiHagimoto | 0:0e0631af0305 | 753 | COLOR_BayerRG2BGR_VNG = 64, |
| RyoheiHagimoto | 0:0e0631af0305 | 754 | COLOR_BayerGR2BGR_VNG = 65, |
| RyoheiHagimoto | 0:0e0631af0305 | 755 | |
| RyoheiHagimoto | 0:0e0631af0305 | 756 | COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG, |
| RyoheiHagimoto | 0:0e0631af0305 | 757 | COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG, |
| RyoheiHagimoto | 0:0e0631af0305 | 758 | COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG, |
| RyoheiHagimoto | 0:0e0631af0305 | 759 | COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG, |
| RyoheiHagimoto | 0:0e0631af0305 | 760 | |
| RyoheiHagimoto | 0:0e0631af0305 | 761 | //! Edge-Aware Demosaicing |
| RyoheiHagimoto | 0:0e0631af0305 | 762 | COLOR_BayerBG2BGR_EA = 135, |
| RyoheiHagimoto | 0:0e0631af0305 | 763 | COLOR_BayerGB2BGR_EA = 136, |
| RyoheiHagimoto | 0:0e0631af0305 | 764 | COLOR_BayerRG2BGR_EA = 137, |
| RyoheiHagimoto | 0:0e0631af0305 | 765 | COLOR_BayerGR2BGR_EA = 138, |
| RyoheiHagimoto | 0:0e0631af0305 | 766 | |
| RyoheiHagimoto | 0:0e0631af0305 | 767 | COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA, |
| RyoheiHagimoto | 0:0e0631af0305 | 768 | COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA, |
| RyoheiHagimoto | 0:0e0631af0305 | 769 | COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA, |
| RyoheiHagimoto | 0:0e0631af0305 | 770 | COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA, |
| RyoheiHagimoto | 0:0e0631af0305 | 771 | |
| RyoheiHagimoto | 0:0e0631af0305 | 772 | |
| RyoheiHagimoto | 0:0e0631af0305 | 773 | COLOR_COLORCVT_MAX = 139 |
| RyoheiHagimoto | 0:0e0631af0305 | 774 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 775 | |
| RyoheiHagimoto | 0:0e0631af0305 | 776 | /** types of intersection between rectangles |
| RyoheiHagimoto | 0:0e0631af0305 | 777 | @ingroup imgproc_shape |
| RyoheiHagimoto | 0:0e0631af0305 | 778 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 779 | enum RectanglesIntersectTypes { |
| RyoheiHagimoto | 0:0e0631af0305 | 780 | INTERSECT_NONE = 0, //!< No intersection |
| RyoheiHagimoto | 0:0e0631af0305 | 781 | INTERSECT_PARTIAL = 1, //!< There is a partial intersection |
| RyoheiHagimoto | 0:0e0631af0305 | 782 | INTERSECT_FULL = 2 //!< One of the rectangle is fully enclosed in the other |
| RyoheiHagimoto | 0:0e0631af0305 | 783 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 784 | |
| RyoheiHagimoto | 0:0e0631af0305 | 785 | //! finds arbitrary template in the grayscale image using Generalized Hough Transform |
| RyoheiHagimoto | 0:0e0631af0305 | 786 | class CV_EXPORTS GeneralizedHough : public Algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 787 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 788 | public: |
| RyoheiHagimoto | 0:0e0631af0305 | 789 | //! set template to search |
| RyoheiHagimoto | 0:0e0631af0305 | 790 | virtual void setTemplate(InputArray templ, Point templCenter = Point(-1, -1)) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 791 | virtual void setTemplate(InputArray edges, InputArray dx, InputArray dy, Point templCenter = Point(-1, -1)) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 792 | |
| RyoheiHagimoto | 0:0e0631af0305 | 793 | //! find template on image |
| RyoheiHagimoto | 0:0e0631af0305 | 794 | virtual void detect(InputArray image, OutputArray positions, OutputArray votes = noArray()) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 795 | virtual void detect(InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray votes = noArray()) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 796 | |
| RyoheiHagimoto | 0:0e0631af0305 | 797 | //! Canny low threshold. |
| RyoheiHagimoto | 0:0e0631af0305 | 798 | virtual void setCannyLowThresh(int cannyLowThresh) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 799 | virtual int getCannyLowThresh() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 800 | |
| RyoheiHagimoto | 0:0e0631af0305 | 801 | //! Canny high threshold. |
| RyoheiHagimoto | 0:0e0631af0305 | 802 | virtual void setCannyHighThresh(int cannyHighThresh) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 803 | virtual int getCannyHighThresh() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 804 | |
| RyoheiHagimoto | 0:0e0631af0305 | 805 | //! Minimum distance between the centers of the detected objects. |
| RyoheiHagimoto | 0:0e0631af0305 | 806 | virtual void setMinDist(double minDist) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 807 | virtual double getMinDist() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 808 | |
| RyoheiHagimoto | 0:0e0631af0305 | 809 | //! Inverse ratio of the accumulator resolution to the image resolution. |
| RyoheiHagimoto | 0:0e0631af0305 | 810 | virtual void setDp(double dp) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 811 | virtual double getDp() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 812 | |
| RyoheiHagimoto | 0:0e0631af0305 | 813 | //! Maximal size of inner buffers. |
| RyoheiHagimoto | 0:0e0631af0305 | 814 | virtual void setMaxBufferSize(int maxBufferSize) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 815 | virtual int getMaxBufferSize() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 816 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 817 | |
| RyoheiHagimoto | 0:0e0631af0305 | 818 | //! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122. |
| RyoheiHagimoto | 0:0e0631af0305 | 819 | //! Detects position only without traslation and rotation |
| RyoheiHagimoto | 0:0e0631af0305 | 820 | class CV_EXPORTS GeneralizedHoughBallard : public GeneralizedHough |
| RyoheiHagimoto | 0:0e0631af0305 | 821 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 822 | public: |
| RyoheiHagimoto | 0:0e0631af0305 | 823 | //! R-Table levels. |
| RyoheiHagimoto | 0:0e0631af0305 | 824 | virtual void setLevels(int levels) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 825 | virtual int getLevels() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 826 | |
| RyoheiHagimoto | 0:0e0631af0305 | 827 | //! The accumulator threshold for the template centers at the detection stage. The smaller it is, the more false positions may be detected. |
| RyoheiHagimoto | 0:0e0631af0305 | 828 | virtual void setVotesThreshold(int votesThreshold) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 829 | virtual int getVotesThreshold() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 830 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 831 | |
| RyoheiHagimoto | 0:0e0631af0305 | 832 | //! Guil, N., González-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038. |
| RyoheiHagimoto | 0:0e0631af0305 | 833 | //! Detects position, traslation and rotation |
| RyoheiHagimoto | 0:0e0631af0305 | 834 | class CV_EXPORTS GeneralizedHoughGuil : public GeneralizedHough |
| RyoheiHagimoto | 0:0e0631af0305 | 835 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 836 | public: |
| RyoheiHagimoto | 0:0e0631af0305 | 837 | //! Angle difference in degrees between two points in feature. |
| RyoheiHagimoto | 0:0e0631af0305 | 838 | virtual void setXi(double xi) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 839 | virtual double getXi() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 840 | |
| RyoheiHagimoto | 0:0e0631af0305 | 841 | //! Feature table levels. |
| RyoheiHagimoto | 0:0e0631af0305 | 842 | virtual void setLevels(int levels) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 843 | virtual int getLevels() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 844 | |
| RyoheiHagimoto | 0:0e0631af0305 | 845 | //! Maximal difference between angles that treated as equal. |
| RyoheiHagimoto | 0:0e0631af0305 | 846 | virtual void setAngleEpsilon(double angleEpsilon) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 847 | virtual double getAngleEpsilon() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 848 | |
| RyoheiHagimoto | 0:0e0631af0305 | 849 | //! Minimal rotation angle to detect in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 850 | virtual void setMinAngle(double minAngle) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 851 | virtual double getMinAngle() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 852 | |
| RyoheiHagimoto | 0:0e0631af0305 | 853 | //! Maximal rotation angle to detect in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 854 | virtual void setMaxAngle(double maxAngle) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 855 | virtual double getMaxAngle() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 856 | |
| RyoheiHagimoto | 0:0e0631af0305 | 857 | //! Angle step in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 858 | virtual void setAngleStep(double angleStep) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 859 | virtual double getAngleStep() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 860 | |
| RyoheiHagimoto | 0:0e0631af0305 | 861 | //! Angle votes threshold. |
| RyoheiHagimoto | 0:0e0631af0305 | 862 | virtual void setAngleThresh(int angleThresh) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 863 | virtual int getAngleThresh() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 864 | |
| RyoheiHagimoto | 0:0e0631af0305 | 865 | //! Minimal scale to detect. |
| RyoheiHagimoto | 0:0e0631af0305 | 866 | virtual void setMinScale(double minScale) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 867 | virtual double getMinScale() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 868 | |
| RyoheiHagimoto | 0:0e0631af0305 | 869 | //! Maximal scale to detect. |
| RyoheiHagimoto | 0:0e0631af0305 | 870 | virtual void setMaxScale(double maxScale) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 871 | virtual double getMaxScale() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 872 | |
| RyoheiHagimoto | 0:0e0631af0305 | 873 | //! Scale step. |
| RyoheiHagimoto | 0:0e0631af0305 | 874 | virtual void setScaleStep(double scaleStep) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 875 | virtual double getScaleStep() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 876 | |
| RyoheiHagimoto | 0:0e0631af0305 | 877 | //! Scale votes threshold. |
| RyoheiHagimoto | 0:0e0631af0305 | 878 | virtual void setScaleThresh(int scaleThresh) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 879 | virtual int getScaleThresh() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 880 | |
| RyoheiHagimoto | 0:0e0631af0305 | 881 | //! Position votes threshold. |
| RyoheiHagimoto | 0:0e0631af0305 | 882 | virtual void setPosThresh(int posThresh) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 883 | virtual int getPosThresh() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 884 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 885 | |
| RyoheiHagimoto | 0:0e0631af0305 | 886 | |
| RyoheiHagimoto | 0:0e0631af0305 | 887 | class CV_EXPORTS_W CLAHE : public Algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 888 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 889 | public: |
| RyoheiHagimoto | 0:0e0631af0305 | 890 | CV_WRAP virtual void apply(InputArray src, OutputArray dst) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 891 | |
| RyoheiHagimoto | 0:0e0631af0305 | 892 | CV_WRAP virtual void setClipLimit(double clipLimit) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 893 | CV_WRAP virtual double getClipLimit() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 894 | |
| RyoheiHagimoto | 0:0e0631af0305 | 895 | CV_WRAP virtual void setTilesGridSize(Size tileGridSize) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 896 | CV_WRAP virtual Size getTilesGridSize() const = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 897 | |
| RyoheiHagimoto | 0:0e0631af0305 | 898 | CV_WRAP virtual void collectGarbage() = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 899 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 900 | |
| RyoheiHagimoto | 0:0e0631af0305 | 901 | |
| RyoheiHagimoto | 0:0e0631af0305 | 902 | //! @addtogroup imgproc_subdiv2d |
| RyoheiHagimoto | 0:0e0631af0305 | 903 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 904 | |
| RyoheiHagimoto | 0:0e0631af0305 | 905 | class CV_EXPORTS_W Subdiv2D |
| RyoheiHagimoto | 0:0e0631af0305 | 906 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 907 | public: |
| RyoheiHagimoto | 0:0e0631af0305 | 908 | /** Subdiv2D point location cases */ |
| RyoheiHagimoto | 0:0e0631af0305 | 909 | enum { PTLOC_ERROR = -2, //!< Point location error |
| RyoheiHagimoto | 0:0e0631af0305 | 910 | PTLOC_OUTSIDE_RECT = -1, //!< Point outside the subdivision bounding rect |
| RyoheiHagimoto | 0:0e0631af0305 | 911 | PTLOC_INSIDE = 0, //!< Point inside some facet |
| RyoheiHagimoto | 0:0e0631af0305 | 912 | PTLOC_VERTEX = 1, //!< Point coincides with one of the subdivision vertices |
| RyoheiHagimoto | 0:0e0631af0305 | 913 | PTLOC_ON_EDGE = 2 //!< Point on some edge |
| RyoheiHagimoto | 0:0e0631af0305 | 914 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 915 | |
| RyoheiHagimoto | 0:0e0631af0305 | 916 | /** Subdiv2D edge type navigation (see: getEdge()) */ |
| RyoheiHagimoto | 0:0e0631af0305 | 917 | enum { NEXT_AROUND_ORG = 0x00, |
| RyoheiHagimoto | 0:0e0631af0305 | 918 | NEXT_AROUND_DST = 0x22, |
| RyoheiHagimoto | 0:0e0631af0305 | 919 | PREV_AROUND_ORG = 0x11, |
| RyoheiHagimoto | 0:0e0631af0305 | 920 | PREV_AROUND_DST = 0x33, |
| RyoheiHagimoto | 0:0e0631af0305 | 921 | NEXT_AROUND_LEFT = 0x13, |
| RyoheiHagimoto | 0:0e0631af0305 | 922 | NEXT_AROUND_RIGHT = 0x31, |
| RyoheiHagimoto | 0:0e0631af0305 | 923 | PREV_AROUND_LEFT = 0x20, |
| RyoheiHagimoto | 0:0e0631af0305 | 924 | PREV_AROUND_RIGHT = 0x02 |
| RyoheiHagimoto | 0:0e0631af0305 | 925 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 926 | |
| RyoheiHagimoto | 0:0e0631af0305 | 927 | /** creates an empty Subdiv2D object. |
| RyoheiHagimoto | 0:0e0631af0305 | 928 | To create a new empty Delaunay subdivision you need to use the initDelaunay() function. |
| RyoheiHagimoto | 0:0e0631af0305 | 929 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 930 | CV_WRAP Subdiv2D(); |
| RyoheiHagimoto | 0:0e0631af0305 | 931 | |
| RyoheiHagimoto | 0:0e0631af0305 | 932 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 933 | |
| RyoheiHagimoto | 0:0e0631af0305 | 934 | @param rect – Rectangle that includes all of the 2D points that are to be added to the subdivision. |
| RyoheiHagimoto | 0:0e0631af0305 | 935 | |
| RyoheiHagimoto | 0:0e0631af0305 | 936 | The function creates an empty Delaunay subdivision where 2D points can be added using the function |
| RyoheiHagimoto | 0:0e0631af0305 | 937 | insert() . All of the points to be added must be within the specified rectangle, otherwise a runtime |
| RyoheiHagimoto | 0:0e0631af0305 | 938 | error is raised. |
| RyoheiHagimoto | 0:0e0631af0305 | 939 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 940 | CV_WRAP Subdiv2D(Rect rect); |
| RyoheiHagimoto | 0:0e0631af0305 | 941 | |
| RyoheiHagimoto | 0:0e0631af0305 | 942 | /** @brief Creates a new empty Delaunay subdivision |
| RyoheiHagimoto | 0:0e0631af0305 | 943 | |
| RyoheiHagimoto | 0:0e0631af0305 | 944 | @param rect – Rectangle that includes all of the 2D points that are to be added to the subdivision. |
| RyoheiHagimoto | 0:0e0631af0305 | 945 | |
| RyoheiHagimoto | 0:0e0631af0305 | 946 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 947 | CV_WRAP void initDelaunay(Rect rect); |
| RyoheiHagimoto | 0:0e0631af0305 | 948 | |
| RyoheiHagimoto | 0:0e0631af0305 | 949 | /** @brief Insert a single point into a Delaunay triangulation. |
| RyoheiHagimoto | 0:0e0631af0305 | 950 | |
| RyoheiHagimoto | 0:0e0631af0305 | 951 | @param pt – Point to insert. |
| RyoheiHagimoto | 0:0e0631af0305 | 952 | |
| RyoheiHagimoto | 0:0e0631af0305 | 953 | The function inserts a single point into a subdivision and modifies the subdivision topology |
| RyoheiHagimoto | 0:0e0631af0305 | 954 | appropriately. If a point with the same coordinates exists already, no new point is added. |
| RyoheiHagimoto | 0:0e0631af0305 | 955 | @returns the ID of the point. |
| RyoheiHagimoto | 0:0e0631af0305 | 956 | |
| RyoheiHagimoto | 0:0e0631af0305 | 957 | @note If the point is outside of the triangulation specified rect a runtime error is raised. |
| RyoheiHagimoto | 0:0e0631af0305 | 958 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 959 | CV_WRAP int insert(Point2f pt); |
| RyoheiHagimoto | 0:0e0631af0305 | 960 | |
| RyoheiHagimoto | 0:0e0631af0305 | 961 | /** @brief Insert multiple points into a Delaunay triangulation. |
| RyoheiHagimoto | 0:0e0631af0305 | 962 | |
| RyoheiHagimoto | 0:0e0631af0305 | 963 | @param ptvec – Points to insert. |
| RyoheiHagimoto | 0:0e0631af0305 | 964 | |
| RyoheiHagimoto | 0:0e0631af0305 | 965 | The function inserts a vector of points into a subdivision and modifies the subdivision topology |
| RyoheiHagimoto | 0:0e0631af0305 | 966 | appropriately. |
| RyoheiHagimoto | 0:0e0631af0305 | 967 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 968 | CV_WRAP void insert(const std::vector<Point2f>& ptvec); |
| RyoheiHagimoto | 0:0e0631af0305 | 969 | |
| RyoheiHagimoto | 0:0e0631af0305 | 970 | /** @brief Returns the location of a point within a Delaunay triangulation. |
| RyoheiHagimoto | 0:0e0631af0305 | 971 | |
| RyoheiHagimoto | 0:0e0631af0305 | 972 | @param pt – Point to locate. |
| RyoheiHagimoto | 0:0e0631af0305 | 973 | @param edge – Output edge that the point belongs to or is located to the right of it. |
| RyoheiHagimoto | 0:0e0631af0305 | 974 | @param vertex – Optional output vertex the input point coincides with. |
| RyoheiHagimoto | 0:0e0631af0305 | 975 | |
| RyoheiHagimoto | 0:0e0631af0305 | 976 | The function locates the input point within the subdivision and gives one of the triangle edges |
| RyoheiHagimoto | 0:0e0631af0305 | 977 | or vertices. |
| RyoheiHagimoto | 0:0e0631af0305 | 978 | |
| RyoheiHagimoto | 0:0e0631af0305 | 979 | @returns an integer which specify one of the following five cases for point location: |
| RyoheiHagimoto | 0:0e0631af0305 | 980 | - The point falls into some facet. The function returns PTLOC_INSIDE and edge will contain one of |
| RyoheiHagimoto | 0:0e0631af0305 | 981 | edges of the facet. |
| RyoheiHagimoto | 0:0e0631af0305 | 982 | - The point falls onto the edge. The function returns PTLOC_ON_EDGE and edge will contain this edge. |
| RyoheiHagimoto | 0:0e0631af0305 | 983 | - The point coincides with one of the subdivision vertices. The function returns PTLOC_VERTEX and |
| RyoheiHagimoto | 0:0e0631af0305 | 984 | vertex will contain a pointer to the vertex. |
| RyoheiHagimoto | 0:0e0631af0305 | 985 | - The point is outside the subdivision reference rectangle. The function returns PTLOC_OUTSIDE_RECT |
| RyoheiHagimoto | 0:0e0631af0305 | 986 | and no pointers are filled. |
| RyoheiHagimoto | 0:0e0631af0305 | 987 | - One of input arguments is invalid. A runtime error is raised or, if silent or “parent” error |
| RyoheiHagimoto | 0:0e0631af0305 | 988 | processing mode is selected, CV_PTLOC_ERROR is returnd. |
| RyoheiHagimoto | 0:0e0631af0305 | 989 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 990 | CV_WRAP int locate(Point2f pt, CV_OUT int& edge, CV_OUT int& vertex); |
| RyoheiHagimoto | 0:0e0631af0305 | 991 | |
| RyoheiHagimoto | 0:0e0631af0305 | 992 | /** @brief Finds the subdivision vertex closest to the given point. |
| RyoheiHagimoto | 0:0e0631af0305 | 993 | |
| RyoheiHagimoto | 0:0e0631af0305 | 994 | @param pt – Input point. |
| RyoheiHagimoto | 0:0e0631af0305 | 995 | @param nearestPt – Output subdivision vertex point. |
| RyoheiHagimoto | 0:0e0631af0305 | 996 | |
| RyoheiHagimoto | 0:0e0631af0305 | 997 | The function is another function that locates the input point within the subdivision. It finds the |
| RyoheiHagimoto | 0:0e0631af0305 | 998 | subdivision vertex that is the closest to the input point. It is not necessarily one of vertices |
| RyoheiHagimoto | 0:0e0631af0305 | 999 | of the facet containing the input point, though the facet (located using locate() ) is used as a |
| RyoheiHagimoto | 0:0e0631af0305 | 1000 | starting point. |
| RyoheiHagimoto | 0:0e0631af0305 | 1001 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1002 | @returns vertex ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1003 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1004 | CV_WRAP int findNearest(Point2f pt, CV_OUT Point2f* nearestPt = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 1005 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1006 | /** @brief Returns a list of all edges. |
| RyoheiHagimoto | 0:0e0631af0305 | 1007 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1008 | @param edgeList – Output vector. |
| RyoheiHagimoto | 0:0e0631af0305 | 1009 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1010 | The function gives each edge as a 4 numbers vector, where each two are one of the edge |
| RyoheiHagimoto | 0:0e0631af0305 | 1011 | vertices. i.e. org_x = v[0], org_y = v[1], dst_x = v[2], dst_y = v[3]. |
| RyoheiHagimoto | 0:0e0631af0305 | 1012 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1013 | CV_WRAP void getEdgeList(CV_OUT std::vector<Vec4f>& edgeList) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1014 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1015 | /** @brief Returns a list of the leading edge ID connected to each triangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 1016 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1017 | @param leadingEdgeList – Output vector. |
| RyoheiHagimoto | 0:0e0631af0305 | 1018 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1019 | The function gives one edge ID for each triangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 1020 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1021 | CV_WRAP void getLeadingEdgeList(CV_OUT std::vector<int>& leadingEdgeList) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1022 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1023 | /** @brief Returns a list of all triangles. |
| RyoheiHagimoto | 0:0e0631af0305 | 1024 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1025 | @param triangleList – Output vector. |
| RyoheiHagimoto | 0:0e0631af0305 | 1026 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1027 | The function gives each triangle as a 6 numbers vector, where each two are one of the triangle |
| RyoheiHagimoto | 0:0e0631af0305 | 1028 | vertices. i.e. p1_x = v[0], p1_y = v[1], p2_x = v[2], p2_y = v[3], p3_x = v[4], p3_y = v[5]. |
| RyoheiHagimoto | 0:0e0631af0305 | 1029 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1030 | CV_WRAP void getTriangleList(CV_OUT std::vector<Vec6f>& triangleList) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1031 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1032 | /** @brief Returns a list of all Voroni facets. |
| RyoheiHagimoto | 0:0e0631af0305 | 1033 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1034 | @param idx – Vector of vertices IDs to consider. For all vertices you can pass empty vector. |
| RyoheiHagimoto | 0:0e0631af0305 | 1035 | @param facetList – Output vector of the Voroni facets. |
| RyoheiHagimoto | 0:0e0631af0305 | 1036 | @param facetCenters – Output vector of the Voroni facets center points. |
| RyoheiHagimoto | 0:0e0631af0305 | 1037 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1038 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1039 | CV_WRAP void getVoronoiFacetList(const std::vector<int>& idx, CV_OUT std::vector<std::vector<Point2f> >& facetList, |
| RyoheiHagimoto | 0:0e0631af0305 | 1040 | CV_OUT std::vector<Point2f>& facetCenters); |
| RyoheiHagimoto | 0:0e0631af0305 | 1041 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1042 | /** @brief Returns vertex location from vertex ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1043 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1044 | @param vertex – vertex ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1045 | @param firstEdge – Optional. The first edge ID which is connected to the vertex. |
| RyoheiHagimoto | 0:0e0631af0305 | 1046 | @returns vertex (x,y) |
| RyoheiHagimoto | 0:0e0631af0305 | 1047 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1048 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1049 | CV_WRAP Point2f getVertex(int vertex, CV_OUT int* firstEdge = 0) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1050 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1051 | /** @brief Returns one of the edges related to the given edge. |
| RyoheiHagimoto | 0:0e0631af0305 | 1052 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1053 | @param edge – Subdivision edge ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1054 | @param nextEdgeType - Parameter specifying which of the related edges to return. |
| RyoheiHagimoto | 0:0e0631af0305 | 1055 | The following values are possible: |
| RyoheiHagimoto | 0:0e0631af0305 | 1056 | - NEXT_AROUND_ORG next around the edge origin ( eOnext on the picture below if e is the input edge) |
| RyoheiHagimoto | 0:0e0631af0305 | 1057 | - NEXT_AROUND_DST next around the edge vertex ( eDnext ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1058 | - PREV_AROUND_ORG previous around the edge origin (reversed eRnext ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1059 | - PREV_AROUND_DST previous around the edge destination (reversed eLnext ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1060 | - NEXT_AROUND_LEFT next around the left facet ( eLnext ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1061 | - NEXT_AROUND_RIGHT next around the right facet ( eRnext ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1062 | - PREV_AROUND_LEFT previous around the left facet (reversed eOnext ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1063 | - PREV_AROUND_RIGHT previous around the right facet (reversed eDnext ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1064 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1065 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 1066 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1067 | @returns edge ID related to the input edge. |
| RyoheiHagimoto | 0:0e0631af0305 | 1068 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1069 | CV_WRAP int getEdge( int edge, int nextEdgeType ) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1070 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1071 | /** @brief Returns next edge around the edge origin. |
| RyoheiHagimoto | 0:0e0631af0305 | 1072 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1073 | @param edge – Subdivision edge ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1074 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1075 | @returns an integer which is next edge ID around the edge origin: eOnext on the |
| RyoheiHagimoto | 0:0e0631af0305 | 1076 | picture above if e is the input edge). |
| RyoheiHagimoto | 0:0e0631af0305 | 1077 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1078 | CV_WRAP int nextEdge(int edge) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1079 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1080 | /** @brief Returns another edge of the same quad-edge. |
| RyoheiHagimoto | 0:0e0631af0305 | 1081 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1082 | @param edge – Subdivision edge ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1083 | @param rotate - Parameter specifying which of the edges of the same quad-edge as the input |
| RyoheiHagimoto | 0:0e0631af0305 | 1084 | one to return. The following values are possible: |
| RyoheiHagimoto | 0:0e0631af0305 | 1085 | - 0 - the input edge ( e on the picture below if e is the input edge) |
| RyoheiHagimoto | 0:0e0631af0305 | 1086 | - 1 - the rotated edge ( eRot ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1087 | - 2 - the reversed edge (reversed e (in green)) |
| RyoheiHagimoto | 0:0e0631af0305 | 1088 | - 3 - the reversed rotated edge (reversed eRot (in green)) |
| RyoheiHagimoto | 0:0e0631af0305 | 1089 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1090 | @returns one of the edges ID of the same quad-edge as the input edge. |
| RyoheiHagimoto | 0:0e0631af0305 | 1091 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1092 | CV_WRAP int rotateEdge(int edge, int rotate) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1093 | CV_WRAP int symEdge(int edge) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1094 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1095 | /** @brief Returns the edge origin. |
| RyoheiHagimoto | 0:0e0631af0305 | 1096 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1097 | @param edge – Subdivision edge ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1098 | @param orgpt – Output vertex location. |
| RyoheiHagimoto | 0:0e0631af0305 | 1099 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1100 | @returns vertex ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1101 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1102 | CV_WRAP int edgeOrg(int edge, CV_OUT Point2f* orgpt = 0) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1103 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1104 | /** @brief Returns the edge destination. |
| RyoheiHagimoto | 0:0e0631af0305 | 1105 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1106 | @param edge – Subdivision edge ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1107 | @param dstpt – Output vertex location. |
| RyoheiHagimoto | 0:0e0631af0305 | 1108 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1109 | @returns vertex ID. |
| RyoheiHagimoto | 0:0e0631af0305 | 1110 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1111 | CV_WRAP int edgeDst(int edge, CV_OUT Point2f* dstpt = 0) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1112 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1113 | protected: |
| RyoheiHagimoto | 0:0e0631af0305 | 1114 | int newEdge(); |
| RyoheiHagimoto | 0:0e0631af0305 | 1115 | void deleteEdge(int edge); |
| RyoheiHagimoto | 0:0e0631af0305 | 1116 | int newPoint(Point2f pt, bool isvirtual, int firstEdge = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 1117 | void deletePoint(int vtx); |
| RyoheiHagimoto | 0:0e0631af0305 | 1118 | void setEdgePoints( int edge, int orgPt, int dstPt ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1119 | void splice( int edgeA, int edgeB ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1120 | int connectEdges( int edgeA, int edgeB ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1121 | void swapEdges( int edge ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1122 | int isRightOf(Point2f pt, int edge) const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1123 | void calcVoronoi(); |
| RyoheiHagimoto | 0:0e0631af0305 | 1124 | void clearVoronoi(); |
| RyoheiHagimoto | 0:0e0631af0305 | 1125 | void checkSubdiv() const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1126 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1127 | struct CV_EXPORTS Vertex |
| RyoheiHagimoto | 0:0e0631af0305 | 1128 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 1129 | Vertex(); |
| RyoheiHagimoto | 0:0e0631af0305 | 1130 | Vertex(Point2f pt, bool _isvirtual, int _firstEdge=0); |
| RyoheiHagimoto | 0:0e0631af0305 | 1131 | bool isvirtual() const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1132 | bool isfree() const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1133 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1134 | int firstEdge; |
| RyoheiHagimoto | 0:0e0631af0305 | 1135 | int type; |
| RyoheiHagimoto | 0:0e0631af0305 | 1136 | Point2f pt; |
| RyoheiHagimoto | 0:0e0631af0305 | 1137 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 1138 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1139 | struct CV_EXPORTS QuadEdge |
| RyoheiHagimoto | 0:0e0631af0305 | 1140 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 1141 | QuadEdge(); |
| RyoheiHagimoto | 0:0e0631af0305 | 1142 | QuadEdge(int edgeidx); |
| RyoheiHagimoto | 0:0e0631af0305 | 1143 | bool isfree() const; |
| RyoheiHagimoto | 0:0e0631af0305 | 1144 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1145 | int next[4]; |
| RyoheiHagimoto | 0:0e0631af0305 | 1146 | int pt[4]; |
| RyoheiHagimoto | 0:0e0631af0305 | 1147 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 1148 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1149 | //! All of the vertices |
| RyoheiHagimoto | 0:0e0631af0305 | 1150 | std::vector<Vertex> vtx; |
| RyoheiHagimoto | 0:0e0631af0305 | 1151 | //! All of the edges |
| RyoheiHagimoto | 0:0e0631af0305 | 1152 | std::vector<QuadEdge> qedges; |
| RyoheiHagimoto | 0:0e0631af0305 | 1153 | int freeQEdge; |
| RyoheiHagimoto | 0:0e0631af0305 | 1154 | int freePoint; |
| RyoheiHagimoto | 0:0e0631af0305 | 1155 | bool validGeometry; |
| RyoheiHagimoto | 0:0e0631af0305 | 1156 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1157 | int recentEdge; |
| RyoheiHagimoto | 0:0e0631af0305 | 1158 | //! Top left corner of the bounding rect |
| RyoheiHagimoto | 0:0e0631af0305 | 1159 | Point2f topLeft; |
| RyoheiHagimoto | 0:0e0631af0305 | 1160 | //! Bottom right corner of the bounding rect |
| RyoheiHagimoto | 0:0e0631af0305 | 1161 | Point2f bottomRight; |
| RyoheiHagimoto | 0:0e0631af0305 | 1162 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 1163 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1164 | //! @} imgproc_subdiv2d |
| RyoheiHagimoto | 0:0e0631af0305 | 1165 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1166 | //! @addtogroup imgproc_feature |
| RyoheiHagimoto | 0:0e0631af0305 | 1167 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 1168 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1169 | /** @example lsd_lines.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 1170 | An example using the LineSegmentDetector |
| RyoheiHagimoto | 0:0e0631af0305 | 1171 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1172 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1173 | /** @brief Line segment detector class |
| RyoheiHagimoto | 0:0e0631af0305 | 1174 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1175 | following the algorithm described at @cite Rafael12 . |
| RyoheiHagimoto | 0:0e0631af0305 | 1176 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1177 | class CV_EXPORTS_W LineSegmentDetector : public Algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 1178 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 1179 | public: |
| RyoheiHagimoto | 0:0e0631af0305 | 1180 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1181 | /** @brief Finds lines in the input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1182 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1183 | This is the output of the default parameters of the algorithm on the above shown image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1184 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1185 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 1186 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1187 | @param _image A grayscale (CV_8UC1) input image. If only a roi needs to be selected, use: |
| RyoheiHagimoto | 0:0e0631af0305 | 1188 | `lsd_ptr-\>detect(image(roi), lines, ...); lines += Scalar(roi.x, roi.y, roi.x, roi.y);` |
| RyoheiHagimoto | 0:0e0631af0305 | 1189 | @param _lines A vector of Vec4i or Vec4f elements specifying the beginning and ending point of a line. Where |
| RyoheiHagimoto | 0:0e0631af0305 | 1190 | Vec4i/Vec4f is (x1, y1, x2, y2), point 1 is the start, point 2 - end. Returned lines are strictly |
| RyoheiHagimoto | 0:0e0631af0305 | 1191 | oriented depending on the gradient. |
| RyoheiHagimoto | 0:0e0631af0305 | 1192 | @param width Vector of widths of the regions, where the lines are found. E.g. Width of line. |
| RyoheiHagimoto | 0:0e0631af0305 | 1193 | @param prec Vector of precisions with which the lines are found. |
| RyoheiHagimoto | 0:0e0631af0305 | 1194 | @param nfa Vector containing number of false alarms in the line region, with precision of 10%. The |
| RyoheiHagimoto | 0:0e0631af0305 | 1195 | bigger the value, logarithmically better the detection. |
| RyoheiHagimoto | 0:0e0631af0305 | 1196 | - -1 corresponds to 10 mean false alarms |
| RyoheiHagimoto | 0:0e0631af0305 | 1197 | - 0 corresponds to 1 mean false alarm |
| RyoheiHagimoto | 0:0e0631af0305 | 1198 | - 1 corresponds to 0.1 mean false alarms |
| RyoheiHagimoto | 0:0e0631af0305 | 1199 | This vector will be calculated only when the objects type is LSD_REFINE_ADV. |
| RyoheiHagimoto | 0:0e0631af0305 | 1200 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1201 | CV_WRAP virtual void detect(InputArray _image, OutputArray _lines, |
| RyoheiHagimoto | 0:0e0631af0305 | 1202 | OutputArray width = noArray(), OutputArray prec = noArray(), |
| RyoheiHagimoto | 0:0e0631af0305 | 1203 | OutputArray nfa = noArray()) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 1204 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1205 | /** @brief Draws the line segments on a given image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1206 | @param _image The image, where the liens will be drawn. Should be bigger or equal to the image, |
| RyoheiHagimoto | 0:0e0631af0305 | 1207 | where the lines were found. |
| RyoheiHagimoto | 0:0e0631af0305 | 1208 | @param lines A vector of the lines that needed to be drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 1209 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1210 | CV_WRAP virtual void drawSegments(InputOutputArray _image, InputArray lines) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 1211 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1212 | /** @brief Draws two groups of lines in blue and red, counting the non overlapping (mismatching) pixels. |
| RyoheiHagimoto | 0:0e0631af0305 | 1213 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1214 | @param size The size of the image, where lines1 and lines2 were found. |
| RyoheiHagimoto | 0:0e0631af0305 | 1215 | @param lines1 The first group of lines that needs to be drawn. It is visualized in blue color. |
| RyoheiHagimoto | 0:0e0631af0305 | 1216 | @param lines2 The second group of lines. They visualized in red color. |
| RyoheiHagimoto | 0:0e0631af0305 | 1217 | @param _image Optional image, where the lines will be drawn. The image should be color(3-channel) |
| RyoheiHagimoto | 0:0e0631af0305 | 1218 | in order for lines1 and lines2 to be drawn in the above mentioned colors. |
| RyoheiHagimoto | 0:0e0631af0305 | 1219 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1220 | CV_WRAP virtual int compareSegments(const Size& size, InputArray lines1, InputArray lines2, InputOutputArray _image = noArray()) = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 1221 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1222 | virtual ~LineSegmentDetector() { } |
| RyoheiHagimoto | 0:0e0631af0305 | 1223 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 1224 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1225 | /** @brief Creates a smart pointer to a LineSegmentDetector object and initializes it. |
| RyoheiHagimoto | 0:0e0631af0305 | 1226 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1227 | The LineSegmentDetector algorithm is defined using the standard values. Only advanced users may want |
| RyoheiHagimoto | 0:0e0631af0305 | 1228 | to edit those, as to tailor it for their own application. |
| RyoheiHagimoto | 0:0e0631af0305 | 1229 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1230 | @param _refine The way found lines will be refined, see cv::LineSegmentDetectorModes |
| RyoheiHagimoto | 0:0e0631af0305 | 1231 | @param _scale The scale of the image that will be used to find the lines. Range (0..1]. |
| RyoheiHagimoto | 0:0e0631af0305 | 1232 | @param _sigma_scale Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale. |
| RyoheiHagimoto | 0:0e0631af0305 | 1233 | @param _quant Bound to the quantization error on the gradient norm. |
| RyoheiHagimoto | 0:0e0631af0305 | 1234 | @param _ang_th Gradient angle tolerance in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 1235 | @param _log_eps Detection threshold: -log10(NFA) \> log_eps. Used only when advancent refinement |
| RyoheiHagimoto | 0:0e0631af0305 | 1236 | is chosen. |
| RyoheiHagimoto | 0:0e0631af0305 | 1237 | @param _density_th Minimal density of aligned region points in the enclosing rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 1238 | @param _n_bins Number of bins in pseudo-ordering of gradient modulus. |
| RyoheiHagimoto | 0:0e0631af0305 | 1239 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1240 | CV_EXPORTS_W Ptr<LineSegmentDetector> createLineSegmentDetector( |
| RyoheiHagimoto | 0:0e0631af0305 | 1241 | int _refine = LSD_REFINE_STD, double _scale = 0.8, |
| RyoheiHagimoto | 0:0e0631af0305 | 1242 | double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5, |
| RyoheiHagimoto | 0:0e0631af0305 | 1243 | double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024); |
| RyoheiHagimoto | 0:0e0631af0305 | 1244 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1245 | //! @} imgproc_feature |
| RyoheiHagimoto | 0:0e0631af0305 | 1246 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1247 | //! @addtogroup imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 1248 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 1249 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1250 | /** @brief Returns Gaussian filter coefficients. |
| RyoheiHagimoto | 0:0e0631af0305 | 1251 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1252 | The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter |
| RyoheiHagimoto | 0:0e0631af0305 | 1253 | coefficients: |
| RyoheiHagimoto | 0:0e0631af0305 | 1254 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1255 | \f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1256 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1257 | where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$. |
| RyoheiHagimoto | 0:0e0631af0305 | 1258 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1259 | Two of such generated kernels can be passed to sepFilter2D. Those functions automatically recognize |
| RyoheiHagimoto | 0:0e0631af0305 | 1260 | smoothing kernels (a symmetrical kernel with sum of weights equal to 1) and handle them accordingly. |
| RyoheiHagimoto | 0:0e0631af0305 | 1261 | You may also use the higher-level GaussianBlur. |
| RyoheiHagimoto | 0:0e0631af0305 | 1262 | @param ksize Aperture size. It should be odd ( \f$\texttt{ksize} \mod 2 = 1\f$ ) and positive. |
| RyoheiHagimoto | 0:0e0631af0305 | 1263 | @param sigma Gaussian standard deviation. If it is non-positive, it is computed from ksize as |
| RyoheiHagimoto | 0:0e0631af0305 | 1264 | `sigma = 0.3\*((ksize-1)\*0.5 - 1) + 0.8`. |
| RyoheiHagimoto | 0:0e0631af0305 | 1265 | @param ktype Type of filter coefficients. It can be CV_32F or CV_64F . |
| RyoheiHagimoto | 0:0e0631af0305 | 1266 | @sa sepFilter2D, getDerivKernels, getStructuringElement, GaussianBlur |
| RyoheiHagimoto | 0:0e0631af0305 | 1267 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1268 | CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype = CV_64F ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1269 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1270 | /** @brief Returns filter coefficients for computing spatial image derivatives. |
| RyoheiHagimoto | 0:0e0631af0305 | 1271 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1272 | The function computes and returns the filter coefficients for spatial image derivatives. When |
| RyoheiHagimoto | 0:0e0631af0305 | 1273 | `ksize=CV_SCHARR`, the Scharr \f$3 \times 3\f$ kernels are generated (see cv::Scharr). Otherwise, Sobel |
| RyoheiHagimoto | 0:0e0631af0305 | 1274 | kernels are generated (see cv::Sobel). The filters are normally passed to sepFilter2D or to |
| RyoheiHagimoto | 0:0e0631af0305 | 1275 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1276 | @param kx Output matrix of row filter coefficients. It has the type ktype . |
| RyoheiHagimoto | 0:0e0631af0305 | 1277 | @param ky Output matrix of column filter coefficients. It has the type ktype . |
| RyoheiHagimoto | 0:0e0631af0305 | 1278 | @param dx Derivative order in respect of x. |
| RyoheiHagimoto | 0:0e0631af0305 | 1279 | @param dy Derivative order in respect of y. |
| RyoheiHagimoto | 0:0e0631af0305 | 1280 | @param ksize Aperture size. It can be CV_SCHARR, 1, 3, 5, or 7. |
| RyoheiHagimoto | 0:0e0631af0305 | 1281 | @param normalize Flag indicating whether to normalize (scale down) the filter coefficients or not. |
| RyoheiHagimoto | 0:0e0631af0305 | 1282 | Theoretically, the coefficients should have the denominator \f$=2^{ksize*2-dx-dy-2}\f$. If you are |
| RyoheiHagimoto | 0:0e0631af0305 | 1283 | going to filter floating-point images, you are likely to use the normalized kernels. But if you |
| RyoheiHagimoto | 0:0e0631af0305 | 1284 | compute derivatives of an 8-bit image, store the results in a 16-bit image, and wish to preserve |
| RyoheiHagimoto | 0:0e0631af0305 | 1285 | all the fractional bits, you may want to set normalize=false . |
| RyoheiHagimoto | 0:0e0631af0305 | 1286 | @param ktype Type of filter coefficients. It can be CV_32f or CV_64F . |
| RyoheiHagimoto | 0:0e0631af0305 | 1287 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1288 | CV_EXPORTS_W void getDerivKernels( OutputArray kx, OutputArray ky, |
| RyoheiHagimoto | 0:0e0631af0305 | 1289 | int dx, int dy, int ksize, |
| RyoheiHagimoto | 0:0e0631af0305 | 1290 | bool normalize = false, int ktype = CV_32F ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1291 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1292 | /** @brief Returns Gabor filter coefficients. |
| RyoheiHagimoto | 0:0e0631af0305 | 1293 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1294 | For more details about gabor filter equations and parameters, see: [Gabor |
| RyoheiHagimoto | 0:0e0631af0305 | 1295 | Filter](http://en.wikipedia.org/wiki/Gabor_filter). |
| RyoheiHagimoto | 0:0e0631af0305 | 1296 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1297 | @param ksize Size of the filter returned. |
| RyoheiHagimoto | 0:0e0631af0305 | 1298 | @param sigma Standard deviation of the gaussian envelope. |
| RyoheiHagimoto | 0:0e0631af0305 | 1299 | @param theta Orientation of the normal to the parallel stripes of a Gabor function. |
| RyoheiHagimoto | 0:0e0631af0305 | 1300 | @param lambd Wavelength of the sinusoidal factor. |
| RyoheiHagimoto | 0:0e0631af0305 | 1301 | @param gamma Spatial aspect ratio. |
| RyoheiHagimoto | 0:0e0631af0305 | 1302 | @param psi Phase offset. |
| RyoheiHagimoto | 0:0e0631af0305 | 1303 | @param ktype Type of filter coefficients. It can be CV_32F or CV_64F . |
| RyoheiHagimoto | 0:0e0631af0305 | 1304 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1305 | CV_EXPORTS_W Mat getGaborKernel( Size ksize, double sigma, double theta, double lambd, |
| RyoheiHagimoto | 0:0e0631af0305 | 1306 | double gamma, double psi = CV_PI*0.5, int ktype = CV_64F ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1307 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1308 | //! returns "magic" border value for erosion and dilation. It is automatically transformed to Scalar::all(-DBL_MAX) for dilation. |
| RyoheiHagimoto | 0:0e0631af0305 | 1309 | static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); } |
| RyoheiHagimoto | 0:0e0631af0305 | 1310 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1311 | /** @brief Returns a structuring element of the specified size and shape for morphological operations. |
| RyoheiHagimoto | 0:0e0631af0305 | 1312 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1313 | The function constructs and returns the structuring element that can be further passed to cv::erode, |
| RyoheiHagimoto | 0:0e0631af0305 | 1314 | cv::dilate or cv::morphologyEx. But you can also construct an arbitrary binary mask yourself and use it as |
| RyoheiHagimoto | 0:0e0631af0305 | 1315 | the structuring element. |
| RyoheiHagimoto | 0:0e0631af0305 | 1316 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1317 | @param shape Element shape that could be one of cv::MorphShapes |
| RyoheiHagimoto | 0:0e0631af0305 | 1318 | @param ksize Size of the structuring element. |
| RyoheiHagimoto | 0:0e0631af0305 | 1319 | @param anchor Anchor position within the element. The default value \f$(-1, -1)\f$ means that the |
| RyoheiHagimoto | 0:0e0631af0305 | 1320 | anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor |
| RyoheiHagimoto | 0:0e0631af0305 | 1321 | position. In other cases the anchor just regulates how much the result of the morphological |
| RyoheiHagimoto | 0:0e0631af0305 | 1322 | operation is shifted. |
| RyoheiHagimoto | 0:0e0631af0305 | 1323 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1324 | CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1)); |
| RyoheiHagimoto | 0:0e0631af0305 | 1325 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1326 | /** @brief Blurs an image using the median filter. |
| RyoheiHagimoto | 0:0e0631af0305 | 1327 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1328 | The function smoothes an image using the median filter with the \f$\texttt{ksize} \times |
| RyoheiHagimoto | 0:0e0631af0305 | 1329 | \texttt{ksize}\f$ aperture. Each channel of a multi-channel image is processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 1330 | In-place operation is supported. |
| RyoheiHagimoto | 0:0e0631af0305 | 1331 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1332 | @note The median filter uses BORDER_REPLICATE internally to cope with border pixels, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1333 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1334 | @param src input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be |
| RyoheiHagimoto | 0:0e0631af0305 | 1335 | CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U. |
| RyoheiHagimoto | 0:0e0631af0305 | 1336 | @param dst destination array of the same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 1337 | @param ksize aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ... |
| RyoheiHagimoto | 0:0e0631af0305 | 1338 | @sa bilateralFilter, blur, boxFilter, GaussianBlur |
| RyoheiHagimoto | 0:0e0631af0305 | 1339 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1340 | CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1341 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1342 | /** @brief Blurs an image using a Gaussian filter. |
| RyoheiHagimoto | 0:0e0631af0305 | 1343 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1344 | The function convolves the source image with the specified Gaussian kernel. In-place filtering is |
| RyoheiHagimoto | 0:0e0631af0305 | 1345 | supported. |
| RyoheiHagimoto | 0:0e0631af0305 | 1346 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1347 | @param src input image; the image can have any number of channels, which are processed |
| RyoheiHagimoto | 0:0e0631af0305 | 1348 | independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 1349 | @param dst output image of the same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 1350 | @param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be |
| RyoheiHagimoto | 0:0e0631af0305 | 1351 | positive and odd. Or, they can be zero's and then they are computed from sigma. |
| RyoheiHagimoto | 0:0e0631af0305 | 1352 | @param sigmaX Gaussian kernel standard deviation in X direction. |
| RyoheiHagimoto | 0:0e0631af0305 | 1353 | @param sigmaY Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be |
| RyoheiHagimoto | 0:0e0631af0305 | 1354 | equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, |
| RyoheiHagimoto | 0:0e0631af0305 | 1355 | respectively (see cv::getGaussianKernel for details); to fully control the result regardless of |
| RyoheiHagimoto | 0:0e0631af0305 | 1356 | possible future modifications of all this semantics, it is recommended to specify all of ksize, |
| RyoheiHagimoto | 0:0e0631af0305 | 1357 | sigmaX, and sigmaY. |
| RyoheiHagimoto | 0:0e0631af0305 | 1358 | @param borderType pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1359 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1360 | @sa sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur |
| RyoheiHagimoto | 0:0e0631af0305 | 1361 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1362 | CV_EXPORTS_W void GaussianBlur( InputArray src, OutputArray dst, Size ksize, |
| RyoheiHagimoto | 0:0e0631af0305 | 1363 | double sigmaX, double sigmaY = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 1364 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1365 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1366 | /** @brief Applies the bilateral filter to an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1367 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1368 | The function applies bilateral filtering to the input image, as described in |
| RyoheiHagimoto | 0:0e0631af0305 | 1369 | http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html |
| RyoheiHagimoto | 0:0e0631af0305 | 1370 | bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is |
| RyoheiHagimoto | 0:0e0631af0305 | 1371 | very slow compared to most filters. |
| RyoheiHagimoto | 0:0e0631af0305 | 1372 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1373 | _Sigma values_: For simplicity, you can set the 2 sigma values to be the same. If they are small (\< |
| RyoheiHagimoto | 0:0e0631af0305 | 1374 | 10), the filter will not have much effect, whereas if they are large (\> 150), they will have a very |
| RyoheiHagimoto | 0:0e0631af0305 | 1375 | strong effect, making the image look "cartoonish". |
| RyoheiHagimoto | 0:0e0631af0305 | 1376 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1377 | _Filter size_: Large filters (d \> 5) are very slow, so it is recommended to use d=5 for real-time |
| RyoheiHagimoto | 0:0e0631af0305 | 1378 | applications, and perhaps d=9 for offline applications that need heavy noise filtering. |
| RyoheiHagimoto | 0:0e0631af0305 | 1379 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1380 | This filter does not work inplace. |
| RyoheiHagimoto | 0:0e0631af0305 | 1381 | @param src Source 8-bit or floating-point, 1-channel or 3-channel image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1382 | @param dst Destination image of the same size and type as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 1383 | @param d Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, |
| RyoheiHagimoto | 0:0e0631af0305 | 1384 | it is computed from sigmaSpace. |
| RyoheiHagimoto | 0:0e0631af0305 | 1385 | @param sigmaColor Filter sigma in the color space. A larger value of the parameter means that |
| RyoheiHagimoto | 0:0e0631af0305 | 1386 | farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting |
| RyoheiHagimoto | 0:0e0631af0305 | 1387 | in larger areas of semi-equal color. |
| RyoheiHagimoto | 0:0e0631af0305 | 1388 | @param sigmaSpace Filter sigma in the coordinate space. A larger value of the parameter means that |
| RyoheiHagimoto | 0:0e0631af0305 | 1389 | farther pixels will influence each other as long as their colors are close enough (see sigmaColor |
| RyoheiHagimoto | 0:0e0631af0305 | 1390 | ). When d\>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is |
| RyoheiHagimoto | 0:0e0631af0305 | 1391 | proportional to sigmaSpace. |
| RyoheiHagimoto | 0:0e0631af0305 | 1392 | @param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1393 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1394 | CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d, |
| RyoheiHagimoto | 0:0e0631af0305 | 1395 | double sigmaColor, double sigmaSpace, |
| RyoheiHagimoto | 0:0e0631af0305 | 1396 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1397 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1398 | /** @brief Blurs an image using the box filter. |
| RyoheiHagimoto | 0:0e0631af0305 | 1399 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1400 | The function smoothes an image using the kernel: |
| RyoheiHagimoto | 0:0e0631af0305 | 1401 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1402 | \f[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1403 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1404 | where |
| RyoheiHagimoto | 0:0e0631af0305 | 1405 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1406 | \f[\alpha = \fork{\frac{1}{\texttt{ksize.width*ksize.height}}}{when \texttt{normalize=true}}{1}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1407 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1408 | Unnormalized box filter is useful for computing various integral characteristics over each pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 1409 | neighborhood, such as covariance matrices of image derivatives (used in dense optical flow |
| RyoheiHagimoto | 0:0e0631af0305 | 1410 | algorithms, and so on). If you need to compute pixel sums over variable-size windows, use cv::integral. |
| RyoheiHagimoto | 0:0e0631af0305 | 1411 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1412 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1413 | @param dst output image of the same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 1414 | @param ddepth the output image depth (-1 to use src.depth()). |
| RyoheiHagimoto | 0:0e0631af0305 | 1415 | @param ksize blurring kernel size. |
| RyoheiHagimoto | 0:0e0631af0305 | 1416 | @param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel |
| RyoheiHagimoto | 0:0e0631af0305 | 1417 | center. |
| RyoheiHagimoto | 0:0e0631af0305 | 1418 | @param normalize flag, specifying whether the kernel is normalized by its area or not. |
| RyoheiHagimoto | 0:0e0631af0305 | 1419 | @param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1420 | @sa blur, bilateralFilter, GaussianBlur, medianBlur, integral |
| RyoheiHagimoto | 0:0e0631af0305 | 1421 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1422 | CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth, |
| RyoheiHagimoto | 0:0e0631af0305 | 1423 | Size ksize, Point anchor = Point(-1,-1), |
| RyoheiHagimoto | 0:0e0631af0305 | 1424 | bool normalize = true, |
| RyoheiHagimoto | 0:0e0631af0305 | 1425 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1426 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1427 | /** @brief Calculates the normalized sum of squares of the pixel values overlapping the filter. |
| RyoheiHagimoto | 0:0e0631af0305 | 1428 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1429 | For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring |
| RyoheiHagimoto | 0:0e0631af0305 | 1430 | pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$. |
| RyoheiHagimoto | 0:0e0631af0305 | 1431 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1432 | The unnormalized square box filter can be useful in computing local image statistics such as the the local |
| RyoheiHagimoto | 0:0e0631af0305 | 1433 | variance and standard deviation around the neighborhood of a pixel. |
| RyoheiHagimoto | 0:0e0631af0305 | 1434 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1435 | @param _src input image |
| RyoheiHagimoto | 0:0e0631af0305 | 1436 | @param _dst output image of the same size and type as _src |
| RyoheiHagimoto | 0:0e0631af0305 | 1437 | @param ddepth the output image depth (-1 to use src.depth()) |
| RyoheiHagimoto | 0:0e0631af0305 | 1438 | @param ksize kernel size |
| RyoheiHagimoto | 0:0e0631af0305 | 1439 | @param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel |
| RyoheiHagimoto | 0:0e0631af0305 | 1440 | center. |
| RyoheiHagimoto | 0:0e0631af0305 | 1441 | @param normalize flag, specifying whether the kernel is to be normalized by it's area or not. |
| RyoheiHagimoto | 0:0e0631af0305 | 1442 | @param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1443 | @sa boxFilter |
| RyoheiHagimoto | 0:0e0631af0305 | 1444 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1445 | CV_EXPORTS_W void sqrBoxFilter( InputArray _src, OutputArray _dst, int ddepth, |
| RyoheiHagimoto | 0:0e0631af0305 | 1446 | Size ksize, Point anchor = Point(-1, -1), |
| RyoheiHagimoto | 0:0e0631af0305 | 1447 | bool normalize = true, |
| RyoheiHagimoto | 0:0e0631af0305 | 1448 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1449 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1450 | /** @brief Blurs an image using the normalized box filter. |
| RyoheiHagimoto | 0:0e0631af0305 | 1451 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1452 | The function smoothes an image using the kernel: |
| RyoheiHagimoto | 0:0e0631af0305 | 1453 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1454 | \f[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1455 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1456 | The call `blur(src, dst, ksize, anchor, borderType)` is equivalent to `boxFilter(src, dst, src.type(), |
| RyoheiHagimoto | 0:0e0631af0305 | 1457 | anchor, true, borderType)`. |
| RyoheiHagimoto | 0:0e0631af0305 | 1458 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1459 | @param src input image; it can have any number of channels, which are processed independently, but |
| RyoheiHagimoto | 0:0e0631af0305 | 1460 | the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 1461 | @param dst output image of the same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 1462 | @param ksize blurring kernel size. |
| RyoheiHagimoto | 0:0e0631af0305 | 1463 | @param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel |
| RyoheiHagimoto | 0:0e0631af0305 | 1464 | center. |
| RyoheiHagimoto | 0:0e0631af0305 | 1465 | @param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1466 | @sa boxFilter, bilateralFilter, GaussianBlur, medianBlur |
| RyoheiHagimoto | 0:0e0631af0305 | 1467 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1468 | CV_EXPORTS_W void blur( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 1469 | Size ksize, Point anchor = Point(-1,-1), |
| RyoheiHagimoto | 0:0e0631af0305 | 1470 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1471 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1472 | /** @brief Convolves an image with the kernel. |
| RyoheiHagimoto | 0:0e0631af0305 | 1473 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1474 | The function applies an arbitrary linear filter to an image. In-place operation is supported. When |
| RyoheiHagimoto | 0:0e0631af0305 | 1475 | the aperture is partially outside the image, the function interpolates outlier pixel values |
| RyoheiHagimoto | 0:0e0631af0305 | 1476 | according to the specified border mode. |
| RyoheiHagimoto | 0:0e0631af0305 | 1477 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1478 | The function does actually compute correlation, not the convolution: |
| RyoheiHagimoto | 0:0e0631af0305 | 1479 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1480 | \f[\texttt{dst} (x,y) = \sum _{ \stackrel{0\leq x' < \texttt{kernel.cols},}{0\leq y' < \texttt{kernel.rows}} } \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1481 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1482 | That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip |
| RyoheiHagimoto | 0:0e0631af0305 | 1483 | the kernel using cv::flip and set the new anchor to `(kernel.cols - anchor.x - 1, kernel.rows - |
| RyoheiHagimoto | 0:0e0631af0305 | 1484 | anchor.y - 1)`. |
| RyoheiHagimoto | 0:0e0631af0305 | 1485 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1486 | The function uses the DFT-based algorithm in case of sufficiently large kernels (~`11 x 11` or |
| RyoheiHagimoto | 0:0e0631af0305 | 1487 | larger) and the direct algorithm for small kernels. |
| RyoheiHagimoto | 0:0e0631af0305 | 1488 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1489 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1490 | @param dst output image of the same size and the same number of channels as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 1491 | @param ddepth desired depth of the destination image, see @ref filter_depths "combinations" |
| RyoheiHagimoto | 0:0e0631af0305 | 1492 | @param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point |
| RyoheiHagimoto | 0:0e0631af0305 | 1493 | matrix; if you want to apply different kernels to different channels, split the image into |
| RyoheiHagimoto | 0:0e0631af0305 | 1494 | separate color planes using split and process them individually. |
| RyoheiHagimoto | 0:0e0631af0305 | 1495 | @param anchor anchor of the kernel that indicates the relative position of a filtered point within |
| RyoheiHagimoto | 0:0e0631af0305 | 1496 | the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor |
| RyoheiHagimoto | 0:0e0631af0305 | 1497 | is at the kernel center. |
| RyoheiHagimoto | 0:0e0631af0305 | 1498 | @param delta optional value added to the filtered pixels before storing them in dst. |
| RyoheiHagimoto | 0:0e0631af0305 | 1499 | @param borderType pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1500 | @sa sepFilter2D, dft, matchTemplate |
| RyoheiHagimoto | 0:0e0631af0305 | 1501 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1502 | CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth, |
| RyoheiHagimoto | 0:0e0631af0305 | 1503 | InputArray kernel, Point anchor = Point(-1,-1), |
| RyoheiHagimoto | 0:0e0631af0305 | 1504 | double delta = 0, int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1505 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1506 | /** @brief Applies a separable linear filter to an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1507 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1508 | The function applies a separable linear filter to the image. That is, first, every row of src is |
| RyoheiHagimoto | 0:0e0631af0305 | 1509 | filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D |
| RyoheiHagimoto | 0:0e0631af0305 | 1510 | kernel kernelY. The final result shifted by delta is stored in dst . |
| RyoheiHagimoto | 0:0e0631af0305 | 1511 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1512 | @param src Source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1513 | @param dst Destination image of the same size and the same number of channels as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 1514 | @param ddepth Destination image depth, see @ref filter_depths "combinations" |
| RyoheiHagimoto | 0:0e0631af0305 | 1515 | @param kernelX Coefficients for filtering each row. |
| RyoheiHagimoto | 0:0e0631af0305 | 1516 | @param kernelY Coefficients for filtering each column. |
| RyoheiHagimoto | 0:0e0631af0305 | 1517 | @param anchor Anchor position within the kernel. The default value \f$(-1,-1)\f$ means that the anchor |
| RyoheiHagimoto | 0:0e0631af0305 | 1518 | is at the kernel center. |
| RyoheiHagimoto | 0:0e0631af0305 | 1519 | @param delta Value added to the filtered results before storing them. |
| RyoheiHagimoto | 0:0e0631af0305 | 1520 | @param borderType Pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1521 | @sa filter2D, Sobel, GaussianBlur, boxFilter, blur |
| RyoheiHagimoto | 0:0e0631af0305 | 1522 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1523 | CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth, |
| RyoheiHagimoto | 0:0e0631af0305 | 1524 | InputArray kernelX, InputArray kernelY, |
| RyoheiHagimoto | 0:0e0631af0305 | 1525 | Point anchor = Point(-1,-1), |
| RyoheiHagimoto | 0:0e0631af0305 | 1526 | double delta = 0, int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1527 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1528 | /** @brief Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. |
| RyoheiHagimoto | 0:0e0631af0305 | 1529 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1530 | In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to |
| RyoheiHagimoto | 0:0e0631af0305 | 1531 | calculate the derivative. When \f$\texttt{ksize = 1}\f$, the \f$3 \times 1\f$ or \f$1 \times 3\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 1532 | kernel is used (that is, no Gaussian smoothing is done). `ksize = 1` can only be used for the first |
| RyoheiHagimoto | 0:0e0631af0305 | 1533 | or the second x- or y- derivatives. |
| RyoheiHagimoto | 0:0e0631af0305 | 1534 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1535 | There is also the special value `ksize = CV_SCHARR (-1)` that corresponds to the \f$3\times3\f$ Scharr |
| RyoheiHagimoto | 0:0e0631af0305 | 1536 | filter that may give more accurate results than the \f$3\times3\f$ Sobel. The Scharr aperture is |
| RyoheiHagimoto | 0:0e0631af0305 | 1537 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1538 | \f[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1539 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1540 | for the x-derivative, or transposed for the y-derivative. |
| RyoheiHagimoto | 0:0e0631af0305 | 1541 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1542 | The function calculates an image derivative by convolving the image with the appropriate kernel: |
| RyoheiHagimoto | 0:0e0631af0305 | 1543 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1544 | \f[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1545 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1546 | The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less |
| RyoheiHagimoto | 0:0e0631af0305 | 1547 | resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) |
| RyoheiHagimoto | 0:0e0631af0305 | 1548 | or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first |
| RyoheiHagimoto | 0:0e0631af0305 | 1549 | case corresponds to a kernel of: |
| RyoheiHagimoto | 0:0e0631af0305 | 1550 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1551 | \f[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1552 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1553 | The second case corresponds to a kernel of: |
| RyoheiHagimoto | 0:0e0631af0305 | 1554 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1555 | \f[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1556 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1557 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1558 | @param dst output image of the same size and the same number of channels as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 1559 | @param ddepth output image depth, see @ref filter_depths "combinations"; in the case of |
| RyoheiHagimoto | 0:0e0631af0305 | 1560 | 8-bit input images it will result in truncated derivatives. |
| RyoheiHagimoto | 0:0e0631af0305 | 1561 | @param dx order of the derivative x. |
| RyoheiHagimoto | 0:0e0631af0305 | 1562 | @param dy order of the derivative y. |
| RyoheiHagimoto | 0:0e0631af0305 | 1563 | @param ksize size of the extended Sobel kernel; it must be 1, 3, 5, or 7. |
| RyoheiHagimoto | 0:0e0631af0305 | 1564 | @param scale optional scale factor for the computed derivative values; by default, no scaling is |
| RyoheiHagimoto | 0:0e0631af0305 | 1565 | applied (see cv::getDerivKernels for details). |
| RyoheiHagimoto | 0:0e0631af0305 | 1566 | @param delta optional delta value that is added to the results prior to storing them in dst. |
| RyoheiHagimoto | 0:0e0631af0305 | 1567 | @param borderType pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1568 | @sa Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar |
| RyoheiHagimoto | 0:0e0631af0305 | 1569 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1570 | CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth, |
| RyoheiHagimoto | 0:0e0631af0305 | 1571 | int dx, int dy, int ksize = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 1572 | double scale = 1, double delta = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 1573 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1574 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1575 | /** @brief Calculates the first order image derivative in both x and y using a Sobel operator |
| RyoheiHagimoto | 0:0e0631af0305 | 1576 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1577 | Equivalent to calling: |
| RyoheiHagimoto | 0:0e0631af0305 | 1578 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1579 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 1580 | Sobel( src, dx, CV_16SC1, 1, 0, 3 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1581 | Sobel( src, dy, CV_16SC1, 0, 1, 3 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1582 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 1583 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1584 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1585 | @param dx output image with first-order derivative in x. |
| RyoheiHagimoto | 0:0e0631af0305 | 1586 | @param dy output image with first-order derivative in y. |
| RyoheiHagimoto | 0:0e0631af0305 | 1587 | @param ksize size of Sobel kernel. It must be 3. |
| RyoheiHagimoto | 0:0e0631af0305 | 1588 | @param borderType pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1589 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1590 | @sa Sobel |
| RyoheiHagimoto | 0:0e0631af0305 | 1591 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1592 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1593 | CV_EXPORTS_W void spatialGradient( InputArray src, OutputArray dx, |
| RyoheiHagimoto | 0:0e0631af0305 | 1594 | OutputArray dy, int ksize = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 1595 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1596 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1597 | /** @brief Calculates the first x- or y- image derivative using Scharr operator. |
| RyoheiHagimoto | 0:0e0631af0305 | 1598 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1599 | The function computes the first x- or y- spatial image derivative using the Scharr operator. The |
| RyoheiHagimoto | 0:0e0631af0305 | 1600 | call |
| RyoheiHagimoto | 0:0e0631af0305 | 1601 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1602 | \f[\texttt{Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1603 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1604 | is equivalent to |
| RyoheiHagimoto | 0:0e0631af0305 | 1605 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1606 | \f[\texttt{Sobel(src, dst, ddepth, dx, dy, CV\_SCHARR, scale, delta, borderType)} .\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1607 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1608 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1609 | @param dst output image of the same size and the same number of channels as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 1610 | @param ddepth output image depth, see @ref filter_depths "combinations" |
| RyoheiHagimoto | 0:0e0631af0305 | 1611 | @param dx order of the derivative x. |
| RyoheiHagimoto | 0:0e0631af0305 | 1612 | @param dy order of the derivative y. |
| RyoheiHagimoto | 0:0e0631af0305 | 1613 | @param scale optional scale factor for the computed derivative values; by default, no scaling is |
| RyoheiHagimoto | 0:0e0631af0305 | 1614 | applied (see getDerivKernels for details). |
| RyoheiHagimoto | 0:0e0631af0305 | 1615 | @param delta optional delta value that is added to the results prior to storing them in dst. |
| RyoheiHagimoto | 0:0e0631af0305 | 1616 | @param borderType pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1617 | @sa cartToPolar |
| RyoheiHagimoto | 0:0e0631af0305 | 1618 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1619 | CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth, |
| RyoheiHagimoto | 0:0e0631af0305 | 1620 | int dx, int dy, double scale = 1, double delta = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 1621 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1622 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1623 | /** @example laplace.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 1624 | An example using Laplace transformations for edge detection |
| RyoheiHagimoto | 0:0e0631af0305 | 1625 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1626 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1627 | /** @brief Calculates the Laplacian of an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1628 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1629 | The function calculates the Laplacian of the source image by adding up the second x and y |
| RyoheiHagimoto | 0:0e0631af0305 | 1630 | derivatives calculated using the Sobel operator: |
| RyoheiHagimoto | 0:0e0631af0305 | 1631 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1632 | \f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1633 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1634 | This is done when `ksize > 1`. When `ksize == 1`, the Laplacian is computed by filtering the image |
| RyoheiHagimoto | 0:0e0631af0305 | 1635 | with the following \f$3 \times 3\f$ aperture: |
| RyoheiHagimoto | 0:0e0631af0305 | 1636 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1637 | \f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1638 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1639 | @param src Source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1640 | @param dst Destination image of the same size and the same number of channels as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 1641 | @param ddepth Desired depth of the destination image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1642 | @param ksize Aperture size used to compute the second-derivative filters. See getDerivKernels for |
| RyoheiHagimoto | 0:0e0631af0305 | 1643 | details. The size must be positive and odd. |
| RyoheiHagimoto | 0:0e0631af0305 | 1644 | @param scale Optional scale factor for the computed Laplacian values. By default, no scaling is |
| RyoheiHagimoto | 0:0e0631af0305 | 1645 | applied. See getDerivKernels for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 1646 | @param delta Optional delta value that is added to the results prior to storing them in dst . |
| RyoheiHagimoto | 0:0e0631af0305 | 1647 | @param borderType Pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 1648 | @sa Sobel, Scharr |
| RyoheiHagimoto | 0:0e0631af0305 | 1649 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1650 | CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth, |
| RyoheiHagimoto | 0:0e0631af0305 | 1651 | int ksize = 1, double scale = 1, double delta = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 1652 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1653 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1654 | //! @} imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 1655 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1656 | //! @addtogroup imgproc_feature |
| RyoheiHagimoto | 0:0e0631af0305 | 1657 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 1658 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1659 | /** @example edge.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 1660 | An example on using the canny edge detector |
| RyoheiHagimoto | 0:0e0631af0305 | 1661 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1662 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1663 | /** @brief Finds edges in an image using the Canny algorithm @cite Canny86 . |
| RyoheiHagimoto | 0:0e0631af0305 | 1664 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1665 | The function finds edges in the input image image and marks them in the output map edges using the |
| RyoheiHagimoto | 0:0e0631af0305 | 1666 | Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The |
| RyoheiHagimoto | 0:0e0631af0305 | 1667 | largest value is used to find initial segments of strong edges. See |
| RyoheiHagimoto | 0:0e0631af0305 | 1668 | <http://en.wikipedia.org/wiki/Canny_edge_detector> |
| RyoheiHagimoto | 0:0e0631af0305 | 1669 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1670 | @param image 8-bit input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1671 | @param edges output edge map; single channels 8-bit image, which has the same size as image . |
| RyoheiHagimoto | 0:0e0631af0305 | 1672 | @param threshold1 first threshold for the hysteresis procedure. |
| RyoheiHagimoto | 0:0e0631af0305 | 1673 | @param threshold2 second threshold for the hysteresis procedure. |
| RyoheiHagimoto | 0:0e0631af0305 | 1674 | @param apertureSize aperture size for the Sobel operator. |
| RyoheiHagimoto | 0:0e0631af0305 | 1675 | @param L2gradient a flag, indicating whether a more accurate \f$L_2\f$ norm |
| RyoheiHagimoto | 0:0e0631af0305 | 1676 | \f$=\sqrt{(dI/dx)^2 + (dI/dy)^2}\f$ should be used to calculate the image gradient magnitude ( |
| RyoheiHagimoto | 0:0e0631af0305 | 1677 | L2gradient=true ), or whether the default \f$L_1\f$ norm \f$=|dI/dx|+|dI/dy|\f$ is enough ( |
| RyoheiHagimoto | 0:0e0631af0305 | 1678 | L2gradient=false ). |
| RyoheiHagimoto | 0:0e0631af0305 | 1679 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1680 | CV_EXPORTS_W void Canny( InputArray image, OutputArray edges, |
| RyoheiHagimoto | 0:0e0631af0305 | 1681 | double threshold1, double threshold2, |
| RyoheiHagimoto | 0:0e0631af0305 | 1682 | int apertureSize = 3, bool L2gradient = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1683 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1684 | /** \overload |
| RyoheiHagimoto | 0:0e0631af0305 | 1685 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1686 | Finds edges in an image using the Canny algorithm with custom image gradient. |
| RyoheiHagimoto | 0:0e0631af0305 | 1687 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1688 | @param dx 16-bit x derivative of input image (CV_16SC1 or CV_16SC3). |
| RyoheiHagimoto | 0:0e0631af0305 | 1689 | @param dy 16-bit y derivative of input image (same type as dx). |
| RyoheiHagimoto | 0:0e0631af0305 | 1690 | @param edges,threshold1,threshold2,L2gradient See cv::Canny |
| RyoheiHagimoto | 0:0e0631af0305 | 1691 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1692 | CV_EXPORTS_W void Canny( InputArray dx, InputArray dy, |
| RyoheiHagimoto | 0:0e0631af0305 | 1693 | OutputArray edges, |
| RyoheiHagimoto | 0:0e0631af0305 | 1694 | double threshold1, double threshold2, |
| RyoheiHagimoto | 0:0e0631af0305 | 1695 | bool L2gradient = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1696 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1697 | /** @brief Calculates the minimal eigenvalue of gradient matrices for corner detection. |
| RyoheiHagimoto | 0:0e0631af0305 | 1698 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1699 | The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal |
| RyoheiHagimoto | 0:0e0631af0305 | 1700 | eigenvalue of the covariance matrix of derivatives, that is, \f$\min(\lambda_1, \lambda_2)\f$ in terms |
| RyoheiHagimoto | 0:0e0631af0305 | 1701 | of the formulae in the cornerEigenValsAndVecs description. |
| RyoheiHagimoto | 0:0e0631af0305 | 1702 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1703 | @param src Input single-channel 8-bit or floating-point image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1704 | @param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as |
| RyoheiHagimoto | 0:0e0631af0305 | 1705 | src . |
| RyoheiHagimoto | 0:0e0631af0305 | 1706 | @param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ). |
| RyoheiHagimoto | 0:0e0631af0305 | 1707 | @param ksize Aperture parameter for the Sobel operator. |
| RyoheiHagimoto | 0:0e0631af0305 | 1708 | @param borderType Pixel extrapolation method. See cv::BorderTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 1709 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1710 | CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 1711 | int blockSize, int ksize = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 1712 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1713 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1714 | /** @brief Harris corner detector. |
| RyoheiHagimoto | 0:0e0631af0305 | 1715 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1716 | The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and |
| RyoheiHagimoto | 0:0e0631af0305 | 1717 | cornerEigenValsAndVecs , for each pixel \f$(x, y)\f$ it calculates a \f$2\times2\f$ gradient covariance |
| RyoheiHagimoto | 0:0e0631af0305 | 1718 | matrix \f$M^{(x,y)}\f$ over a \f$\texttt{blockSize} \times \texttt{blockSize}\f$ neighborhood. Then, it |
| RyoheiHagimoto | 0:0e0631af0305 | 1719 | computes the following characteristic: |
| RyoheiHagimoto | 0:0e0631af0305 | 1720 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1721 | \f[\texttt{dst} (x,y) = \mathrm{det} M^{(x,y)} - k \cdot \left ( \mathrm{tr} M^{(x,y)} \right )^2\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1722 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1723 | Corners in the image can be found as the local maxima of this response map. |
| RyoheiHagimoto | 0:0e0631af0305 | 1724 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1725 | @param src Input single-channel 8-bit or floating-point image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1726 | @param dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same |
| RyoheiHagimoto | 0:0e0631af0305 | 1727 | size as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 1728 | @param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ). |
| RyoheiHagimoto | 0:0e0631af0305 | 1729 | @param ksize Aperture parameter for the Sobel operator. |
| RyoheiHagimoto | 0:0e0631af0305 | 1730 | @param k Harris detector free parameter. See the formula below. |
| RyoheiHagimoto | 0:0e0631af0305 | 1731 | @param borderType Pixel extrapolation method. See cv::BorderTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 1732 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1733 | CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize, |
| RyoheiHagimoto | 0:0e0631af0305 | 1734 | int ksize, double k, |
| RyoheiHagimoto | 0:0e0631af0305 | 1735 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1736 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1737 | /** @brief Calculates eigenvalues and eigenvectors of image blocks for corner detection. |
| RyoheiHagimoto | 0:0e0631af0305 | 1738 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1739 | For every pixel \f$p\f$ , the function cornerEigenValsAndVecs considers a blockSize \f$\times\f$ blockSize |
| RyoheiHagimoto | 0:0e0631af0305 | 1740 | neighborhood \f$S(p)\f$ . It calculates the covariation matrix of derivatives over the neighborhood as: |
| RyoheiHagimoto | 0:0e0631af0305 | 1741 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1742 | \f[M = \begin{bmatrix} \sum _{S(p)}(dI/dx)^2 & \sum _{S(p)}dI/dx dI/dy \\ \sum _{S(p)}dI/dx dI/dy & \sum _{S(p)}(dI/dy)^2 \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1743 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1744 | where the derivatives are computed using the Sobel operator. |
| RyoheiHagimoto | 0:0e0631af0305 | 1745 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1746 | After that, it finds eigenvectors and eigenvalues of \f$M\f$ and stores them in the destination image as |
| RyoheiHagimoto | 0:0e0631af0305 | 1747 | \f$(\lambda_1, \lambda_2, x_1, y_1, x_2, y_2)\f$ where |
| RyoheiHagimoto | 0:0e0631af0305 | 1748 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1749 | - \f$\lambda_1, \lambda_2\f$ are the non-sorted eigenvalues of \f$M\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 1750 | - \f$x_1, y_1\f$ are the eigenvectors corresponding to \f$\lambda_1\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 1751 | - \f$x_2, y_2\f$ are the eigenvectors corresponding to \f$\lambda_2\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 1752 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1753 | The output of the function can be used for robust edge or corner detection. |
| RyoheiHagimoto | 0:0e0631af0305 | 1754 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1755 | @param src Input single-channel 8-bit or floating-point image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1756 | @param dst Image to store the results. It has the same size as src and the type CV_32FC(6) . |
| RyoheiHagimoto | 0:0e0631af0305 | 1757 | @param blockSize Neighborhood size (see details below). |
| RyoheiHagimoto | 0:0e0631af0305 | 1758 | @param ksize Aperture parameter for the Sobel operator. |
| RyoheiHagimoto | 0:0e0631af0305 | 1759 | @param borderType Pixel extrapolation method. See cv::BorderTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 1760 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1761 | @sa cornerMinEigenVal, cornerHarris, preCornerDetect |
| RyoheiHagimoto | 0:0e0631af0305 | 1762 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1763 | CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 1764 | int blockSize, int ksize, |
| RyoheiHagimoto | 0:0e0631af0305 | 1765 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1766 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1767 | /** @brief Calculates a feature map for corner detection. |
| RyoheiHagimoto | 0:0e0631af0305 | 1768 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1769 | The function calculates the complex spatial derivative-based function of the source image |
| RyoheiHagimoto | 0:0e0631af0305 | 1770 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1771 | \f[\texttt{dst} = (D_x \texttt{src} )^2 \cdot D_{yy} \texttt{src} + (D_y \texttt{src} )^2 \cdot D_{xx} \texttt{src} - 2 D_x \texttt{src} \cdot D_y \texttt{src} \cdot D_{xy} \texttt{src}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1772 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1773 | where \f$D_x\f$,\f$D_y\f$ are the first image derivatives, \f$D_{xx}\f$,\f$D_{yy}\f$ are the second image |
| RyoheiHagimoto | 0:0e0631af0305 | 1774 | derivatives, and \f$D_{xy}\f$ is the mixed derivative. |
| RyoheiHagimoto | 0:0e0631af0305 | 1775 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1776 | The corners can be found as local maximums of the functions, as shown below: |
| RyoheiHagimoto | 0:0e0631af0305 | 1777 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 1778 | Mat corners, dilated_corners; |
| RyoheiHagimoto | 0:0e0631af0305 | 1779 | preCornerDetect(image, corners, 3); |
| RyoheiHagimoto | 0:0e0631af0305 | 1780 | // dilation with 3x3 rectangular structuring element |
| RyoheiHagimoto | 0:0e0631af0305 | 1781 | dilate(corners, dilated_corners, Mat(), 1); |
| RyoheiHagimoto | 0:0e0631af0305 | 1782 | Mat corner_mask = corners == dilated_corners; |
| RyoheiHagimoto | 0:0e0631af0305 | 1783 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 1784 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1785 | @param src Source single-channel 8-bit of floating-point image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1786 | @param dst Output image that has the type CV_32F and the same size as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 1787 | @param ksize %Aperture size of the Sobel . |
| RyoheiHagimoto | 0:0e0631af0305 | 1788 | @param borderType Pixel extrapolation method. See cv::BorderTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 1789 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1790 | CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize, |
| RyoheiHagimoto | 0:0e0631af0305 | 1791 | int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1792 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1793 | /** @brief Refines the corner locations. |
| RyoheiHagimoto | 0:0e0631af0305 | 1794 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1795 | The function iterates to find the sub-pixel accurate location of corners or radial saddle points, as |
| RyoheiHagimoto | 0:0e0631af0305 | 1796 | shown on the figure below. |
| RyoheiHagimoto | 0:0e0631af0305 | 1797 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1798 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 1799 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1800 | Sub-pixel accurate corner locator is based on the observation that every vector from the center \f$q\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 1801 | to a point \f$p\f$ located within a neighborhood of \f$q\f$ is orthogonal to the image gradient at \f$p\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 1802 | subject to image and measurement noise. Consider the expression: |
| RyoheiHagimoto | 0:0e0631af0305 | 1803 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1804 | \f[\epsilon _i = {DI_{p_i}}^T \cdot (q - p_i)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1805 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1806 | where \f${DI_{p_i}}\f$ is an image gradient at one of the points \f$p_i\f$ in a neighborhood of \f$q\f$ . The |
| RyoheiHagimoto | 0:0e0631af0305 | 1807 | value of \f$q\f$ is to be found so that \f$\epsilon_i\f$ is minimized. A system of equations may be set up |
| RyoheiHagimoto | 0:0e0631af0305 | 1808 | with \f$\epsilon_i\f$ set to zero: |
| RyoheiHagimoto | 0:0e0631af0305 | 1809 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1810 | \f[\sum _i(DI_{p_i} \cdot {DI_{p_i}}^T) - \sum _i(DI_{p_i} \cdot {DI_{p_i}}^T \cdot p_i)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1811 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1812 | where the gradients are summed within a neighborhood ("search window") of \f$q\f$ . Calling the first |
| RyoheiHagimoto | 0:0e0631af0305 | 1813 | gradient term \f$G\f$ and the second gradient term \f$b\f$ gives: |
| RyoheiHagimoto | 0:0e0631af0305 | 1814 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1815 | \f[q = G^{-1} \cdot b\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 1816 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1817 | The algorithm sets the center of the neighborhood window at this new center \f$q\f$ and then iterates |
| RyoheiHagimoto | 0:0e0631af0305 | 1818 | until the center stays within a set threshold. |
| RyoheiHagimoto | 0:0e0631af0305 | 1819 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1820 | @param image Input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1821 | @param corners Initial coordinates of the input corners and refined coordinates provided for |
| RyoheiHagimoto | 0:0e0631af0305 | 1822 | output. |
| RyoheiHagimoto | 0:0e0631af0305 | 1823 | @param winSize Half of the side length of the search window. For example, if winSize=Size(5,5) , |
| RyoheiHagimoto | 0:0e0631af0305 | 1824 | then a \f$5*2+1 \times 5*2+1 = 11 \times 11\f$ search window is used. |
| RyoheiHagimoto | 0:0e0631af0305 | 1825 | @param zeroZone Half of the size of the dead region in the middle of the search zone over which |
| RyoheiHagimoto | 0:0e0631af0305 | 1826 | the summation in the formula below is not done. It is used sometimes to avoid possible |
| RyoheiHagimoto | 0:0e0631af0305 | 1827 | singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such |
| RyoheiHagimoto | 0:0e0631af0305 | 1828 | a size. |
| RyoheiHagimoto | 0:0e0631af0305 | 1829 | @param criteria Criteria for termination of the iterative process of corner refinement. That is, |
| RyoheiHagimoto | 0:0e0631af0305 | 1830 | the process of corner position refinement stops either after criteria.maxCount iterations or when |
| RyoheiHagimoto | 0:0e0631af0305 | 1831 | the corner position moves by less than criteria.epsilon on some iteration. |
| RyoheiHagimoto | 0:0e0631af0305 | 1832 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1833 | CV_EXPORTS_W void cornerSubPix( InputArray image, InputOutputArray corners, |
| RyoheiHagimoto | 0:0e0631af0305 | 1834 | Size winSize, Size zeroZone, |
| RyoheiHagimoto | 0:0e0631af0305 | 1835 | TermCriteria criteria ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1836 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1837 | /** @brief Determines strong corners on an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1838 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1839 | The function finds the most prominent corners in the image or in the specified image region, as |
| RyoheiHagimoto | 0:0e0631af0305 | 1840 | described in @cite Shi94 |
| RyoheiHagimoto | 0:0e0631af0305 | 1841 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1842 | - Function calculates the corner quality measure at every source image pixel using the |
| RyoheiHagimoto | 0:0e0631af0305 | 1843 | cornerMinEigenVal or cornerHarris . |
| RyoheiHagimoto | 0:0e0631af0305 | 1844 | - Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are |
| RyoheiHagimoto | 0:0e0631af0305 | 1845 | retained). |
| RyoheiHagimoto | 0:0e0631af0305 | 1846 | - The corners with the minimal eigenvalue less than |
| RyoheiHagimoto | 0:0e0631af0305 | 1847 | \f$\texttt{qualityLevel} \cdot \max_{x,y} qualityMeasureMap(x,y)\f$ are rejected. |
| RyoheiHagimoto | 0:0e0631af0305 | 1848 | - The remaining corners are sorted by the quality measure in the descending order. |
| RyoheiHagimoto | 0:0e0631af0305 | 1849 | - Function throws away each corner for which there is a stronger corner at a distance less than |
| RyoheiHagimoto | 0:0e0631af0305 | 1850 | maxDistance. |
| RyoheiHagimoto | 0:0e0631af0305 | 1851 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1852 | The function can be used to initialize a point-based tracker of an object. |
| RyoheiHagimoto | 0:0e0631af0305 | 1853 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1854 | @note If the function is called with different values A and B of the parameter qualityLevel , and |
| RyoheiHagimoto | 0:0e0631af0305 | 1855 | A \> B, the vector of returned corners with qualityLevel=A will be the prefix of the output vector |
| RyoheiHagimoto | 0:0e0631af0305 | 1856 | with qualityLevel=B . |
| RyoheiHagimoto | 0:0e0631af0305 | 1857 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1858 | @param image Input 8-bit or floating-point 32-bit, single-channel image. |
| RyoheiHagimoto | 0:0e0631af0305 | 1859 | @param corners Output vector of detected corners. |
| RyoheiHagimoto | 0:0e0631af0305 | 1860 | @param maxCorners Maximum number of corners to return. If there are more corners than are found, |
| RyoheiHagimoto | 0:0e0631af0305 | 1861 | the strongest of them is returned. `maxCorners <= 0` implies that no limit on the maximum is set |
| RyoheiHagimoto | 0:0e0631af0305 | 1862 | and all detected corners are returned. |
| RyoheiHagimoto | 0:0e0631af0305 | 1863 | @param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The |
| RyoheiHagimoto | 0:0e0631af0305 | 1864 | parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue |
| RyoheiHagimoto | 0:0e0631af0305 | 1865 | (see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the |
| RyoheiHagimoto | 0:0e0631af0305 | 1866 | quality measure less than the product are rejected. For example, if the best corner has the |
| RyoheiHagimoto | 0:0e0631af0305 | 1867 | quality measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure |
| RyoheiHagimoto | 0:0e0631af0305 | 1868 | less than 15 are rejected. |
| RyoheiHagimoto | 0:0e0631af0305 | 1869 | @param minDistance Minimum possible Euclidean distance between the returned corners. |
| RyoheiHagimoto | 0:0e0631af0305 | 1870 | @param mask Optional region of interest. If the image is not empty (it needs to have the type |
| RyoheiHagimoto | 0:0e0631af0305 | 1871 | CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected. |
| RyoheiHagimoto | 0:0e0631af0305 | 1872 | @param blockSize Size of an average block for computing a derivative covariation matrix over each |
| RyoheiHagimoto | 0:0e0631af0305 | 1873 | pixel neighborhood. See cornerEigenValsAndVecs . |
| RyoheiHagimoto | 0:0e0631af0305 | 1874 | @param useHarrisDetector Parameter indicating whether to use a Harris detector (see cornerHarris) |
| RyoheiHagimoto | 0:0e0631af0305 | 1875 | or cornerMinEigenVal. |
| RyoheiHagimoto | 0:0e0631af0305 | 1876 | @param k Free parameter of the Harris detector. |
| RyoheiHagimoto | 0:0e0631af0305 | 1877 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1878 | @sa cornerMinEigenVal, cornerHarris, calcOpticalFlowPyrLK, estimateRigidTransform, |
| RyoheiHagimoto | 0:0e0631af0305 | 1879 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1880 | CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners, |
| RyoheiHagimoto | 0:0e0631af0305 | 1881 | int maxCorners, double qualityLevel, double minDistance, |
| RyoheiHagimoto | 0:0e0631af0305 | 1882 | InputArray mask = noArray(), int blockSize = 3, |
| RyoheiHagimoto | 0:0e0631af0305 | 1883 | bool useHarrisDetector = false, double k = 0.04 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1884 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1885 | /** @example houghlines.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 1886 | An example using the Hough line detector |
| RyoheiHagimoto | 0:0e0631af0305 | 1887 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1888 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1889 | /** @brief Finds lines in a binary image using the standard Hough transform. |
| RyoheiHagimoto | 0:0e0631af0305 | 1890 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1891 | The function implements the standard or standard multi-scale Hough transform algorithm for line |
| RyoheiHagimoto | 0:0e0631af0305 | 1892 | detection. See <http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm> for a good explanation of Hough |
| RyoheiHagimoto | 0:0e0631af0305 | 1893 | transform. |
| RyoheiHagimoto | 0:0e0631af0305 | 1894 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1895 | @param image 8-bit, single-channel binary source image. The image may be modified by the function. |
| RyoheiHagimoto | 0:0e0631af0305 | 1896 | @param lines Output vector of lines. Each line is represented by a two-element vector |
| RyoheiHagimoto | 0:0e0631af0305 | 1897 | \f$(\rho, \theta)\f$ . \f$\rho\f$ is the distance from the coordinate origin \f$(0,0)\f$ (top-left corner of |
| RyoheiHagimoto | 0:0e0631af0305 | 1898 | the image). \f$\theta\f$ is the line rotation angle in radians ( |
| RyoheiHagimoto | 0:0e0631af0305 | 1899 | \f$0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}\f$ ). |
| RyoheiHagimoto | 0:0e0631af0305 | 1900 | @param rho Distance resolution of the accumulator in pixels. |
| RyoheiHagimoto | 0:0e0631af0305 | 1901 | @param theta Angle resolution of the accumulator in radians. |
| RyoheiHagimoto | 0:0e0631af0305 | 1902 | @param threshold Accumulator threshold parameter. Only those lines are returned that get enough |
| RyoheiHagimoto | 0:0e0631af0305 | 1903 | votes ( \f$>\texttt{threshold}\f$ ). |
| RyoheiHagimoto | 0:0e0631af0305 | 1904 | @param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho . |
| RyoheiHagimoto | 0:0e0631af0305 | 1905 | The coarse accumulator distance resolution is rho and the accurate accumulator resolution is |
| RyoheiHagimoto | 0:0e0631af0305 | 1906 | rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these |
| RyoheiHagimoto | 0:0e0631af0305 | 1907 | parameters should be positive. |
| RyoheiHagimoto | 0:0e0631af0305 | 1908 | @param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta. |
| RyoheiHagimoto | 0:0e0631af0305 | 1909 | @param min_theta For standard and multi-scale Hough transform, minimum angle to check for lines. |
| RyoheiHagimoto | 0:0e0631af0305 | 1910 | Must fall between 0 and max_theta. |
| RyoheiHagimoto | 0:0e0631af0305 | 1911 | @param max_theta For standard and multi-scale Hough transform, maximum angle to check for lines. |
| RyoheiHagimoto | 0:0e0631af0305 | 1912 | Must fall between min_theta and CV_PI. |
| RyoheiHagimoto | 0:0e0631af0305 | 1913 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1914 | CV_EXPORTS_W void HoughLines( InputArray image, OutputArray lines, |
| RyoheiHagimoto | 0:0e0631af0305 | 1915 | double rho, double theta, int threshold, |
| RyoheiHagimoto | 0:0e0631af0305 | 1916 | double srn = 0, double stn = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 1917 | double min_theta = 0, double max_theta = CV_PI ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1918 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1919 | /** @brief Finds line segments in a binary image using the probabilistic Hough transform. |
| RyoheiHagimoto | 0:0e0631af0305 | 1920 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1921 | The function implements the probabilistic Hough transform algorithm for line detection, described |
| RyoheiHagimoto | 0:0e0631af0305 | 1922 | in @cite Matas00 |
| RyoheiHagimoto | 0:0e0631af0305 | 1923 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1924 | See the line detection example below: |
| RyoheiHagimoto | 0:0e0631af0305 | 1925 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1926 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 1927 | #include <opencv2/imgproc.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 1928 | #include <opencv2/highgui.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 1929 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1930 | using namespace cv; |
| RyoheiHagimoto | 0:0e0631af0305 | 1931 | using namespace std; |
| RyoheiHagimoto | 0:0e0631af0305 | 1932 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1933 | int main(int argc, char** argv) |
| RyoheiHagimoto | 0:0e0631af0305 | 1934 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 1935 | Mat src, dst, color_dst; |
| RyoheiHagimoto | 0:0e0631af0305 | 1936 | if( argc != 2 || !(src=imread(argv[1], 0)).data) |
| RyoheiHagimoto | 0:0e0631af0305 | 1937 | return -1; |
| RyoheiHagimoto | 0:0e0631af0305 | 1938 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1939 | Canny( src, dst, 50, 200, 3 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1940 | cvtColor( dst, color_dst, COLOR_GRAY2BGR ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1941 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1942 | #if 0 |
| RyoheiHagimoto | 0:0e0631af0305 | 1943 | vector<Vec2f> lines; |
| RyoheiHagimoto | 0:0e0631af0305 | 1944 | HoughLines( dst, lines, 1, CV_PI/180, 100 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1945 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1946 | for( size_t i = 0; i < lines.size(); i++ ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1947 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 1948 | float rho = lines[i][0]; |
| RyoheiHagimoto | 0:0e0631af0305 | 1949 | float theta = lines[i][1]; |
| RyoheiHagimoto | 0:0e0631af0305 | 1950 | double a = cos(theta), b = sin(theta); |
| RyoheiHagimoto | 0:0e0631af0305 | 1951 | double x0 = a*rho, y0 = b*rho; |
| RyoheiHagimoto | 0:0e0631af0305 | 1952 | Point pt1(cvRound(x0 + 1000*(-b)), |
| RyoheiHagimoto | 0:0e0631af0305 | 1953 | cvRound(y0 + 1000*(a))); |
| RyoheiHagimoto | 0:0e0631af0305 | 1954 | Point pt2(cvRound(x0 - 1000*(-b)), |
| RyoheiHagimoto | 0:0e0631af0305 | 1955 | cvRound(y0 - 1000*(a))); |
| RyoheiHagimoto | 0:0e0631af0305 | 1956 | line( color_dst, pt1, pt2, Scalar(0,0,255), 3, 8 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1957 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 1958 | #else |
| RyoheiHagimoto | 0:0e0631af0305 | 1959 | vector<Vec4i> lines; |
| RyoheiHagimoto | 0:0e0631af0305 | 1960 | HoughLinesP( dst, lines, 1, CV_PI/180, 80, 30, 10 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1961 | for( size_t i = 0; i < lines.size(); i++ ) |
| RyoheiHagimoto | 0:0e0631af0305 | 1962 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 1963 | line( color_dst, Point(lines[i][0], lines[i][1]), |
| RyoheiHagimoto | 0:0e0631af0305 | 1964 | Point(lines[i][2], lines[i][3]), Scalar(0,0,255), 3, 8 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1965 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 1966 | #endif |
| RyoheiHagimoto | 0:0e0631af0305 | 1967 | namedWindow( "Source", 1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1968 | imshow( "Source", src ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1969 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1970 | namedWindow( "Detected Lines", 1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1971 | imshow( "Detected Lines", color_dst ); |
| RyoheiHagimoto | 0:0e0631af0305 | 1972 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1973 | waitKey(0); |
| RyoheiHagimoto | 0:0e0631af0305 | 1974 | return 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 1975 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 1976 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 1977 | This is a sample picture the function parameters have been tuned for: |
| RyoheiHagimoto | 0:0e0631af0305 | 1978 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1979 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 1980 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1981 | And this is the output of the above program in case of the probabilistic Hough transform: |
| RyoheiHagimoto | 0:0e0631af0305 | 1982 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1983 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 1984 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1985 | @param image 8-bit, single-channel binary source image. The image may be modified by the function. |
| RyoheiHagimoto | 0:0e0631af0305 | 1986 | @param lines Output vector of lines. Each line is represented by a 4-element vector |
| RyoheiHagimoto | 0:0e0631af0305 | 1987 | \f$(x_1, y_1, x_2, y_2)\f$ , where \f$(x_1,y_1)\f$ and \f$(x_2, y_2)\f$ are the ending points of each detected |
| RyoheiHagimoto | 0:0e0631af0305 | 1988 | line segment. |
| RyoheiHagimoto | 0:0e0631af0305 | 1989 | @param rho Distance resolution of the accumulator in pixels. |
| RyoheiHagimoto | 0:0e0631af0305 | 1990 | @param theta Angle resolution of the accumulator in radians. |
| RyoheiHagimoto | 0:0e0631af0305 | 1991 | @param threshold Accumulator threshold parameter. Only those lines are returned that get enough |
| RyoheiHagimoto | 0:0e0631af0305 | 1992 | votes ( \f$>\texttt{threshold}\f$ ). |
| RyoheiHagimoto | 0:0e0631af0305 | 1993 | @param minLineLength Minimum line length. Line segments shorter than that are rejected. |
| RyoheiHagimoto | 0:0e0631af0305 | 1994 | @param maxLineGap Maximum allowed gap between points on the same line to link them. |
| RyoheiHagimoto | 0:0e0631af0305 | 1995 | |
| RyoheiHagimoto | 0:0e0631af0305 | 1996 | @sa LineSegmentDetector |
| RyoheiHagimoto | 0:0e0631af0305 | 1997 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 1998 | CV_EXPORTS_W void HoughLinesP( InputArray image, OutputArray lines, |
| RyoheiHagimoto | 0:0e0631af0305 | 1999 | double rho, double theta, int threshold, |
| RyoheiHagimoto | 0:0e0631af0305 | 2000 | double minLineLength = 0, double maxLineGap = 0 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2001 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2002 | /** @example houghcircles.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 2003 | An example using the Hough circle detector |
| RyoheiHagimoto | 0:0e0631af0305 | 2004 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2005 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2006 | /** @brief Finds circles in a grayscale image using the Hough transform. |
| RyoheiHagimoto | 0:0e0631af0305 | 2007 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2008 | The function finds circles in a grayscale image using a modification of the Hough transform. |
| RyoheiHagimoto | 0:0e0631af0305 | 2009 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2010 | Example: : |
| RyoheiHagimoto | 0:0e0631af0305 | 2011 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 2012 | #include <opencv2/imgproc.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 2013 | #include <opencv2/highgui.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 2014 | #include <math.h> |
| RyoheiHagimoto | 0:0e0631af0305 | 2015 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2016 | using namespace cv; |
| RyoheiHagimoto | 0:0e0631af0305 | 2017 | using namespace std; |
| RyoheiHagimoto | 0:0e0631af0305 | 2018 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2019 | int main(int argc, char** argv) |
| RyoheiHagimoto | 0:0e0631af0305 | 2020 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 2021 | Mat img, gray; |
| RyoheiHagimoto | 0:0e0631af0305 | 2022 | if( argc != 2 || !(img=imread(argv[1], 1)).data) |
| RyoheiHagimoto | 0:0e0631af0305 | 2023 | return -1; |
| RyoheiHagimoto | 0:0e0631af0305 | 2024 | cvtColor(img, gray, COLOR_BGR2GRAY); |
| RyoheiHagimoto | 0:0e0631af0305 | 2025 | // smooth it, otherwise a lot of false circles may be detected |
| RyoheiHagimoto | 0:0e0631af0305 | 2026 | GaussianBlur( gray, gray, Size(9, 9), 2, 2 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2027 | vector<Vec3f> circles; |
| RyoheiHagimoto | 0:0e0631af0305 | 2028 | HoughCircles(gray, circles, HOUGH_GRADIENT, |
| RyoheiHagimoto | 0:0e0631af0305 | 2029 | 2, gray.rows/4, 200, 100 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2030 | for( size_t i = 0; i < circles.size(); i++ ) |
| RyoheiHagimoto | 0:0e0631af0305 | 2031 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 2032 | Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); |
| RyoheiHagimoto | 0:0e0631af0305 | 2033 | int radius = cvRound(circles[i][2]); |
| RyoheiHagimoto | 0:0e0631af0305 | 2034 | // draw the circle center |
| RyoheiHagimoto | 0:0e0631af0305 | 2035 | circle( img, center, 3, Scalar(0,255,0), -1, 8, 0 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2036 | // draw the circle outline |
| RyoheiHagimoto | 0:0e0631af0305 | 2037 | circle( img, center, radius, Scalar(0,0,255), 3, 8, 0 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2038 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 2039 | namedWindow( "circles", 1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2040 | imshow( "circles", img ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2041 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2042 | waitKey(0); |
| RyoheiHagimoto | 0:0e0631af0305 | 2043 | return 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 2044 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 2045 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 2046 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2047 | @note Usually the function detects the centers of circles well. However, it may fail to find correct |
| RyoheiHagimoto | 0:0e0631af0305 | 2048 | radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if |
| RyoheiHagimoto | 0:0e0631af0305 | 2049 | you know it. Or, you may ignore the returned radius, use only the center, and find the correct |
| RyoheiHagimoto | 0:0e0631af0305 | 2050 | radius using an additional procedure. |
| RyoheiHagimoto | 0:0e0631af0305 | 2051 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2052 | @param image 8-bit, single-channel, grayscale input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2053 | @param circles Output vector of found circles. Each vector is encoded as a 3-element |
| RyoheiHagimoto | 0:0e0631af0305 | 2054 | floating-point vector \f$(x, y, radius)\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 2055 | @param method Detection method, see cv::HoughModes. Currently, the only implemented method is HOUGH_GRADIENT |
| RyoheiHagimoto | 0:0e0631af0305 | 2056 | @param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if |
| RyoheiHagimoto | 0:0e0631af0305 | 2057 | dp=1 , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has |
| RyoheiHagimoto | 0:0e0631af0305 | 2058 | half as big width and height. |
| RyoheiHagimoto | 0:0e0631af0305 | 2059 | @param minDist Minimum distance between the centers of the detected circles. If the parameter is |
| RyoheiHagimoto | 0:0e0631af0305 | 2060 | too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is |
| RyoheiHagimoto | 0:0e0631af0305 | 2061 | too large, some circles may be missed. |
| RyoheiHagimoto | 0:0e0631af0305 | 2062 | @param param1 First method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the higher |
| RyoheiHagimoto | 0:0e0631af0305 | 2063 | threshold of the two passed to the Canny edge detector (the lower one is twice smaller). |
| RyoheiHagimoto | 0:0e0631af0305 | 2064 | @param param2 Second method-specific parameter. In case of CV_HOUGH_GRADIENT , it is the |
| RyoheiHagimoto | 0:0e0631af0305 | 2065 | accumulator threshold for the circle centers at the detection stage. The smaller it is, the more |
| RyoheiHagimoto | 0:0e0631af0305 | 2066 | false circles may be detected. Circles, corresponding to the larger accumulator values, will be |
| RyoheiHagimoto | 0:0e0631af0305 | 2067 | returned first. |
| RyoheiHagimoto | 0:0e0631af0305 | 2068 | @param minRadius Minimum circle radius. |
| RyoheiHagimoto | 0:0e0631af0305 | 2069 | @param maxRadius Maximum circle radius. |
| RyoheiHagimoto | 0:0e0631af0305 | 2070 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2071 | @sa fitEllipse, minEnclosingCircle |
| RyoheiHagimoto | 0:0e0631af0305 | 2072 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2073 | CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles, |
| RyoheiHagimoto | 0:0e0631af0305 | 2074 | int method, double dp, double minDist, |
| RyoheiHagimoto | 0:0e0631af0305 | 2075 | double param1 = 100, double param2 = 100, |
| RyoheiHagimoto | 0:0e0631af0305 | 2076 | int minRadius = 0, int maxRadius = 0 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2077 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2078 | //! @} imgproc_feature |
| RyoheiHagimoto | 0:0e0631af0305 | 2079 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2080 | //! @addtogroup imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 2081 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 2082 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2083 | /** @example morphology2.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 2084 | An example using the morphological operations |
| RyoheiHagimoto | 0:0e0631af0305 | 2085 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2086 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2087 | /** @brief Erodes an image by using a specific structuring element. |
| RyoheiHagimoto | 0:0e0631af0305 | 2088 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2089 | The function erodes the source image using the specified structuring element that determines the |
| RyoheiHagimoto | 0:0e0631af0305 | 2090 | shape of a pixel neighborhood over which the minimum is taken: |
| RyoheiHagimoto | 0:0e0631af0305 | 2091 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2092 | \f[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2093 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2094 | The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In |
| RyoheiHagimoto | 0:0e0631af0305 | 2095 | case of multi-channel images, each channel is processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2096 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2097 | @param src input image; the number of channels can be arbitrary, but the depth should be one of |
| RyoheiHagimoto | 0:0e0631af0305 | 2098 | CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 2099 | @param dst output image of the same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 2100 | @param kernel structuring element used for erosion; if `element=Mat()`, a `3 x 3` rectangular |
| RyoheiHagimoto | 0:0e0631af0305 | 2101 | structuring element is used. Kernel can be created using getStructuringElement. |
| RyoheiHagimoto | 0:0e0631af0305 | 2102 | @param anchor position of the anchor within the element; default value (-1, -1) means that the |
| RyoheiHagimoto | 0:0e0631af0305 | 2103 | anchor is at the element center. |
| RyoheiHagimoto | 0:0e0631af0305 | 2104 | @param iterations number of times erosion is applied. |
| RyoheiHagimoto | 0:0e0631af0305 | 2105 | @param borderType pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 2106 | @param borderValue border value in case of a constant border |
| RyoheiHagimoto | 0:0e0631af0305 | 2107 | @sa dilate, morphologyEx, getStructuringElement |
| RyoheiHagimoto | 0:0e0631af0305 | 2108 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2109 | CV_EXPORTS_W void erode( InputArray src, OutputArray dst, InputArray kernel, |
| RyoheiHagimoto | 0:0e0631af0305 | 2110 | Point anchor = Point(-1,-1), int iterations = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 2111 | int borderType = BORDER_CONSTANT, |
| RyoheiHagimoto | 0:0e0631af0305 | 2112 | const Scalar& borderValue = morphologyDefaultBorderValue() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2113 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2114 | /** @brief Dilates an image by using a specific structuring element. |
| RyoheiHagimoto | 0:0e0631af0305 | 2115 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2116 | The function dilates the source image using the specified structuring element that determines the |
| RyoheiHagimoto | 0:0e0631af0305 | 2117 | shape of a pixel neighborhood over which the maximum is taken: |
| RyoheiHagimoto | 0:0e0631af0305 | 2118 | \f[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2119 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2120 | The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In |
| RyoheiHagimoto | 0:0e0631af0305 | 2121 | case of multi-channel images, each channel is processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2122 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2123 | @param src input image; the number of channels can be arbitrary, but the depth should be one of |
| RyoheiHagimoto | 0:0e0631af0305 | 2124 | CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 2125 | @param dst output image of the same size and type as src\`. |
| RyoheiHagimoto | 0:0e0631af0305 | 2126 | @param kernel structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular |
| RyoheiHagimoto | 0:0e0631af0305 | 2127 | structuring element is used. Kernel can be created using getStructuringElement |
| RyoheiHagimoto | 0:0e0631af0305 | 2128 | @param anchor position of the anchor within the element; default value (-1, -1) means that the |
| RyoheiHagimoto | 0:0e0631af0305 | 2129 | anchor is at the element center. |
| RyoheiHagimoto | 0:0e0631af0305 | 2130 | @param iterations number of times dilation is applied. |
| RyoheiHagimoto | 0:0e0631af0305 | 2131 | @param borderType pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 2132 | @param borderValue border value in case of a constant border |
| RyoheiHagimoto | 0:0e0631af0305 | 2133 | @sa erode, morphologyEx, getStructuringElement |
| RyoheiHagimoto | 0:0e0631af0305 | 2134 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2135 | CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel, |
| RyoheiHagimoto | 0:0e0631af0305 | 2136 | Point anchor = Point(-1,-1), int iterations = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 2137 | int borderType = BORDER_CONSTANT, |
| RyoheiHagimoto | 0:0e0631af0305 | 2138 | const Scalar& borderValue = morphologyDefaultBorderValue() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2139 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2140 | /** @brief Performs advanced morphological transformations. |
| RyoheiHagimoto | 0:0e0631af0305 | 2141 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2142 | The function morphologyEx can perform advanced morphological transformations using an erosion and dilation as |
| RyoheiHagimoto | 0:0e0631af0305 | 2143 | basic operations. |
| RyoheiHagimoto | 0:0e0631af0305 | 2144 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2145 | Any of the operations can be done in-place. In case of multi-channel images, each channel is |
| RyoheiHagimoto | 0:0e0631af0305 | 2146 | processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2147 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2148 | @param src Source image. The number of channels can be arbitrary. The depth should be one of |
| RyoheiHagimoto | 0:0e0631af0305 | 2149 | CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 2150 | @param dst Destination image of the same size and type as source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2151 | @param op Type of a morphological operation, see cv::MorphTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 2152 | @param kernel Structuring element. It can be created using cv::getStructuringElement. |
| RyoheiHagimoto | 0:0e0631af0305 | 2153 | @param anchor Anchor position with the kernel. Negative values mean that the anchor is at the |
| RyoheiHagimoto | 0:0e0631af0305 | 2154 | kernel center. |
| RyoheiHagimoto | 0:0e0631af0305 | 2155 | @param iterations Number of times erosion and dilation are applied. |
| RyoheiHagimoto | 0:0e0631af0305 | 2156 | @param borderType Pixel extrapolation method, see cv::BorderTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 2157 | @param borderValue Border value in case of a constant border. The default value has a special |
| RyoheiHagimoto | 0:0e0631af0305 | 2158 | meaning. |
| RyoheiHagimoto | 0:0e0631af0305 | 2159 | @sa dilate, erode, getStructuringElement |
| RyoheiHagimoto | 0:0e0631af0305 | 2160 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2161 | CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2162 | int op, InputArray kernel, |
| RyoheiHagimoto | 0:0e0631af0305 | 2163 | Point anchor = Point(-1,-1), int iterations = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 2164 | int borderType = BORDER_CONSTANT, |
| RyoheiHagimoto | 0:0e0631af0305 | 2165 | const Scalar& borderValue = morphologyDefaultBorderValue() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2166 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2167 | //! @} imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 2168 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2169 | //! @addtogroup imgproc_transform |
| RyoheiHagimoto | 0:0e0631af0305 | 2170 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 2171 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2172 | /** @brief Resizes an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2173 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2174 | The function resize resizes the image src down to or up to the specified size. Note that the |
| RyoheiHagimoto | 0:0e0631af0305 | 2175 | initial dst type or size are not taken into account. Instead, the size and type are derived from |
| RyoheiHagimoto | 0:0e0631af0305 | 2176 | the `src`,`dsize`,`fx`, and `fy`. If you want to resize src so that it fits the pre-created dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2177 | you may call the function as follows: |
| RyoheiHagimoto | 0:0e0631af0305 | 2178 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 2179 | // explicitly specify dsize=dst.size(); fx and fy will be computed from that. |
| RyoheiHagimoto | 0:0e0631af0305 | 2180 | resize(src, dst, dst.size(), 0, 0, interpolation); |
| RyoheiHagimoto | 0:0e0631af0305 | 2181 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 2182 | If you want to decimate the image by factor of 2 in each direction, you can call the function this |
| RyoheiHagimoto | 0:0e0631af0305 | 2183 | way: |
| RyoheiHagimoto | 0:0e0631af0305 | 2184 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 2185 | // specify fx and fy and let the function compute the destination image size. |
| RyoheiHagimoto | 0:0e0631af0305 | 2186 | resize(src, dst, Size(), 0.5, 0.5, interpolation); |
| RyoheiHagimoto | 0:0e0631af0305 | 2187 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 2188 | To shrink an image, it will generally look best with cv::INTER_AREA interpolation, whereas to |
| RyoheiHagimoto | 0:0e0631af0305 | 2189 | enlarge an image, it will generally look best with cv::INTER_CUBIC (slow) or cv::INTER_LINEAR |
| RyoheiHagimoto | 0:0e0631af0305 | 2190 | (faster but still looks OK). |
| RyoheiHagimoto | 0:0e0631af0305 | 2191 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2192 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2193 | @param dst output image; it has the size dsize (when it is non-zero) or the size computed from |
| RyoheiHagimoto | 0:0e0631af0305 | 2194 | src.size(), fx, and fy; the type of dst is the same as of src. |
| RyoheiHagimoto | 0:0e0631af0305 | 2195 | @param dsize output image size; if it equals zero, it is computed as: |
| RyoheiHagimoto | 0:0e0631af0305 | 2196 | \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2197 | Either dsize or both fx and fy must be non-zero. |
| RyoheiHagimoto | 0:0e0631af0305 | 2198 | @param fx scale factor along the horizontal axis; when it equals 0, it is computed as |
| RyoheiHagimoto | 0:0e0631af0305 | 2199 | \f[\texttt{(double)dsize.width/src.cols}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2200 | @param fy scale factor along the vertical axis; when it equals 0, it is computed as |
| RyoheiHagimoto | 0:0e0631af0305 | 2201 | \f[\texttt{(double)dsize.height/src.rows}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2202 | @param interpolation interpolation method, see cv::InterpolationFlags |
| RyoheiHagimoto | 0:0e0631af0305 | 2203 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2204 | @sa warpAffine, warpPerspective, remap |
| RyoheiHagimoto | 0:0e0631af0305 | 2205 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2206 | CV_EXPORTS_W void resize( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2207 | Size dsize, double fx = 0, double fy = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 2208 | int interpolation = INTER_LINEAR ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2209 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2210 | /** @brief Applies an affine transformation to an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2211 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2212 | The function warpAffine transforms the source image using the specified matrix: |
| RyoheiHagimoto | 0:0e0631af0305 | 2213 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2214 | \f[\texttt{dst} (x,y) = \texttt{src} ( \texttt{M} _{11} x + \texttt{M} _{12} y + \texttt{M} _{13}, \texttt{M} _{21} x + \texttt{M} _{22} y + \texttt{M} _{23})\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2215 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2216 | when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted |
| RyoheiHagimoto | 0:0e0631af0305 | 2217 | with cv::invertAffineTransform and then put in the formula above instead of M. The function cannot |
| RyoheiHagimoto | 0:0e0631af0305 | 2218 | operate in-place. |
| RyoheiHagimoto | 0:0e0631af0305 | 2219 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2220 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2221 | @param dst output image that has the size dsize and the same type as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2222 | @param M \f$2\times 3\f$ transformation matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 2223 | @param dsize size of the output image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2224 | @param flags combination of interpolation methods (see cv::InterpolationFlags) and the optional |
| RyoheiHagimoto | 0:0e0631af0305 | 2225 | flag WARP_INVERSE_MAP that means that M is the inverse transformation ( |
| RyoheiHagimoto | 0:0e0631af0305 | 2226 | \f$\texttt{dst}\rightarrow\texttt{src}\f$ ). |
| RyoheiHagimoto | 0:0e0631af0305 | 2227 | @param borderMode pixel extrapolation method (see cv::BorderTypes); when |
| RyoheiHagimoto | 0:0e0631af0305 | 2228 | borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to |
| RyoheiHagimoto | 0:0e0631af0305 | 2229 | the "outliers" in the source image are not modified by the function. |
| RyoheiHagimoto | 0:0e0631af0305 | 2230 | @param borderValue value used in case of a constant border; by default, it is 0. |
| RyoheiHagimoto | 0:0e0631af0305 | 2231 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2232 | @sa warpPerspective, resize, remap, getRectSubPix, transform |
| RyoheiHagimoto | 0:0e0631af0305 | 2233 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2234 | CV_EXPORTS_W void warpAffine( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2235 | InputArray M, Size dsize, |
| RyoheiHagimoto | 0:0e0631af0305 | 2236 | int flags = INTER_LINEAR, |
| RyoheiHagimoto | 0:0e0631af0305 | 2237 | int borderMode = BORDER_CONSTANT, |
| RyoheiHagimoto | 0:0e0631af0305 | 2238 | const Scalar& borderValue = Scalar()); |
| RyoheiHagimoto | 0:0e0631af0305 | 2239 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2240 | /** @brief Applies a perspective transformation to an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2241 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2242 | The function warpPerspective transforms the source image using the specified matrix: |
| RyoheiHagimoto | 0:0e0631af0305 | 2243 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2244 | \f[\texttt{dst} (x,y) = \texttt{src} \left ( \frac{M_{11} x + M_{12} y + M_{13}}{M_{31} x + M_{32} y + M_{33}} , |
| RyoheiHagimoto | 0:0e0631af0305 | 2245 | \frac{M_{21} x + M_{22} y + M_{23}}{M_{31} x + M_{32} y + M_{33}} \right )\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2246 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2247 | when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert |
| RyoheiHagimoto | 0:0e0631af0305 | 2248 | and then put in the formula above instead of M. The function cannot operate in-place. |
| RyoheiHagimoto | 0:0e0631af0305 | 2249 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2250 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2251 | @param dst output image that has the size dsize and the same type as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2252 | @param M \f$3\times 3\f$ transformation matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 2253 | @param dsize size of the output image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2254 | @param flags combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the |
| RyoheiHagimoto | 0:0e0631af0305 | 2255 | optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation ( |
| RyoheiHagimoto | 0:0e0631af0305 | 2256 | \f$\texttt{dst}\rightarrow\texttt{src}\f$ ). |
| RyoheiHagimoto | 0:0e0631af0305 | 2257 | @param borderMode pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). |
| RyoheiHagimoto | 0:0e0631af0305 | 2258 | @param borderValue value used in case of a constant border; by default, it equals 0. |
| RyoheiHagimoto | 0:0e0631af0305 | 2259 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2260 | @sa warpAffine, resize, remap, getRectSubPix, perspectiveTransform |
| RyoheiHagimoto | 0:0e0631af0305 | 2261 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2262 | CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2263 | InputArray M, Size dsize, |
| RyoheiHagimoto | 0:0e0631af0305 | 2264 | int flags = INTER_LINEAR, |
| RyoheiHagimoto | 0:0e0631af0305 | 2265 | int borderMode = BORDER_CONSTANT, |
| RyoheiHagimoto | 0:0e0631af0305 | 2266 | const Scalar& borderValue = Scalar()); |
| RyoheiHagimoto | 0:0e0631af0305 | 2267 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2268 | /** @brief Applies a generic geometrical transformation to an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2269 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2270 | The function remap transforms the source image using the specified map: |
| RyoheiHagimoto | 0:0e0631af0305 | 2271 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2272 | \f[\texttt{dst} (x,y) = \texttt{src} (map_x(x,y),map_y(x,y))\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2273 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2274 | where values of pixels with non-integer coordinates are computed using one of available |
| RyoheiHagimoto | 0:0e0631af0305 | 2275 | interpolation methods. \f$map_x\f$ and \f$map_y\f$ can be encoded as separate floating-point maps |
| RyoheiHagimoto | 0:0e0631af0305 | 2276 | in \f$map_1\f$ and \f$map_2\f$ respectively, or interleaved floating-point maps of \f$(x,y)\f$ in |
| RyoheiHagimoto | 0:0e0631af0305 | 2277 | \f$map_1\f$, or fixed-point maps created by using convertMaps. The reason you might want to |
| RyoheiHagimoto | 0:0e0631af0305 | 2278 | convert from floating to fixed-point representations of a map is that they can yield much faster |
| RyoheiHagimoto | 0:0e0631af0305 | 2279 | (\~2x) remapping operations. In the converted case, \f$map_1\f$ contains pairs (cvFloor(x), |
| RyoheiHagimoto | 0:0e0631af0305 | 2280 | cvFloor(y)) and \f$map_2\f$ contains indices in a table of interpolation coefficients. |
| RyoheiHagimoto | 0:0e0631af0305 | 2281 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2282 | This function cannot operate in-place. |
| RyoheiHagimoto | 0:0e0631af0305 | 2283 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2284 | @param src Source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2285 | @param dst Destination image. It has the same size as map1 and the same type as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2286 | @param map1 The first map of either (x,y) points or just x values having the type CV_16SC2 , |
| RyoheiHagimoto | 0:0e0631af0305 | 2287 | CV_32FC1, or CV_32FC2. See convertMaps for details on converting a floating point |
| RyoheiHagimoto | 0:0e0631af0305 | 2288 | representation to fixed-point for speed. |
| RyoheiHagimoto | 0:0e0631af0305 | 2289 | @param map2 The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map |
| RyoheiHagimoto | 0:0e0631af0305 | 2290 | if map1 is (x,y) points), respectively. |
| RyoheiHagimoto | 0:0e0631af0305 | 2291 | @param interpolation Interpolation method (see cv::InterpolationFlags). The method INTER_AREA is |
| RyoheiHagimoto | 0:0e0631af0305 | 2292 | not supported by this function. |
| RyoheiHagimoto | 0:0e0631af0305 | 2293 | @param borderMode Pixel extrapolation method (see cv::BorderTypes). When |
| RyoheiHagimoto | 0:0e0631af0305 | 2294 | borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that |
| RyoheiHagimoto | 0:0e0631af0305 | 2295 | corresponds to the "outliers" in the source image are not modified by the function. |
| RyoheiHagimoto | 0:0e0631af0305 | 2296 | @param borderValue Value used in case of a constant border. By default, it is 0. |
| RyoheiHagimoto | 0:0e0631af0305 | 2297 | @note |
| RyoheiHagimoto | 0:0e0631af0305 | 2298 | Due to current implementaion limitations the size of an input and output images should be less than 32767x32767. |
| RyoheiHagimoto | 0:0e0631af0305 | 2299 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2300 | CV_EXPORTS_W void remap( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2301 | InputArray map1, InputArray map2, |
| RyoheiHagimoto | 0:0e0631af0305 | 2302 | int interpolation, int borderMode = BORDER_CONSTANT, |
| RyoheiHagimoto | 0:0e0631af0305 | 2303 | const Scalar& borderValue = Scalar()); |
| RyoheiHagimoto | 0:0e0631af0305 | 2304 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2305 | /** @brief Converts image transformation maps from one representation to another. |
| RyoheiHagimoto | 0:0e0631af0305 | 2306 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2307 | The function converts a pair of maps for remap from one representation to another. The following |
| RyoheiHagimoto | 0:0e0631af0305 | 2308 | options ( (map1.type(), map2.type()) \f$\rightarrow\f$ (dstmap1.type(), dstmap2.type()) ) are |
| RyoheiHagimoto | 0:0e0631af0305 | 2309 | supported: |
| RyoheiHagimoto | 0:0e0631af0305 | 2310 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2311 | - \f$\texttt{(CV_32FC1, CV_32FC1)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. This is the |
| RyoheiHagimoto | 0:0e0631af0305 | 2312 | most frequently used conversion operation, in which the original floating-point maps (see remap ) |
| RyoheiHagimoto | 0:0e0631af0305 | 2313 | are converted to a more compact and much faster fixed-point representation. The first output array |
| RyoheiHagimoto | 0:0e0631af0305 | 2314 | contains the rounded coordinates and the second array (created only when nninterpolation=false ) |
| RyoheiHagimoto | 0:0e0631af0305 | 2315 | contains indices in the interpolation tables. |
| RyoheiHagimoto | 0:0e0631af0305 | 2316 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2317 | - \f$\texttt{(CV_32FC2)} \rightarrow \texttt{(CV_16SC2, CV_16UC1)}\f$. The same as above but |
| RyoheiHagimoto | 0:0e0631af0305 | 2318 | the original maps are stored in one 2-channel matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 2319 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2320 | - Reverse conversion. Obviously, the reconstructed floating-point maps will not be exactly the same |
| RyoheiHagimoto | 0:0e0631af0305 | 2321 | as the originals. |
| RyoheiHagimoto | 0:0e0631af0305 | 2322 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2323 | @param map1 The first input map of type CV_16SC2, CV_32FC1, or CV_32FC2 . |
| RyoheiHagimoto | 0:0e0631af0305 | 2324 | @param map2 The second input map of type CV_16UC1, CV_32FC1, or none (empty matrix), |
| RyoheiHagimoto | 0:0e0631af0305 | 2325 | respectively. |
| RyoheiHagimoto | 0:0e0631af0305 | 2326 | @param dstmap1 The first output map that has the type dstmap1type and the same size as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2327 | @param dstmap2 The second output map. |
| RyoheiHagimoto | 0:0e0631af0305 | 2328 | @param dstmap1type Type of the first output map that should be CV_16SC2, CV_32FC1, or |
| RyoheiHagimoto | 0:0e0631af0305 | 2329 | CV_32FC2 . |
| RyoheiHagimoto | 0:0e0631af0305 | 2330 | @param nninterpolation Flag indicating whether the fixed-point maps are used for the |
| RyoheiHagimoto | 0:0e0631af0305 | 2331 | nearest-neighbor or for a more complex interpolation. |
| RyoheiHagimoto | 0:0e0631af0305 | 2332 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2333 | @sa remap, undistort, initUndistortRectifyMap |
| RyoheiHagimoto | 0:0e0631af0305 | 2334 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2335 | CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2, |
| RyoheiHagimoto | 0:0e0631af0305 | 2336 | OutputArray dstmap1, OutputArray dstmap2, |
| RyoheiHagimoto | 0:0e0631af0305 | 2337 | int dstmap1type, bool nninterpolation = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2338 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2339 | /** @brief Calculates an affine matrix of 2D rotation. |
| RyoheiHagimoto | 0:0e0631af0305 | 2340 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2341 | The function calculates the following matrix: |
| RyoheiHagimoto | 0:0e0631af0305 | 2342 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2343 | \f[\begin{bmatrix} \alpha & \beta & (1- \alpha ) \cdot \texttt{center.x} - \beta \cdot \texttt{center.y} \\ - \beta & \alpha & \beta \cdot \texttt{center.x} + (1- \alpha ) \cdot \texttt{center.y} \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2344 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2345 | where |
| RyoheiHagimoto | 0:0e0631af0305 | 2346 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2347 | \f[\begin{array}{l} \alpha = \texttt{scale} \cdot \cos \texttt{angle} , \\ \beta = \texttt{scale} \cdot \sin \texttt{angle} \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2348 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2349 | The transformation maps the rotation center to itself. If this is not the target, adjust the shift. |
| RyoheiHagimoto | 0:0e0631af0305 | 2350 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2351 | @param center Center of the rotation in the source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2352 | @param angle Rotation angle in degrees. Positive values mean counter-clockwise rotation (the |
| RyoheiHagimoto | 0:0e0631af0305 | 2353 | coordinate origin is assumed to be the top-left corner). |
| RyoheiHagimoto | 0:0e0631af0305 | 2354 | @param scale Isotropic scale factor. |
| RyoheiHagimoto | 0:0e0631af0305 | 2355 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2356 | @sa getAffineTransform, warpAffine, transform |
| RyoheiHagimoto | 0:0e0631af0305 | 2357 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2358 | CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2359 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2360 | //! returns 3x3 perspective transformation for the corresponding 4 point pairs. |
| RyoheiHagimoto | 0:0e0631af0305 | 2361 | CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2362 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2363 | /** @brief Calculates an affine transform from three pairs of the corresponding points. |
| RyoheiHagimoto | 0:0e0631af0305 | 2364 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2365 | The function calculates the \f$2 \times 3\f$ matrix of an affine transform so that: |
| RyoheiHagimoto | 0:0e0631af0305 | 2366 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2367 | \f[\begin{bmatrix} x'_i \\ y'_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2368 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2369 | where |
| RyoheiHagimoto | 0:0e0631af0305 | 2370 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2371 | \f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2372 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2373 | @param src Coordinates of triangle vertices in the source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2374 | @param dst Coordinates of the corresponding triangle vertices in the destination image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2375 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2376 | @sa warpAffine, transform |
| RyoheiHagimoto | 0:0e0631af0305 | 2377 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2378 | CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2379 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2380 | /** @brief Inverts an affine transformation. |
| RyoheiHagimoto | 0:0e0631af0305 | 2381 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2382 | The function computes an inverse affine transformation represented by \f$2 \times 3\f$ matrix M: |
| RyoheiHagimoto | 0:0e0631af0305 | 2383 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2384 | \f[\begin{bmatrix} a_{11} & a_{12} & b_1 \\ a_{21} & a_{22} & b_2 \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2385 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2386 | The result is also a \f$2 \times 3\f$ matrix of the same type as M. |
| RyoheiHagimoto | 0:0e0631af0305 | 2387 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2388 | @param M Original affine transformation. |
| RyoheiHagimoto | 0:0e0631af0305 | 2389 | @param iM Output reverse affine transformation. |
| RyoheiHagimoto | 0:0e0631af0305 | 2390 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2391 | CV_EXPORTS_W void invertAffineTransform( InputArray M, OutputArray iM ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2392 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2393 | /** @brief Calculates a perspective transform from four pairs of the corresponding points. |
| RyoheiHagimoto | 0:0e0631af0305 | 2394 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2395 | The function calculates the \f$3 \times 3\f$ matrix of a perspective transform so that: |
| RyoheiHagimoto | 0:0e0631af0305 | 2396 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2397 | \f[\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2398 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2399 | where |
| RyoheiHagimoto | 0:0e0631af0305 | 2400 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2401 | \f[dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2402 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2403 | @param src Coordinates of quadrangle vertices in the source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2404 | @param dst Coordinates of the corresponding quadrangle vertices in the destination image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2405 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2406 | @sa findHomography, warpPerspective, perspectiveTransform |
| RyoheiHagimoto | 0:0e0631af0305 | 2407 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2408 | CV_EXPORTS_W Mat getPerspectiveTransform( InputArray src, InputArray dst ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2409 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2410 | CV_EXPORTS_W Mat getAffineTransform( InputArray src, InputArray dst ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2411 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2412 | /** @brief Retrieves a pixel rectangle from an image with sub-pixel accuracy. |
| RyoheiHagimoto | 0:0e0631af0305 | 2413 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2414 | The function getRectSubPix extracts pixels from src: |
| RyoheiHagimoto | 0:0e0631af0305 | 2415 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2416 | \f[dst(x, y) = src(x + \texttt{center.x} - ( \texttt{dst.cols} -1)*0.5, y + \texttt{center.y} - ( \texttt{dst.rows} -1)*0.5)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2417 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2418 | where the values of the pixels at non-integer coordinates are retrieved using bilinear |
| RyoheiHagimoto | 0:0e0631af0305 | 2419 | interpolation. Every channel of multi-channel images is processed independently. While the center of |
| RyoheiHagimoto | 0:0e0631af0305 | 2420 | the rectangle must be inside the image, parts of the rectangle may be outside. In this case, the |
| RyoheiHagimoto | 0:0e0631af0305 | 2421 | replication border mode (see cv::BorderTypes) is used to extrapolate the pixel values outside of |
| RyoheiHagimoto | 0:0e0631af0305 | 2422 | the image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2423 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2424 | @param image Source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2425 | @param patchSize Size of the extracted patch. |
| RyoheiHagimoto | 0:0e0631af0305 | 2426 | @param center Floating point coordinates of the center of the extracted rectangle within the |
| RyoheiHagimoto | 0:0e0631af0305 | 2427 | source image. The center must be inside the image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2428 | @param patch Extracted patch that has the size patchSize and the same number of channels as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2429 | @param patchType Depth of the extracted pixels. By default, they have the same depth as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2430 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2431 | @sa warpAffine, warpPerspective |
| RyoheiHagimoto | 0:0e0631af0305 | 2432 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2433 | CV_EXPORTS_W void getRectSubPix( InputArray image, Size patchSize, |
| RyoheiHagimoto | 0:0e0631af0305 | 2434 | Point2f center, OutputArray patch, int patchType = -1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2435 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2436 | /** @example polar_transforms.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 2437 | An example using the cv::linearPolar and cv::logPolar operations |
| RyoheiHagimoto | 0:0e0631af0305 | 2438 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2439 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2440 | /** @brief Remaps an image to semilog-polar coordinates space. |
| RyoheiHagimoto | 0:0e0631af0305 | 2441 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2442 | Transform the source image using the following transformation (See @ref polar_remaps_reference_image "Polar remaps reference image"): |
| RyoheiHagimoto | 0:0e0631af0305 | 2443 | \f[\begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2444 | dst( \rho , \phi ) = src(x,y) \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2445 | dst.size() \leftarrow src.size() |
| RyoheiHagimoto | 0:0e0631af0305 | 2446 | \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2447 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2448 | where |
| RyoheiHagimoto | 0:0e0631af0305 | 2449 | \f[\begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2450 | I = (dx,dy) = (x - center.x,y - center.y) \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2451 | \rho = M \cdot log_e(\texttt{magnitude} (I)) ,\\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2452 | \phi = Ky \cdot \texttt{angle} (I)_{0..360 deg} \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2453 | \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2454 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2455 | and |
| RyoheiHagimoto | 0:0e0631af0305 | 2456 | \f[\begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2457 | M = src.cols / log_e(maxRadius) \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2458 | Ky = src.rows / 360 \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2459 | \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2460 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2461 | The function emulates the human "foveal" vision and can be used for fast scale and |
| RyoheiHagimoto | 0:0e0631af0305 | 2462 | rotation-invariant template matching, for object tracking and so forth. |
| RyoheiHagimoto | 0:0e0631af0305 | 2463 | @param src Source image |
| RyoheiHagimoto | 0:0e0631af0305 | 2464 | @param dst Destination image. It will have same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 2465 | @param center The transformation center; where the output precision is maximal |
| RyoheiHagimoto | 0:0e0631af0305 | 2466 | @param M Magnitude scale parameter. It determines the radius of the bounding circle to transform too. |
| RyoheiHagimoto | 0:0e0631af0305 | 2467 | @param flags A combination of interpolation methods, see cv::InterpolationFlags |
| RyoheiHagimoto | 0:0e0631af0305 | 2468 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2469 | @note |
| RyoheiHagimoto | 0:0e0631af0305 | 2470 | - The function can not operate in-place. |
| RyoheiHagimoto | 0:0e0631af0305 | 2471 | - To calculate magnitude and angle in degrees @ref cv::cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 2472 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2473 | CV_EXPORTS_W void logPolar( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2474 | Point2f center, double M, int flags ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2475 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2476 | /** @brief Remaps an image to polar coordinates space. |
| RyoheiHagimoto | 0:0e0631af0305 | 2477 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2478 | @anchor polar_remaps_reference_image |
| RyoheiHagimoto | 0:0e0631af0305 | 2479 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 2480 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2481 | Transform the source image using the following transformation: |
| RyoheiHagimoto | 0:0e0631af0305 | 2482 | \f[\begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2483 | dst( \rho , \phi ) = src(x,y) \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2484 | dst.size() \leftarrow src.size() |
| RyoheiHagimoto | 0:0e0631af0305 | 2485 | \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2486 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2487 | where |
| RyoheiHagimoto | 0:0e0631af0305 | 2488 | \f[\begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2489 | I = (dx,dy) = (x - center.x,y - center.y) \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2490 | \rho = Kx \cdot \texttt{magnitude} (I) ,\\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2491 | \phi = Ky \cdot \texttt{angle} (I)_{0..360 deg} |
| RyoheiHagimoto | 0:0e0631af0305 | 2492 | \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2493 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2494 | and |
| RyoheiHagimoto | 0:0e0631af0305 | 2495 | \f[\begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2496 | Kx = src.cols / maxRadius \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2497 | Ky = src.rows / 360 |
| RyoheiHagimoto | 0:0e0631af0305 | 2498 | \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2499 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2500 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2501 | @param src Source image |
| RyoheiHagimoto | 0:0e0631af0305 | 2502 | @param dst Destination image. It will have same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 2503 | @param center The transformation center; |
| RyoheiHagimoto | 0:0e0631af0305 | 2504 | @param maxRadius The radius of the bounding circle to transform. It determines the inverse magnitude scale parameter too. |
| RyoheiHagimoto | 0:0e0631af0305 | 2505 | @param flags A combination of interpolation methods, see cv::InterpolationFlags |
| RyoheiHagimoto | 0:0e0631af0305 | 2506 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2507 | @note |
| RyoheiHagimoto | 0:0e0631af0305 | 2508 | - The function can not operate in-place. |
| RyoheiHagimoto | 0:0e0631af0305 | 2509 | - To calculate magnitude and angle in degrees @ref cv::cartToPolar is used internally thus angles are measured from 0 to 360 with accuracy about 0.3 degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 2510 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2511 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2512 | CV_EXPORTS_W void linearPolar( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2513 | Point2f center, double maxRadius, int flags ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2514 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2515 | //! @} imgproc_transform |
| RyoheiHagimoto | 0:0e0631af0305 | 2516 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2517 | //! @addtogroup imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 2518 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 2519 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2520 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2521 | CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth = -1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2522 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2523 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2524 | CV_EXPORTS_AS(integral2) void integral( InputArray src, OutputArray sum, |
| RyoheiHagimoto | 0:0e0631af0305 | 2525 | OutputArray sqsum, int sdepth = -1, int sqdepth = -1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2526 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2527 | /** @brief Calculates the integral of an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2528 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2529 | The function calculates one or more integral images for the source image as follows: |
| RyoheiHagimoto | 0:0e0631af0305 | 2530 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2531 | \f[\texttt{sum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2532 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2533 | \f[\texttt{sqsum} (X,Y) = \sum _{x<X,y<Y} \texttt{image} (x,y)^2\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2534 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2535 | \f[\texttt{tilted} (X,Y) = \sum _{y<Y,abs(x-X+1) \leq Y-y-1} \texttt{image} (x,y)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2536 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2537 | Using these integral images, you can calculate sum, mean, and standard deviation over a specific |
| RyoheiHagimoto | 0:0e0631af0305 | 2538 | up-right or rotated rectangular region of the image in a constant time, for example: |
| RyoheiHagimoto | 0:0e0631af0305 | 2539 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2540 | \f[\sum _{x_1 \leq x < x_2, \, y_1 \leq y < y_2} \texttt{image} (x,y) = \texttt{sum} (x_2,y_2)- \texttt{sum} (x_1,y_2)- \texttt{sum} (x_2,y_1)+ \texttt{sum} (x_1,y_1)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2541 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2542 | It makes possible to do a fast blurring or fast block correlation with a variable window size, for |
| RyoheiHagimoto | 0:0e0631af0305 | 2543 | example. In case of multi-channel images, sums for each channel are accumulated independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2544 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2545 | As a practical example, the next figure shows the calculation of the integral of a straight |
| RyoheiHagimoto | 0:0e0631af0305 | 2546 | rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the |
| RyoheiHagimoto | 0:0e0631af0305 | 2547 | original image are shown, as well as the relative pixels in the integral images sum and tilted . |
| RyoheiHagimoto | 0:0e0631af0305 | 2548 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2549 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 2550 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2551 | @param src input image as \f$W \times H\f$, 8-bit or floating-point (32f or 64f). |
| RyoheiHagimoto | 0:0e0631af0305 | 2552 | @param sum integral image as \f$(W+1)\times (H+1)\f$ , 32-bit integer or floating-point (32f or 64f). |
| RyoheiHagimoto | 0:0e0631af0305 | 2553 | @param sqsum integral image for squared pixel values; it is \f$(W+1)\times (H+1)\f$, double-precision |
| RyoheiHagimoto | 0:0e0631af0305 | 2554 | floating-point (64f) array. |
| RyoheiHagimoto | 0:0e0631af0305 | 2555 | @param tilted integral for the image rotated by 45 degrees; it is \f$(W+1)\times (H+1)\f$ array with |
| RyoheiHagimoto | 0:0e0631af0305 | 2556 | the same data type as sum. |
| RyoheiHagimoto | 0:0e0631af0305 | 2557 | @param sdepth desired depth of the integral and the tilted integral images, CV_32S, CV_32F, or |
| RyoheiHagimoto | 0:0e0631af0305 | 2558 | CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 2559 | @param sqdepth desired depth of the integral image of squared pixel values, CV_32F or CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 2560 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2561 | CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum, |
| RyoheiHagimoto | 0:0e0631af0305 | 2562 | OutputArray sqsum, OutputArray tilted, |
| RyoheiHagimoto | 0:0e0631af0305 | 2563 | int sdepth = -1, int sqdepth = -1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2564 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2565 | //! @} imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 2566 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2567 | //! @addtogroup imgproc_motion |
| RyoheiHagimoto | 0:0e0631af0305 | 2568 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 2569 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2570 | /** @brief Adds an image to the accumulator. |
| RyoheiHagimoto | 0:0e0631af0305 | 2571 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2572 | The function adds src or some of its elements to dst : |
| RyoheiHagimoto | 0:0e0631af0305 | 2573 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2574 | \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2575 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2576 | The function supports multi-channel images. Each channel is processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2577 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2578 | The functions accumulate\* can be used, for example, to collect statistics of a scene background |
| RyoheiHagimoto | 0:0e0631af0305 | 2579 | viewed by a still camera and for the further foreground-background segmentation. |
| RyoheiHagimoto | 0:0e0631af0305 | 2580 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2581 | @param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2582 | @param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit |
| RyoheiHagimoto | 0:0e0631af0305 | 2583 | floating-point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2584 | @param mask Optional operation mask. |
| RyoheiHagimoto | 0:0e0631af0305 | 2585 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2586 | @sa accumulateSquare, accumulateProduct, accumulateWeighted |
| RyoheiHagimoto | 0:0e0631af0305 | 2587 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2588 | CV_EXPORTS_W void accumulate( InputArray src, InputOutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2589 | InputArray mask = noArray() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2590 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2591 | /** @brief Adds the square of a source image to the accumulator. |
| RyoheiHagimoto | 0:0e0631af0305 | 2592 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2593 | The function adds the input image src or its selected region, raised to a power of 2, to the |
| RyoheiHagimoto | 0:0e0631af0305 | 2594 | accumulator dst : |
| RyoheiHagimoto | 0:0e0631af0305 | 2595 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2596 | \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src} (x,y)^2 \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2597 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2598 | The function supports multi-channel images. Each channel is processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2599 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2600 | @param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2601 | @param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit |
| RyoheiHagimoto | 0:0e0631af0305 | 2602 | floating-point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2603 | @param mask Optional operation mask. |
| RyoheiHagimoto | 0:0e0631af0305 | 2604 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2605 | @sa accumulateSquare, accumulateProduct, accumulateWeighted |
| RyoheiHagimoto | 0:0e0631af0305 | 2606 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2607 | CV_EXPORTS_W void accumulateSquare( InputArray src, InputOutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2608 | InputArray mask = noArray() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2609 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2610 | /** @brief Adds the per-element product of two input images to the accumulator. |
| RyoheiHagimoto | 0:0e0631af0305 | 2611 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2612 | The function adds the product of two images or their selected regions to the accumulator dst : |
| RyoheiHagimoto | 0:0e0631af0305 | 2613 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2614 | \f[\texttt{dst} (x,y) \leftarrow \texttt{dst} (x,y) + \texttt{src1} (x,y) \cdot \texttt{src2} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2615 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2616 | The function supports multi-channel images. Each channel is processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2617 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2618 | @param src1 First input image, 1- or 3-channel, 8-bit or 32-bit floating point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2619 | @param src2 Second input image of the same type and the same size as src1 . |
| RyoheiHagimoto | 0:0e0631af0305 | 2620 | @param dst %Accumulator with the same number of channels as input images, 32-bit or 64-bit |
| RyoheiHagimoto | 0:0e0631af0305 | 2621 | floating-point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2622 | @param mask Optional operation mask. |
| RyoheiHagimoto | 0:0e0631af0305 | 2623 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2624 | @sa accumulate, accumulateSquare, accumulateWeighted |
| RyoheiHagimoto | 0:0e0631af0305 | 2625 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2626 | CV_EXPORTS_W void accumulateProduct( InputArray src1, InputArray src2, |
| RyoheiHagimoto | 0:0e0631af0305 | 2627 | InputOutputArray dst, InputArray mask=noArray() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2628 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2629 | /** @brief Updates a running average. |
| RyoheiHagimoto | 0:0e0631af0305 | 2630 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2631 | The function calculates the weighted sum of the input image src and the accumulator dst so that dst |
| RyoheiHagimoto | 0:0e0631af0305 | 2632 | becomes a running average of a frame sequence: |
| RyoheiHagimoto | 0:0e0631af0305 | 2633 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2634 | \f[\texttt{dst} (x,y) \leftarrow (1- \texttt{alpha} ) \cdot \texttt{dst} (x,y) + \texttt{alpha} \cdot \texttt{src} (x,y) \quad \text{if} \quad \texttt{mask} (x,y) \ne 0\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2635 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2636 | That is, alpha regulates the update speed (how fast the accumulator "forgets" about earlier images). |
| RyoheiHagimoto | 0:0e0631af0305 | 2637 | The function supports multi-channel images. Each channel is processed independently. |
| RyoheiHagimoto | 0:0e0631af0305 | 2638 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2639 | @param src Input image as 1- or 3-channel, 8-bit or 32-bit floating point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2640 | @param dst %Accumulator image with the same number of channels as input image, 32-bit or 64-bit |
| RyoheiHagimoto | 0:0e0631af0305 | 2641 | floating-point. |
| RyoheiHagimoto | 0:0e0631af0305 | 2642 | @param alpha Weight of the input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2643 | @param mask Optional operation mask. |
| RyoheiHagimoto | 0:0e0631af0305 | 2644 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2645 | @sa accumulate, accumulateSquare, accumulateProduct |
| RyoheiHagimoto | 0:0e0631af0305 | 2646 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2647 | CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2648 | double alpha, InputArray mask = noArray() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2649 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2650 | /** @brief The function is used to detect translational shifts that occur between two images. |
| RyoheiHagimoto | 0:0e0631af0305 | 2651 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2652 | The operation takes advantage of the Fourier shift theorem for detecting the translational shift in |
| RyoheiHagimoto | 0:0e0631af0305 | 2653 | the frequency domain. It can be used for fast image registration as well as motion estimation. For |
| RyoheiHagimoto | 0:0e0631af0305 | 2654 | more information please see <http://en.wikipedia.org/wiki/Phase_correlation> |
| RyoheiHagimoto | 0:0e0631af0305 | 2655 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2656 | Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed |
| RyoheiHagimoto | 0:0e0631af0305 | 2657 | with getOptimalDFTSize. |
| RyoheiHagimoto | 0:0e0631af0305 | 2658 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2659 | The function performs the following equations: |
| RyoheiHagimoto | 0:0e0631af0305 | 2660 | - First it applies a Hanning window (see <http://en.wikipedia.org/wiki/Hann_function>) to each |
| RyoheiHagimoto | 0:0e0631af0305 | 2661 | image to remove possible edge effects. This window is cached until the array size changes to speed |
| RyoheiHagimoto | 0:0e0631af0305 | 2662 | up processing time. |
| RyoheiHagimoto | 0:0e0631af0305 | 2663 | - Next it computes the forward DFTs of each source array: |
| RyoheiHagimoto | 0:0e0631af0305 | 2664 | \f[\mathbf{G}_a = \mathcal{F}\{src_1\}, \; \mathbf{G}_b = \mathcal{F}\{src_2\}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2665 | where \f$\mathcal{F}\f$ is the forward DFT. |
| RyoheiHagimoto | 0:0e0631af0305 | 2666 | - It then computes the cross-power spectrum of each frequency domain array: |
| RyoheiHagimoto | 0:0e0631af0305 | 2667 | \f[R = \frac{ \mathbf{G}_a \mathbf{G}_b^*}{|\mathbf{G}_a \mathbf{G}_b^*|}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2668 | - Next the cross-correlation is converted back into the time domain via the inverse DFT: |
| RyoheiHagimoto | 0:0e0631af0305 | 2669 | \f[r = \mathcal{F}^{-1}\{R\}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2670 | - Finally, it computes the peak location and computes a 5x5 weighted centroid around the peak to |
| RyoheiHagimoto | 0:0e0631af0305 | 2671 | achieve sub-pixel accuracy. |
| RyoheiHagimoto | 0:0e0631af0305 | 2672 | \f[(\Delta x, \Delta y) = \texttt{weightedCentroid} \{\arg \max_{(x, y)}\{r\}\}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2673 | - If non-zero, the response parameter is computed as the sum of the elements of r within the 5x5 |
| RyoheiHagimoto | 0:0e0631af0305 | 2674 | centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single |
| RyoheiHagimoto | 0:0e0631af0305 | 2675 | peak) and will be smaller when there are multiple peaks. |
| RyoheiHagimoto | 0:0e0631af0305 | 2676 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2677 | @param src1 Source floating point array (CV_32FC1 or CV_64FC1) |
| RyoheiHagimoto | 0:0e0631af0305 | 2678 | @param src2 Source floating point array (CV_32FC1 or CV_64FC1) |
| RyoheiHagimoto | 0:0e0631af0305 | 2679 | @param window Floating point array with windowing coefficients to reduce edge effects (optional). |
| RyoheiHagimoto | 0:0e0631af0305 | 2680 | @param response Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional). |
| RyoheiHagimoto | 0:0e0631af0305 | 2681 | @returns detected phase shift (sub-pixel) between the two arrays. |
| RyoheiHagimoto | 0:0e0631af0305 | 2682 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2683 | @sa dft, getOptimalDFTSize, idft, mulSpectrums createHanningWindow |
| RyoheiHagimoto | 0:0e0631af0305 | 2684 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2685 | CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2, |
| RyoheiHagimoto | 0:0e0631af0305 | 2686 | InputArray window = noArray(), CV_OUT double* response = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 2687 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2688 | /** @brief This function computes a Hanning window coefficients in two dimensions. |
| RyoheiHagimoto | 0:0e0631af0305 | 2689 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2690 | See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function) |
| RyoheiHagimoto | 0:0e0631af0305 | 2691 | for more information. |
| RyoheiHagimoto | 0:0e0631af0305 | 2692 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2693 | An example is shown below: |
| RyoheiHagimoto | 0:0e0631af0305 | 2694 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 2695 | // create hanning window of size 100x100 and type CV_32F |
| RyoheiHagimoto | 0:0e0631af0305 | 2696 | Mat hann; |
| RyoheiHagimoto | 0:0e0631af0305 | 2697 | createHanningWindow(hann, Size(100, 100), CV_32F); |
| RyoheiHagimoto | 0:0e0631af0305 | 2698 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 2699 | @param dst Destination array to place Hann coefficients in |
| RyoheiHagimoto | 0:0e0631af0305 | 2700 | @param winSize The window size specifications |
| RyoheiHagimoto | 0:0e0631af0305 | 2701 | @param type Created array type |
| RyoheiHagimoto | 0:0e0631af0305 | 2702 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2703 | CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type); |
| RyoheiHagimoto | 0:0e0631af0305 | 2704 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2705 | //! @} imgproc_motion |
| RyoheiHagimoto | 0:0e0631af0305 | 2706 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2707 | //! @addtogroup imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 2708 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 2709 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2710 | /** @brief Applies a fixed-level threshold to each array element. |
| RyoheiHagimoto | 0:0e0631af0305 | 2711 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2712 | The function applies fixed-level thresholding to a single-channel array. The function is typically |
| RyoheiHagimoto | 0:0e0631af0305 | 2713 | used to get a bi-level (binary) image out of a grayscale image ( cv::compare could be also used for |
| RyoheiHagimoto | 0:0e0631af0305 | 2714 | this purpose) or for removing a noise, that is, filtering out pixels with too small or too large |
| RyoheiHagimoto | 0:0e0631af0305 | 2715 | values. There are several types of thresholding supported by the function. They are determined by |
| RyoheiHagimoto | 0:0e0631af0305 | 2716 | type parameter. |
| RyoheiHagimoto | 0:0e0631af0305 | 2717 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2718 | Also, the special values cv::THRESH_OTSU or cv::THRESH_TRIANGLE may be combined with one of the |
| RyoheiHagimoto | 0:0e0631af0305 | 2719 | above values. In these cases, the function determines the optimal threshold value using the Otsu's |
| RyoheiHagimoto | 0:0e0631af0305 | 2720 | or Triangle algorithm and uses it instead of the specified thresh . The function returns the |
| RyoheiHagimoto | 0:0e0631af0305 | 2721 | computed threshold value. Currently, the Otsu's and Triangle methods are implemented only for 8-bit |
| RyoheiHagimoto | 0:0e0631af0305 | 2722 | images. |
| RyoheiHagimoto | 0:0e0631af0305 | 2723 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2724 | @param src input array (single-channel, 8-bit or 32-bit floating point). |
| RyoheiHagimoto | 0:0e0631af0305 | 2725 | @param dst output array of the same size and type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 2726 | @param thresh threshold value. |
| RyoheiHagimoto | 0:0e0631af0305 | 2727 | @param maxval maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding |
| RyoheiHagimoto | 0:0e0631af0305 | 2728 | types. |
| RyoheiHagimoto | 0:0e0631af0305 | 2729 | @param type thresholding type (see the cv::ThresholdTypes). |
| RyoheiHagimoto | 0:0e0631af0305 | 2730 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2731 | @sa adaptiveThreshold, findContours, compare, min, max |
| RyoheiHagimoto | 0:0e0631af0305 | 2732 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2733 | CV_EXPORTS_W double threshold( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2734 | double thresh, double maxval, int type ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2735 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2736 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2737 | /** @brief Applies an adaptive threshold to an array. |
| RyoheiHagimoto | 0:0e0631af0305 | 2738 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2739 | The function transforms a grayscale image to a binary image according to the formulae: |
| RyoheiHagimoto | 0:0e0631af0305 | 2740 | - **THRESH_BINARY** |
| RyoheiHagimoto | 0:0e0631af0305 | 2741 | \f[dst(x,y) = \fork{\texttt{maxValue}}{if \(src(x,y) > T(x,y)\)}{0}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2742 | - **THRESH_BINARY_INV** |
| RyoheiHagimoto | 0:0e0631af0305 | 2743 | \f[dst(x,y) = \fork{0}{if \(src(x,y) > T(x,y)\)}{\texttt{maxValue}}{otherwise}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2744 | where \f$T(x,y)\f$ is a threshold calculated individually for each pixel (see adaptiveMethod parameter). |
| RyoheiHagimoto | 0:0e0631af0305 | 2745 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2746 | The function can process the image in-place. |
| RyoheiHagimoto | 0:0e0631af0305 | 2747 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2748 | @param src Source 8-bit single-channel image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2749 | @param dst Destination image of the same size and the same type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 2750 | @param maxValue Non-zero value assigned to the pixels for which the condition is satisfied |
| RyoheiHagimoto | 0:0e0631af0305 | 2751 | @param adaptiveMethod Adaptive thresholding algorithm to use, see cv::AdaptiveThresholdTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 2752 | @param thresholdType Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV, |
| RyoheiHagimoto | 0:0e0631af0305 | 2753 | see cv::ThresholdTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 2754 | @param blockSize Size of a pixel neighborhood that is used to calculate a threshold value for the |
| RyoheiHagimoto | 0:0e0631af0305 | 2755 | pixel: 3, 5, 7, and so on. |
| RyoheiHagimoto | 0:0e0631af0305 | 2756 | @param C Constant subtracted from the mean or weighted mean (see the details below). Normally, it |
| RyoheiHagimoto | 0:0e0631af0305 | 2757 | is positive but may be zero or negative as well. |
| RyoheiHagimoto | 0:0e0631af0305 | 2758 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2759 | @sa threshold, blur, GaussianBlur |
| RyoheiHagimoto | 0:0e0631af0305 | 2760 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2761 | CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2762 | double maxValue, int adaptiveMethod, |
| RyoheiHagimoto | 0:0e0631af0305 | 2763 | int thresholdType, int blockSize, double C ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2764 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2765 | //! @} imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 2766 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2767 | //! @addtogroup imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 2768 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 2769 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2770 | /** @brief Blurs an image and downsamples it. |
| RyoheiHagimoto | 0:0e0631af0305 | 2771 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2772 | By default, size of the output image is computed as `Size((src.cols+1)/2, (src.rows+1)/2)`, but in |
| RyoheiHagimoto | 0:0e0631af0305 | 2773 | any case, the following conditions should be satisfied: |
| RyoheiHagimoto | 0:0e0631af0305 | 2774 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2775 | \f[\begin{array}{l} | \texttt{dstsize.width} *2-src.cols| \leq 2 \\ | \texttt{dstsize.height} *2-src.rows| \leq 2 \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2776 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2777 | The function performs the downsampling step of the Gaussian pyramid construction. First, it |
| RyoheiHagimoto | 0:0e0631af0305 | 2778 | convolves the source image with the kernel: |
| RyoheiHagimoto | 0:0e0631af0305 | 2779 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2780 | \f[\frac{1}{256} \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \\ 4 & 16 & 24 & 16 & 4 \\ 6 & 24 & 36 & 24 & 6 \\ 4 & 16 & 24 & 16 & 4 \\ 1 & 4 & 6 & 4 & 1 \end{bmatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2781 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2782 | Then, it downsamples the image by rejecting even rows and columns. |
| RyoheiHagimoto | 0:0e0631af0305 | 2783 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2784 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2785 | @param dst output image; it has the specified size and the same type as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 2786 | @param dstsize size of the output image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2787 | @param borderType Pixel extrapolation method, see cv::BorderTypes (BORDER_CONSTANT isn't supported) |
| RyoheiHagimoto | 0:0e0631af0305 | 2788 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2789 | CV_EXPORTS_W void pyrDown( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2790 | const Size& dstsize = Size(), int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2791 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2792 | /** @brief Upsamples an image and then blurs it. |
| RyoheiHagimoto | 0:0e0631af0305 | 2793 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2794 | By default, size of the output image is computed as `Size(src.cols\*2, (src.rows\*2)`, but in any |
| RyoheiHagimoto | 0:0e0631af0305 | 2795 | case, the following conditions should be satisfied: |
| RyoheiHagimoto | 0:0e0631af0305 | 2796 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2797 | \f[\begin{array}{l} | \texttt{dstsize.width} -src.cols*2| \leq ( \texttt{dstsize.width} \mod 2) \\ | \texttt{dstsize.height} -src.rows*2| \leq ( \texttt{dstsize.height} \mod 2) \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2798 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2799 | The function performs the upsampling step of the Gaussian pyramid construction, though it can |
| RyoheiHagimoto | 0:0e0631af0305 | 2800 | actually be used to construct the Laplacian pyramid. First, it upsamples the source image by |
| RyoheiHagimoto | 0:0e0631af0305 | 2801 | injecting even zero rows and columns and then convolves the result with the same kernel as in |
| RyoheiHagimoto | 0:0e0631af0305 | 2802 | pyrDown multiplied by 4. |
| RyoheiHagimoto | 0:0e0631af0305 | 2803 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2804 | @param src input image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2805 | @param dst output image. It has the specified size and the same type as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2806 | @param dstsize size of the output image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2807 | @param borderType Pixel extrapolation method, see cv::BorderTypes (only BORDER_DEFAULT is supported) |
| RyoheiHagimoto | 0:0e0631af0305 | 2808 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2809 | CV_EXPORTS_W void pyrUp( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2810 | const Size& dstsize = Size(), int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2811 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2812 | /** @brief Constructs the Gaussian pyramid for an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2813 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2814 | The function constructs a vector of images and builds the Gaussian pyramid by recursively applying |
| RyoheiHagimoto | 0:0e0631af0305 | 2815 | pyrDown to the previously built pyramid layers, starting from `dst[0]==src`. |
| RyoheiHagimoto | 0:0e0631af0305 | 2816 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2817 | @param src Source image. Check pyrDown for the list of supported types. |
| RyoheiHagimoto | 0:0e0631af0305 | 2818 | @param dst Destination vector of maxlevel+1 images of the same type as src. dst[0] will be the |
| RyoheiHagimoto | 0:0e0631af0305 | 2819 | same as src. dst[1] is the next pyramid layer, a smoothed and down-sized src, and so on. |
| RyoheiHagimoto | 0:0e0631af0305 | 2820 | @param maxlevel 0-based index of the last (the smallest) pyramid layer. It must be non-negative. |
| RyoheiHagimoto | 0:0e0631af0305 | 2821 | @param borderType Pixel extrapolation method, see cv::BorderTypes (BORDER_CONSTANT isn't supported) |
| RyoheiHagimoto | 0:0e0631af0305 | 2822 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2823 | CV_EXPORTS void buildPyramid( InputArray src, OutputArrayOfArrays dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2824 | int maxlevel, int borderType = BORDER_DEFAULT ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2825 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2826 | //! @} imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 2827 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2828 | //! @addtogroup imgproc_transform |
| RyoheiHagimoto | 0:0e0631af0305 | 2829 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 2830 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2831 | /** @brief Transforms an image to compensate for lens distortion. |
| RyoheiHagimoto | 0:0e0631af0305 | 2832 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2833 | The function transforms an image to compensate radial and tangential lens distortion. |
| RyoheiHagimoto | 0:0e0631af0305 | 2834 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2835 | The function is simply a combination of cv::initUndistortRectifyMap (with unity R ) and cv::remap |
| RyoheiHagimoto | 0:0e0631af0305 | 2836 | (with bilinear interpolation). See the former function for details of the transformation being |
| RyoheiHagimoto | 0:0e0631af0305 | 2837 | performed. |
| RyoheiHagimoto | 0:0e0631af0305 | 2838 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2839 | Those pixels in the destination image, for which there is no correspondent pixels in the source |
| RyoheiHagimoto | 0:0e0631af0305 | 2840 | image, are filled with zeros (black color). |
| RyoheiHagimoto | 0:0e0631af0305 | 2841 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2842 | A particular subset of the source image that will be visible in the corrected image can be regulated |
| RyoheiHagimoto | 0:0e0631af0305 | 2843 | by newCameraMatrix. You can use cv::getOptimalNewCameraMatrix to compute the appropriate |
| RyoheiHagimoto | 0:0e0631af0305 | 2844 | newCameraMatrix depending on your requirements. |
| RyoheiHagimoto | 0:0e0631af0305 | 2845 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2846 | The camera matrix and the distortion parameters can be determined using cv::calibrateCamera. If |
| RyoheiHagimoto | 0:0e0631af0305 | 2847 | the resolution of images is different from the resolution used at the calibration stage, \f$f_x, |
| RyoheiHagimoto | 0:0e0631af0305 | 2848 | f_y, c_x\f$ and \f$c_y\f$ need to be scaled accordingly, while the distortion coefficients remain |
| RyoheiHagimoto | 0:0e0631af0305 | 2849 | the same. |
| RyoheiHagimoto | 0:0e0631af0305 | 2850 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2851 | @param src Input (distorted) image. |
| RyoheiHagimoto | 0:0e0631af0305 | 2852 | @param dst Output (corrected) image that has the same size and type as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 2853 | @param cameraMatrix Input camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 2854 | @param distCoeffs Input vector of distortion coefficients |
| RyoheiHagimoto | 0:0e0631af0305 | 2855 | \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 2856 | of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. |
| RyoheiHagimoto | 0:0e0631af0305 | 2857 | @param newCameraMatrix Camera matrix of the distorted image. By default, it is the same as |
| RyoheiHagimoto | 0:0e0631af0305 | 2858 | cameraMatrix but you may additionally scale and shift the result by using a different matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 2859 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2860 | CV_EXPORTS_W void undistort( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 2861 | InputArray cameraMatrix, |
| RyoheiHagimoto | 0:0e0631af0305 | 2862 | InputArray distCoeffs, |
| RyoheiHagimoto | 0:0e0631af0305 | 2863 | InputArray newCameraMatrix = noArray() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2864 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2865 | /** @brief Computes the undistortion and rectification transformation map. |
| RyoheiHagimoto | 0:0e0631af0305 | 2866 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2867 | The function computes the joint undistortion and rectification transformation and represents the |
| RyoheiHagimoto | 0:0e0631af0305 | 2868 | result in the form of maps for remap. The undistorted image looks like original, as if it is |
| RyoheiHagimoto | 0:0e0631af0305 | 2869 | captured with a camera using the camera matrix =newCameraMatrix and zero distortion. In case of a |
| RyoheiHagimoto | 0:0e0631af0305 | 2870 | monocular camera, newCameraMatrix is usually equal to cameraMatrix, or it can be computed by |
| RyoheiHagimoto | 0:0e0631af0305 | 2871 | cv::getOptimalNewCameraMatrix for a better control over scaling. In case of a stereo camera, |
| RyoheiHagimoto | 0:0e0631af0305 | 2872 | newCameraMatrix is normally set to P1 or P2 computed by cv::stereoRectify . |
| RyoheiHagimoto | 0:0e0631af0305 | 2873 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2874 | Also, this new camera is oriented differently in the coordinate space, according to R. That, for |
| RyoheiHagimoto | 0:0e0631af0305 | 2875 | example, helps to align two heads of a stereo camera so that the epipolar lines on both images |
| RyoheiHagimoto | 0:0e0631af0305 | 2876 | become horizontal and have the same y- coordinate (in case of a horizontally aligned stereo camera). |
| RyoheiHagimoto | 0:0e0631af0305 | 2877 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2878 | The function actually builds the maps for the inverse mapping algorithm that is used by remap. That |
| RyoheiHagimoto | 0:0e0631af0305 | 2879 | is, for each pixel \f$(u, v)\f$ in the destination (corrected and rectified) image, the function |
| RyoheiHagimoto | 0:0e0631af0305 | 2880 | computes the corresponding coordinates in the source image (that is, in the original image from |
| RyoheiHagimoto | 0:0e0631af0305 | 2881 | camera). The following process is applied: |
| RyoheiHagimoto | 0:0e0631af0305 | 2882 | \f[ |
| RyoheiHagimoto | 0:0e0631af0305 | 2883 | \begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2884 | x \leftarrow (u - {c'}_x)/{f'}_x \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2885 | y \leftarrow (v - {c'}_y)/{f'}_y \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2886 | {[X\,Y\,W]} ^T \leftarrow R^{-1}*[x \, y \, 1]^T \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2887 | x' \leftarrow X/W \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2888 | y' \leftarrow Y/W \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2889 | r^2 \leftarrow x'^2 + y'^2 \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2890 | x'' \leftarrow x' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} |
| RyoheiHagimoto | 0:0e0631af0305 | 2891 | + 2p_1 x' y' + p_2(r^2 + 2 x'^2) + s_1 r^2 + s_2 r^4\\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2892 | y'' \leftarrow y' \frac{1 + k_1 r^2 + k_2 r^4 + k_3 r^6}{1 + k_4 r^2 + k_5 r^4 + k_6 r^6} |
| RyoheiHagimoto | 0:0e0631af0305 | 2893 | + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' + s_3 r^2 + s_4 r^4 \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2894 | s\vecthree{x'''}{y'''}{1} = |
| RyoheiHagimoto | 0:0e0631af0305 | 2895 | \vecthreethree{R_{33}(\tau_x, \tau_y)}{0}{-R_{13}((\tau_x, \tau_y)} |
| RyoheiHagimoto | 0:0e0631af0305 | 2896 | {0}{R_{33}(\tau_x, \tau_y)}{-R_{23}(\tau_x, \tau_y)} |
| RyoheiHagimoto | 0:0e0631af0305 | 2897 | {0}{0}{1} R(\tau_x, \tau_y) \vecthree{x''}{y''}{1}\\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2898 | map_x(u,v) \leftarrow x''' f_x + c_x \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2899 | map_y(u,v) \leftarrow y''' f_y + c_y |
| RyoheiHagimoto | 0:0e0631af0305 | 2900 | \end{array} |
| RyoheiHagimoto | 0:0e0631af0305 | 2901 | \f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2902 | where \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 2903 | are the distortion coefficients. |
| RyoheiHagimoto | 0:0e0631af0305 | 2904 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2905 | In case of a stereo camera, this function is called twice: once for each camera head, after |
| RyoheiHagimoto | 0:0e0631af0305 | 2906 | stereoRectify, which in its turn is called after cv::stereoCalibrate. But if the stereo camera |
| RyoheiHagimoto | 0:0e0631af0305 | 2907 | was not calibrated, it is still possible to compute the rectification transformations directly from |
| RyoheiHagimoto | 0:0e0631af0305 | 2908 | the fundamental matrix using cv::stereoRectifyUncalibrated. For each camera, the function computes |
| RyoheiHagimoto | 0:0e0631af0305 | 2909 | homography H as the rectification transformation in a pixel domain, not a rotation matrix R in 3D |
| RyoheiHagimoto | 0:0e0631af0305 | 2910 | space. R can be computed from H as |
| RyoheiHagimoto | 0:0e0631af0305 | 2911 | \f[\texttt{R} = \texttt{cameraMatrix} ^{-1} \cdot \texttt{H} \cdot \texttt{cameraMatrix}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2912 | where cameraMatrix can be chosen arbitrarily. |
| RyoheiHagimoto | 0:0e0631af0305 | 2913 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2914 | @param cameraMatrix Input camera matrix \f$A=\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 2915 | @param distCoeffs Input vector of distortion coefficients |
| RyoheiHagimoto | 0:0e0631af0305 | 2916 | \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 2917 | of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. |
| RyoheiHagimoto | 0:0e0631af0305 | 2918 | @param R Optional rectification transformation in the object space (3x3 matrix). R1 or R2 , |
| RyoheiHagimoto | 0:0e0631af0305 | 2919 | computed by stereoRectify can be passed here. If the matrix is empty, the identity transformation |
| RyoheiHagimoto | 0:0e0631af0305 | 2920 | is assumed. In cvInitUndistortMap R assumed to be an identity matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 2921 | @param newCameraMatrix New camera matrix \f$A'=\vecthreethree{f_x'}{0}{c_x'}{0}{f_y'}{c_y'}{0}{0}{1}\f$. |
| RyoheiHagimoto | 0:0e0631af0305 | 2922 | @param size Undistorted image size. |
| RyoheiHagimoto | 0:0e0631af0305 | 2923 | @param m1type Type of the first output map that can be CV_32FC1 or CV_16SC2, see cv::convertMaps |
| RyoheiHagimoto | 0:0e0631af0305 | 2924 | @param map1 The first output map. |
| RyoheiHagimoto | 0:0e0631af0305 | 2925 | @param map2 The second output map. |
| RyoheiHagimoto | 0:0e0631af0305 | 2926 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2927 | CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs, |
| RyoheiHagimoto | 0:0e0631af0305 | 2928 | InputArray R, InputArray newCameraMatrix, |
| RyoheiHagimoto | 0:0e0631af0305 | 2929 | Size size, int m1type, OutputArray map1, OutputArray map2 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2930 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2931 | //! initializes maps for cv::remap() for wide-angle |
| RyoheiHagimoto | 0:0e0631af0305 | 2932 | CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs, |
| RyoheiHagimoto | 0:0e0631af0305 | 2933 | Size imageSize, int destImageWidth, |
| RyoheiHagimoto | 0:0e0631af0305 | 2934 | int m1type, OutputArray map1, OutputArray map2, |
| RyoheiHagimoto | 0:0e0631af0305 | 2935 | int projType = PROJ_SPHERICAL_EQRECT, double alpha = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 2936 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2937 | /** @brief Returns the default new camera matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 2938 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2939 | The function returns the camera matrix that is either an exact copy of the input cameraMatrix (when |
| RyoheiHagimoto | 0:0e0631af0305 | 2940 | centerPrinicipalPoint=false ), or the modified one (when centerPrincipalPoint=true). |
| RyoheiHagimoto | 0:0e0631af0305 | 2941 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2942 | In the latter case, the new camera matrix will be: |
| RyoheiHagimoto | 0:0e0631af0305 | 2943 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2944 | \f[\begin{bmatrix} f_x && 0 && ( \texttt{imgSize.width} -1)*0.5 \\ 0 && f_y && ( \texttt{imgSize.height} -1)*0.5 \\ 0 && 0 && 1 \end{bmatrix} ,\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2945 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2946 | where \f$f_x\f$ and \f$f_y\f$ are \f$(0,0)\f$ and \f$(1,1)\f$ elements of cameraMatrix, respectively. |
| RyoheiHagimoto | 0:0e0631af0305 | 2947 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2948 | By default, the undistortion functions in OpenCV (see initUndistortRectifyMap, undistort) do not |
| RyoheiHagimoto | 0:0e0631af0305 | 2949 | move the principal point. However, when you work with stereo, it is important to move the principal |
| RyoheiHagimoto | 0:0e0631af0305 | 2950 | points in both views to the same y-coordinate (which is required by most of stereo correspondence |
| RyoheiHagimoto | 0:0e0631af0305 | 2951 | algorithms), and may be to the same x-coordinate too. So, you can form the new camera matrix for |
| RyoheiHagimoto | 0:0e0631af0305 | 2952 | each view where the principal points are located at the center. |
| RyoheiHagimoto | 0:0e0631af0305 | 2953 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2954 | @param cameraMatrix Input camera matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 2955 | @param imgsize Camera view image size in pixels. |
| RyoheiHagimoto | 0:0e0631af0305 | 2956 | @param centerPrincipalPoint Location of the principal point in the new camera matrix. The |
| RyoheiHagimoto | 0:0e0631af0305 | 2957 | parameter indicates whether this location should be at the image center or not. |
| RyoheiHagimoto | 0:0e0631af0305 | 2958 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 2959 | CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize = Size(), |
| RyoheiHagimoto | 0:0e0631af0305 | 2960 | bool centerPrincipalPoint = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 2961 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2962 | /** @brief Computes the ideal point coordinates from the observed point coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 2963 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2964 | The function is similar to cv::undistort and cv::initUndistortRectifyMap but it operates on a |
| RyoheiHagimoto | 0:0e0631af0305 | 2965 | sparse set of points instead of a raster image. Also the function performs a reverse transformation |
| RyoheiHagimoto | 0:0e0631af0305 | 2966 | to projectPoints. In case of a 3D object, it does not reconstruct its 3D coordinates, but for a |
| RyoheiHagimoto | 0:0e0631af0305 | 2967 | planar object, it does, up to a translation vector, if the proper R is specified. |
| RyoheiHagimoto | 0:0e0631af0305 | 2968 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2969 | For each observed point coordinate \f$(u, v)\f$ the function computes: |
| RyoheiHagimoto | 0:0e0631af0305 | 2970 | \f[ |
| RyoheiHagimoto | 0:0e0631af0305 | 2971 | \begin{array}{l} |
| RyoheiHagimoto | 0:0e0631af0305 | 2972 | x^{"} \leftarrow (u - c_x)/f_x \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2973 | y^{"} \leftarrow (v - c_y)/f_y \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2974 | (x',y') = undistort(x^{"},y^{"}, \texttt{distCoeffs}) \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2975 | {[X\,Y\,W]} ^T \leftarrow R*[x' \, y' \, 1]^T \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2976 | x \leftarrow X/W \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2977 | y \leftarrow Y/W \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2978 | \text{only performed if P is specified:} \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2979 | u' \leftarrow x {f'}_x + {c'}_x \\ |
| RyoheiHagimoto | 0:0e0631af0305 | 2980 | v' \leftarrow y {f'}_y + {c'}_y |
| RyoheiHagimoto | 0:0e0631af0305 | 2981 | \end{array} |
| RyoheiHagimoto | 0:0e0631af0305 | 2982 | \f] |
| RyoheiHagimoto | 0:0e0631af0305 | 2983 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2984 | where *undistort* is an approximate iterative algorithm that estimates the normalized original |
| RyoheiHagimoto | 0:0e0631af0305 | 2985 | point coordinates out of the normalized distorted point coordinates ("normalized" means that the |
| RyoheiHagimoto | 0:0e0631af0305 | 2986 | coordinates do not depend on the camera matrix). |
| RyoheiHagimoto | 0:0e0631af0305 | 2987 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2988 | The function can be used for both a stereo camera head or a monocular camera (when R is empty). |
| RyoheiHagimoto | 0:0e0631af0305 | 2989 | |
| RyoheiHagimoto | 0:0e0631af0305 | 2990 | @param src Observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). |
| RyoheiHagimoto | 0:0e0631af0305 | 2991 | @param dst Output ideal point coordinates after undistortion and reverse perspective |
| RyoheiHagimoto | 0:0e0631af0305 | 2992 | transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 2993 | @param cameraMatrix Camera matrix \f$\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 2994 | @param distCoeffs Input vector of distortion coefficients |
| RyoheiHagimoto | 0:0e0631af0305 | 2995 | \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6[, s_1, s_2, s_3, s_4[, \tau_x, \tau_y]]]])\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 2996 | of 4, 5, 8, 12 or 14 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. |
| RyoheiHagimoto | 0:0e0631af0305 | 2997 | @param R Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by |
| RyoheiHagimoto | 0:0e0631af0305 | 2998 | cv::stereoRectify can be passed here. If the matrix is empty, the identity transformation is used. |
| RyoheiHagimoto | 0:0e0631af0305 | 2999 | @param P New camera matrix (3x3) or new projection matrix (3x4) \f$\begin{bmatrix} {f'}_x & 0 & {c'}_x & t_x \\ 0 & {f'}_y & {c'}_y & t_y \\ 0 & 0 & 1 & t_z \end{bmatrix}\f$. P1 or P2 computed by |
| RyoheiHagimoto | 0:0e0631af0305 | 3000 | cv::stereoRectify can be passed here. If the matrix is empty, the identity new camera matrix is used. |
| RyoheiHagimoto | 0:0e0631af0305 | 3001 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3002 | CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 3003 | InputArray cameraMatrix, InputArray distCoeffs, |
| RyoheiHagimoto | 0:0e0631af0305 | 3004 | InputArray R = noArray(), InputArray P = noArray()); |
| RyoheiHagimoto | 0:0e0631af0305 | 3005 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3006 | //! @} imgproc_transform |
| RyoheiHagimoto | 0:0e0631af0305 | 3007 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3008 | //! @addtogroup imgproc_hist |
| RyoheiHagimoto | 0:0e0631af0305 | 3009 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 3010 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3011 | /** @example demhist.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3012 | An example for creating histograms of an image |
| RyoheiHagimoto | 0:0e0631af0305 | 3013 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3014 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3015 | /** @brief Calculates a histogram of a set of arrays. |
| RyoheiHagimoto | 0:0e0631af0305 | 3016 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3017 | The function cv::calcHist calculates the histogram of one or more arrays. The elements of a tuple used |
| RyoheiHagimoto | 0:0e0631af0305 | 3018 | to increment a histogram bin are taken from the corresponding input arrays at the same location. The |
| RyoheiHagimoto | 0:0e0631af0305 | 3019 | sample below shows how to compute a 2D Hue-Saturation histogram for a color image. : |
| RyoheiHagimoto | 0:0e0631af0305 | 3020 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 3021 | #include <opencv2/imgproc.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 3022 | #include <opencv2/highgui.hpp> |
| RyoheiHagimoto | 0:0e0631af0305 | 3023 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3024 | using namespace cv; |
| RyoheiHagimoto | 0:0e0631af0305 | 3025 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3026 | int main( int argc, char** argv ) |
| RyoheiHagimoto | 0:0e0631af0305 | 3027 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 3028 | Mat src, hsv; |
| RyoheiHagimoto | 0:0e0631af0305 | 3029 | if( argc != 2 || !(src=imread(argv[1], 1)).data ) |
| RyoheiHagimoto | 0:0e0631af0305 | 3030 | return -1; |
| RyoheiHagimoto | 0:0e0631af0305 | 3031 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3032 | cvtColor(src, hsv, COLOR_BGR2HSV); |
| RyoheiHagimoto | 0:0e0631af0305 | 3033 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3034 | // Quantize the hue to 30 levels |
| RyoheiHagimoto | 0:0e0631af0305 | 3035 | // and the saturation to 32 levels |
| RyoheiHagimoto | 0:0e0631af0305 | 3036 | int hbins = 30, sbins = 32; |
| RyoheiHagimoto | 0:0e0631af0305 | 3037 | int histSize[] = {hbins, sbins}; |
| RyoheiHagimoto | 0:0e0631af0305 | 3038 | // hue varies from 0 to 179, see cvtColor |
| RyoheiHagimoto | 0:0e0631af0305 | 3039 | float hranges[] = { 0, 180 }; |
| RyoheiHagimoto | 0:0e0631af0305 | 3040 | // saturation varies from 0 (black-gray-white) to |
| RyoheiHagimoto | 0:0e0631af0305 | 3041 | // 255 (pure spectrum color) |
| RyoheiHagimoto | 0:0e0631af0305 | 3042 | float sranges[] = { 0, 256 }; |
| RyoheiHagimoto | 0:0e0631af0305 | 3043 | const float* ranges[] = { hranges, sranges }; |
| RyoheiHagimoto | 0:0e0631af0305 | 3044 | MatND hist; |
| RyoheiHagimoto | 0:0e0631af0305 | 3045 | // we compute the histogram from the 0-th and 1-st channels |
| RyoheiHagimoto | 0:0e0631af0305 | 3046 | int channels[] = {0, 1}; |
| RyoheiHagimoto | 0:0e0631af0305 | 3047 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3048 | calcHist( &hsv, 1, channels, Mat(), // do not use mask |
| RyoheiHagimoto | 0:0e0631af0305 | 3049 | hist, 2, histSize, ranges, |
| RyoheiHagimoto | 0:0e0631af0305 | 3050 | true, // the histogram is uniform |
| RyoheiHagimoto | 0:0e0631af0305 | 3051 | false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3052 | double maxVal=0; |
| RyoheiHagimoto | 0:0e0631af0305 | 3053 | minMaxLoc(hist, 0, &maxVal, 0, 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 3054 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3055 | int scale = 10; |
| RyoheiHagimoto | 0:0e0631af0305 | 3056 | Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3); |
| RyoheiHagimoto | 0:0e0631af0305 | 3057 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3058 | for( int h = 0; h < hbins; h++ ) |
| RyoheiHagimoto | 0:0e0631af0305 | 3059 | for( int s = 0; s < sbins; s++ ) |
| RyoheiHagimoto | 0:0e0631af0305 | 3060 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 3061 | float binVal = hist.at<float>(h, s); |
| RyoheiHagimoto | 0:0e0631af0305 | 3062 | int intensity = cvRound(binVal*255/maxVal); |
| RyoheiHagimoto | 0:0e0631af0305 | 3063 | rectangle( histImg, Point(h*scale, s*scale), |
| RyoheiHagimoto | 0:0e0631af0305 | 3064 | Point( (h+1)*scale - 1, (s+1)*scale - 1), |
| RyoheiHagimoto | 0:0e0631af0305 | 3065 | Scalar::all(intensity), |
| RyoheiHagimoto | 0:0e0631af0305 | 3066 | CV_FILLED ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3067 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 3068 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3069 | namedWindow( "Source", 1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3070 | imshow( "Source", src ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3071 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3072 | namedWindow( "H-S Histogram", 1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3073 | imshow( "H-S Histogram", histImg ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3074 | waitKey(); |
| RyoheiHagimoto | 0:0e0631af0305 | 3075 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 3076 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 3077 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3078 | @param images Source arrays. They all should have the same depth, CV_8U, CV_16U or CV_32F , and the same |
| RyoheiHagimoto | 0:0e0631af0305 | 3079 | size. Each of them can have an arbitrary number of channels. |
| RyoheiHagimoto | 0:0e0631af0305 | 3080 | @param nimages Number of source images. |
| RyoheiHagimoto | 0:0e0631af0305 | 3081 | @param channels List of the dims channels used to compute the histogram. The first array channels |
| RyoheiHagimoto | 0:0e0631af0305 | 3082 | are numerated from 0 to images[0].channels()-1 , the second array channels are counted from |
| RyoheiHagimoto | 0:0e0631af0305 | 3083 | images[0].channels() to images[0].channels() + images[1].channels()-1, and so on. |
| RyoheiHagimoto | 0:0e0631af0305 | 3084 | @param mask Optional mask. If the matrix is not empty, it must be an 8-bit array of the same size |
| RyoheiHagimoto | 0:0e0631af0305 | 3085 | as images[i] . The non-zero mask elements mark the array elements counted in the histogram. |
| RyoheiHagimoto | 0:0e0631af0305 | 3086 | @param hist Output histogram, which is a dense or sparse dims -dimensional array. |
| RyoheiHagimoto | 0:0e0631af0305 | 3087 | @param dims Histogram dimensionality that must be positive and not greater than CV_MAX_DIMS |
| RyoheiHagimoto | 0:0e0631af0305 | 3088 | (equal to 32 in the current OpenCV version). |
| RyoheiHagimoto | 0:0e0631af0305 | 3089 | @param histSize Array of histogram sizes in each dimension. |
| RyoheiHagimoto | 0:0e0631af0305 | 3090 | @param ranges Array of the dims arrays of the histogram bin boundaries in each dimension. When the |
| RyoheiHagimoto | 0:0e0631af0305 | 3091 | histogram is uniform ( uniform =true), then for each dimension i it is enough to specify the lower |
| RyoheiHagimoto | 0:0e0631af0305 | 3092 | (inclusive) boundary \f$L_0\f$ of the 0-th histogram bin and the upper (exclusive) boundary |
| RyoheiHagimoto | 0:0e0631af0305 | 3093 | \f$U_{\texttt{histSize}[i]-1}\f$ for the last histogram bin histSize[i]-1 . That is, in case of a |
| RyoheiHagimoto | 0:0e0631af0305 | 3094 | uniform histogram each of ranges[i] is an array of 2 elements. When the histogram is not uniform ( |
| RyoheiHagimoto | 0:0e0631af0305 | 3095 | uniform=false ), then each of ranges[i] contains histSize[i]+1 elements: |
| RyoheiHagimoto | 0:0e0631af0305 | 3096 | \f$L_0, U_0=L_1, U_1=L_2, ..., U_{\texttt{histSize[i]}-2}=L_{\texttt{histSize[i]}-1}, U_{\texttt{histSize[i]}-1}\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 3097 | . The array elements, that are not between \f$L_0\f$ and \f$U_{\texttt{histSize[i]}-1}\f$ , are not |
| RyoheiHagimoto | 0:0e0631af0305 | 3098 | counted in the histogram. |
| RyoheiHagimoto | 0:0e0631af0305 | 3099 | @param uniform Flag indicating whether the histogram is uniform or not (see above). |
| RyoheiHagimoto | 0:0e0631af0305 | 3100 | @param accumulate Accumulation flag. If it is set, the histogram is not cleared in the beginning |
| RyoheiHagimoto | 0:0e0631af0305 | 3101 | when it is allocated. This feature enables you to compute a single histogram from several sets of |
| RyoheiHagimoto | 0:0e0631af0305 | 3102 | arrays, or to update the histogram in time. |
| RyoheiHagimoto | 0:0e0631af0305 | 3103 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3104 | CV_EXPORTS void calcHist( const Mat* images, int nimages, |
| RyoheiHagimoto | 0:0e0631af0305 | 3105 | const int* channels, InputArray mask, |
| RyoheiHagimoto | 0:0e0631af0305 | 3106 | OutputArray hist, int dims, const int* histSize, |
| RyoheiHagimoto | 0:0e0631af0305 | 3107 | const float** ranges, bool uniform = true, bool accumulate = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3108 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3109 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 3110 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3111 | this variant uses cv::SparseMat for output |
| RyoheiHagimoto | 0:0e0631af0305 | 3112 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3113 | CV_EXPORTS void calcHist( const Mat* images, int nimages, |
| RyoheiHagimoto | 0:0e0631af0305 | 3114 | const int* channels, InputArray mask, |
| RyoheiHagimoto | 0:0e0631af0305 | 3115 | SparseMat& hist, int dims, |
| RyoheiHagimoto | 0:0e0631af0305 | 3116 | const int* histSize, const float** ranges, |
| RyoheiHagimoto | 0:0e0631af0305 | 3117 | bool uniform = true, bool accumulate = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3118 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3119 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3120 | CV_EXPORTS_W void calcHist( InputArrayOfArrays images, |
| RyoheiHagimoto | 0:0e0631af0305 | 3121 | const std::vector<int>& channels, |
| RyoheiHagimoto | 0:0e0631af0305 | 3122 | InputArray mask, OutputArray hist, |
| RyoheiHagimoto | 0:0e0631af0305 | 3123 | const std::vector<int>& histSize, |
| RyoheiHagimoto | 0:0e0631af0305 | 3124 | const std::vector<float>& ranges, |
| RyoheiHagimoto | 0:0e0631af0305 | 3125 | bool accumulate = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3126 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3127 | /** @brief Calculates the back projection of a histogram. |
| RyoheiHagimoto | 0:0e0631af0305 | 3128 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3129 | The function cv::calcBackProject calculates the back project of the histogram. That is, similarly to |
| RyoheiHagimoto | 0:0e0631af0305 | 3130 | cv::calcHist , at each location (x, y) the function collects the values from the selected channels |
| RyoheiHagimoto | 0:0e0631af0305 | 3131 | in the input images and finds the corresponding histogram bin. But instead of incrementing it, the |
| RyoheiHagimoto | 0:0e0631af0305 | 3132 | function reads the bin value, scales it by scale , and stores in backProject(x,y) . In terms of |
| RyoheiHagimoto | 0:0e0631af0305 | 3133 | statistics, the function computes probability of each element value in respect with the empirical |
| RyoheiHagimoto | 0:0e0631af0305 | 3134 | probability distribution represented by the histogram. See how, for example, you can find and track |
| RyoheiHagimoto | 0:0e0631af0305 | 3135 | a bright-colored object in a scene: |
| RyoheiHagimoto | 0:0e0631af0305 | 3136 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3137 | - Before tracking, show the object to the camera so that it covers almost the whole frame. |
| RyoheiHagimoto | 0:0e0631af0305 | 3138 | Calculate a hue histogram. The histogram may have strong maximums, corresponding to the dominant |
| RyoheiHagimoto | 0:0e0631af0305 | 3139 | colors in the object. |
| RyoheiHagimoto | 0:0e0631af0305 | 3140 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3141 | - When tracking, calculate a back projection of a hue plane of each input video frame using that |
| RyoheiHagimoto | 0:0e0631af0305 | 3142 | pre-computed histogram. Threshold the back projection to suppress weak colors. It may also make |
| RyoheiHagimoto | 0:0e0631af0305 | 3143 | sense to suppress pixels with non-sufficient color saturation and too dark or too bright pixels. |
| RyoheiHagimoto | 0:0e0631af0305 | 3144 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3145 | - Find connected components in the resulting picture and choose, for example, the largest |
| RyoheiHagimoto | 0:0e0631af0305 | 3146 | component. |
| RyoheiHagimoto | 0:0e0631af0305 | 3147 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3148 | This is an approximate algorithm of the CamShift color object tracker. |
| RyoheiHagimoto | 0:0e0631af0305 | 3149 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3150 | @param images Source arrays. They all should have the same depth, CV_8U, CV_16U or CV_32F , and the same |
| RyoheiHagimoto | 0:0e0631af0305 | 3151 | size. Each of them can have an arbitrary number of channels. |
| RyoheiHagimoto | 0:0e0631af0305 | 3152 | @param nimages Number of source images. |
| RyoheiHagimoto | 0:0e0631af0305 | 3153 | @param channels The list of channels used to compute the back projection. The number of channels |
| RyoheiHagimoto | 0:0e0631af0305 | 3154 | must match the histogram dimensionality. The first array channels are numerated from 0 to |
| RyoheiHagimoto | 0:0e0631af0305 | 3155 | images[0].channels()-1 , the second array channels are counted from images[0].channels() to |
| RyoheiHagimoto | 0:0e0631af0305 | 3156 | images[0].channels() + images[1].channels()-1, and so on. |
| RyoheiHagimoto | 0:0e0631af0305 | 3157 | @param hist Input histogram that can be dense or sparse. |
| RyoheiHagimoto | 0:0e0631af0305 | 3158 | @param backProject Destination back projection array that is a single-channel array of the same |
| RyoheiHagimoto | 0:0e0631af0305 | 3159 | size and depth as images[0] . |
| RyoheiHagimoto | 0:0e0631af0305 | 3160 | @param ranges Array of arrays of the histogram bin boundaries in each dimension. See cv::calcHist . |
| RyoheiHagimoto | 0:0e0631af0305 | 3161 | @param scale Optional scale factor for the output back projection. |
| RyoheiHagimoto | 0:0e0631af0305 | 3162 | @param uniform Flag indicating whether the histogram is uniform or not (see above). |
| RyoheiHagimoto | 0:0e0631af0305 | 3163 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3164 | @sa cv::calcHist, cv::compareHist |
| RyoheiHagimoto | 0:0e0631af0305 | 3165 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3166 | CV_EXPORTS void calcBackProject( const Mat* images, int nimages, |
| RyoheiHagimoto | 0:0e0631af0305 | 3167 | const int* channels, InputArray hist, |
| RyoheiHagimoto | 0:0e0631af0305 | 3168 | OutputArray backProject, const float** ranges, |
| RyoheiHagimoto | 0:0e0631af0305 | 3169 | double scale = 1, bool uniform = true ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3170 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3171 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3172 | CV_EXPORTS void calcBackProject( const Mat* images, int nimages, |
| RyoheiHagimoto | 0:0e0631af0305 | 3173 | const int* channels, const SparseMat& hist, |
| RyoheiHagimoto | 0:0e0631af0305 | 3174 | OutputArray backProject, const float** ranges, |
| RyoheiHagimoto | 0:0e0631af0305 | 3175 | double scale = 1, bool uniform = true ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3176 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3177 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3178 | CV_EXPORTS_W void calcBackProject( InputArrayOfArrays images, const std::vector<int>& channels, |
| RyoheiHagimoto | 0:0e0631af0305 | 3179 | InputArray hist, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 3180 | const std::vector<float>& ranges, |
| RyoheiHagimoto | 0:0e0631af0305 | 3181 | double scale ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3182 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3183 | /** @brief Compares two histograms. |
| RyoheiHagimoto | 0:0e0631af0305 | 3184 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3185 | The function cv::compareHist compares two dense or two sparse histograms using the specified method. |
| RyoheiHagimoto | 0:0e0631af0305 | 3186 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3187 | The function returns \f$d(H_1, H_2)\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 3188 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3189 | While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable |
| RyoheiHagimoto | 0:0e0631af0305 | 3190 | for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling |
| RyoheiHagimoto | 0:0e0631af0305 | 3191 | problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms |
| RyoheiHagimoto | 0:0e0631af0305 | 3192 | or more general sparse configurations of weighted points, consider using the cv::EMD function. |
| RyoheiHagimoto | 0:0e0631af0305 | 3193 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3194 | @param H1 First compared histogram. |
| RyoheiHagimoto | 0:0e0631af0305 | 3195 | @param H2 Second compared histogram of the same size as H1 . |
| RyoheiHagimoto | 0:0e0631af0305 | 3196 | @param method Comparison method, see cv::HistCompMethods |
| RyoheiHagimoto | 0:0e0631af0305 | 3197 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3198 | CV_EXPORTS_W double compareHist( InputArray H1, InputArray H2, int method ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3199 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3200 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3201 | CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3202 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3203 | /** @brief Equalizes the histogram of a grayscale image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3204 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3205 | The function equalizes the histogram of the input image using the following algorithm: |
| RyoheiHagimoto | 0:0e0631af0305 | 3206 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3207 | - Calculate the histogram \f$H\f$ for src . |
| RyoheiHagimoto | 0:0e0631af0305 | 3208 | - Normalize the histogram so that the sum of histogram bins is 255. |
| RyoheiHagimoto | 0:0e0631af0305 | 3209 | - Compute the integral of the histogram: |
| RyoheiHagimoto | 0:0e0631af0305 | 3210 | \f[H'_i = \sum _{0 \le j < i} H(j)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3211 | - Transform the image using \f$H'\f$ as a look-up table: \f$\texttt{dst}(x,y) = H'(\texttt{src}(x,y))\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 3212 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3213 | The algorithm normalizes the brightness and increases the contrast of the image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3214 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3215 | @param src Source 8-bit single channel image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3216 | @param dst Destination image of the same size and type as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 3217 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3218 | CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3219 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3220 | /** @brief Computes the "minimal work" distance between two weighted point configurations. |
| RyoheiHagimoto | 0:0e0631af0305 | 3221 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3222 | The function computes the earth mover distance and/or a lower boundary of the distance between the |
| RyoheiHagimoto | 0:0e0631af0305 | 3223 | two weighted point configurations. One of the applications described in @cite RubnerSept98, |
| RyoheiHagimoto | 0:0e0631af0305 | 3224 | @cite Rubner2000 is multi-dimensional histogram comparison for image retrieval. EMD is a transportation |
| RyoheiHagimoto | 0:0e0631af0305 | 3225 | problem that is solved using some modification of a simplex algorithm, thus the complexity is |
| RyoheiHagimoto | 0:0e0631af0305 | 3226 | exponential in the worst case, though, on average it is much faster. In the case of a real metric |
| RyoheiHagimoto | 0:0e0631af0305 | 3227 | the lower boundary can be calculated even faster (using linear-time algorithm) and it can be used |
| RyoheiHagimoto | 0:0e0631af0305 | 3228 | to determine roughly whether the two signatures are far enough so that they cannot relate to the |
| RyoheiHagimoto | 0:0e0631af0305 | 3229 | same object. |
| RyoheiHagimoto | 0:0e0631af0305 | 3230 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3231 | @param signature1 First signature, a \f$\texttt{size1}\times \texttt{dims}+1\f$ floating-point matrix. |
| RyoheiHagimoto | 0:0e0631af0305 | 3232 | Each row stores the point weight followed by the point coordinates. The matrix is allowed to have |
| RyoheiHagimoto | 0:0e0631af0305 | 3233 | a single column (weights only) if the user-defined cost matrix is used. The weights must be |
| RyoheiHagimoto | 0:0e0631af0305 | 3234 | non-negative and have at least one non-zero value. |
| RyoheiHagimoto | 0:0e0631af0305 | 3235 | @param signature2 Second signature of the same format as signature1 , though the number of rows |
| RyoheiHagimoto | 0:0e0631af0305 | 3236 | may be different. The total weights may be different. In this case an extra "dummy" point is added |
| RyoheiHagimoto | 0:0e0631af0305 | 3237 | to either signature1 or signature2. The weights must be non-negative and have at least one non-zero |
| RyoheiHagimoto | 0:0e0631af0305 | 3238 | value. |
| RyoheiHagimoto | 0:0e0631af0305 | 3239 | @param distType Used metric. See cv::DistanceTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 3240 | @param cost User-defined \f$\texttt{size1}\times \texttt{size2}\f$ cost matrix. Also, if a cost matrix |
| RyoheiHagimoto | 0:0e0631af0305 | 3241 | is used, lower boundary lowerBound cannot be calculated because it needs a metric function. |
| RyoheiHagimoto | 0:0e0631af0305 | 3242 | @param lowerBound Optional input/output parameter: lower boundary of a distance between the two |
| RyoheiHagimoto | 0:0e0631af0305 | 3243 | signatures that is a distance between mass centers. The lower boundary may not be calculated if |
| RyoheiHagimoto | 0:0e0631af0305 | 3244 | the user-defined cost matrix is used, the total weights of point configurations are not equal, or |
| RyoheiHagimoto | 0:0e0631af0305 | 3245 | if the signatures consist of weights only (the signature matrices have a single column). You |
| RyoheiHagimoto | 0:0e0631af0305 | 3246 | **must** initialize \*lowerBound . If the calculated distance between mass centers is greater or |
| RyoheiHagimoto | 0:0e0631af0305 | 3247 | equal to \*lowerBound (it means that the signatures are far enough), the function does not |
| RyoheiHagimoto | 0:0e0631af0305 | 3248 | calculate EMD. In any case \*lowerBound is set to the calculated distance between mass centers on |
| RyoheiHagimoto | 0:0e0631af0305 | 3249 | return. Thus, if you want to calculate both distance between mass centers and EMD, \*lowerBound |
| RyoheiHagimoto | 0:0e0631af0305 | 3250 | should be set to 0. |
| RyoheiHagimoto | 0:0e0631af0305 | 3251 | @param flow Resultant \f$\texttt{size1} \times \texttt{size2}\f$ flow matrix: \f$\texttt{flow}_{i,j}\f$ is |
| RyoheiHagimoto | 0:0e0631af0305 | 3252 | a flow from \f$i\f$ -th point of signature1 to \f$j\f$ -th point of signature2 . |
| RyoheiHagimoto | 0:0e0631af0305 | 3253 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3254 | CV_EXPORTS float EMD( InputArray signature1, InputArray signature2, |
| RyoheiHagimoto | 0:0e0631af0305 | 3255 | int distType, InputArray cost=noArray(), |
| RyoheiHagimoto | 0:0e0631af0305 | 3256 | float* lowerBound = 0, OutputArray flow = noArray() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3257 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3258 | //! @} imgproc_hist |
| RyoheiHagimoto | 0:0e0631af0305 | 3259 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3260 | /** @example watershed.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3261 | An example using the watershed algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 3262 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3263 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3264 | /** @brief Performs a marker-based image segmentation using the watershed algorithm. |
| RyoheiHagimoto | 0:0e0631af0305 | 3265 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3266 | The function implements one of the variants of watershed, non-parametric marker-based segmentation |
| RyoheiHagimoto | 0:0e0631af0305 | 3267 | algorithm, described in @cite Meyer92 . |
| RyoheiHagimoto | 0:0e0631af0305 | 3268 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3269 | Before passing the image to the function, you have to roughly outline the desired regions in the |
| RyoheiHagimoto | 0:0e0631af0305 | 3270 | image markers with positive (\>0) indices. So, every region is represented as one or more connected |
| RyoheiHagimoto | 0:0e0631af0305 | 3271 | components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary |
| RyoheiHagimoto | 0:0e0631af0305 | 3272 | mask using findContours and drawContours (see the watershed.cpp demo). The markers are "seeds" of |
| RyoheiHagimoto | 0:0e0631af0305 | 3273 | the future image regions. All the other pixels in markers , whose relation to the outlined regions |
| RyoheiHagimoto | 0:0e0631af0305 | 3274 | is not known and should be defined by the algorithm, should be set to 0's. In the function output, |
| RyoheiHagimoto | 0:0e0631af0305 | 3275 | each pixel in markers is set to a value of the "seed" components or to -1 at boundaries between the |
| RyoheiHagimoto | 0:0e0631af0305 | 3276 | regions. |
| RyoheiHagimoto | 0:0e0631af0305 | 3277 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3278 | @note Any two neighbor connected components are not necessarily separated by a watershed boundary |
| RyoheiHagimoto | 0:0e0631af0305 | 3279 | (-1's pixels); for example, they can touch each other in the initial marker image passed to the |
| RyoheiHagimoto | 0:0e0631af0305 | 3280 | function. |
| RyoheiHagimoto | 0:0e0631af0305 | 3281 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3282 | @param image Input 8-bit 3-channel image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3283 | @param markers Input/output 32-bit single-channel image (map) of markers. It should have the same |
| RyoheiHagimoto | 0:0e0631af0305 | 3284 | size as image . |
| RyoheiHagimoto | 0:0e0631af0305 | 3285 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3286 | @sa findContours |
| RyoheiHagimoto | 0:0e0631af0305 | 3287 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3288 | @ingroup imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 3289 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3290 | CV_EXPORTS_W void watershed( InputArray image, InputOutputArray markers ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3291 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3292 | //! @addtogroup imgproc_filter |
| RyoheiHagimoto | 0:0e0631af0305 | 3293 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 3294 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3295 | /** @brief Performs initial step of meanshift segmentation of an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3296 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3297 | The function implements the filtering stage of meanshift segmentation, that is, the output of the |
| RyoheiHagimoto | 0:0e0631af0305 | 3298 | function is the filtered "posterized" image with color gradients and fine-grain texture flattened. |
| RyoheiHagimoto | 0:0e0631af0305 | 3299 | At every pixel (X,Y) of the input image (or down-sized input image, see below) the function executes |
| RyoheiHagimoto | 0:0e0631af0305 | 3300 | meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is |
| RyoheiHagimoto | 0:0e0631af0305 | 3301 | considered: |
| RyoheiHagimoto | 0:0e0631af0305 | 3302 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3303 | \f[(x,y): X- \texttt{sp} \le x \le X+ \texttt{sp} , Y- \texttt{sp} \le y \le Y+ \texttt{sp} , ||(R,G,B)-(r,g,b)|| \le \texttt{sr}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3304 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3305 | where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively |
| RyoheiHagimoto | 0:0e0631af0305 | 3306 | (though, the algorithm does not depend on the color space used, so any 3-component color space can |
| RyoheiHagimoto | 0:0e0631af0305 | 3307 | be used instead). Over the neighborhood the average spatial value (X',Y') and average color vector |
| RyoheiHagimoto | 0:0e0631af0305 | 3308 | (R',G',B') are found and they act as the neighborhood center on the next iteration: |
| RyoheiHagimoto | 0:0e0631af0305 | 3309 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3310 | \f[(X,Y)~(X',Y'), (R,G,B)~(R',G',B').\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3311 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3312 | After the iterations over, the color components of the initial pixel (that is, the pixel from where |
| RyoheiHagimoto | 0:0e0631af0305 | 3313 | the iterations started) are set to the final value (average color at the last iteration): |
| RyoheiHagimoto | 0:0e0631af0305 | 3314 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3315 | \f[I(X,Y) <- (R*,G*,B*)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3316 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3317 | When maxLevel \> 0, the gaussian pyramid of maxLevel+1 levels is built, and the above procedure is |
| RyoheiHagimoto | 0:0e0631af0305 | 3318 | run on the smallest layer first. After that, the results are propagated to the larger layer and the |
| RyoheiHagimoto | 0:0e0631af0305 | 3319 | iterations are run again only on those pixels where the layer colors differ by more than sr from the |
| RyoheiHagimoto | 0:0e0631af0305 | 3320 | lower-resolution layer of the pyramid. That makes boundaries of color regions sharper. Note that the |
| RyoheiHagimoto | 0:0e0631af0305 | 3321 | results will be actually different from the ones obtained by running the meanshift procedure on the |
| RyoheiHagimoto | 0:0e0631af0305 | 3322 | whole original image (i.e. when maxLevel==0). |
| RyoheiHagimoto | 0:0e0631af0305 | 3323 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3324 | @param src The source 8-bit, 3-channel image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3325 | @param dst The destination image of the same format and the same size as the source. |
| RyoheiHagimoto | 0:0e0631af0305 | 3326 | @param sp The spatial window radius. |
| RyoheiHagimoto | 0:0e0631af0305 | 3327 | @param sr The color window radius. |
| RyoheiHagimoto | 0:0e0631af0305 | 3328 | @param maxLevel Maximum level of the pyramid for the segmentation. |
| RyoheiHagimoto | 0:0e0631af0305 | 3329 | @param termcrit Termination criteria: when to stop meanshift iterations. |
| RyoheiHagimoto | 0:0e0631af0305 | 3330 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3331 | CV_EXPORTS_W void pyrMeanShiftFiltering( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 3332 | double sp, double sr, int maxLevel = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 3333 | TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3334 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3335 | //! @} |
| RyoheiHagimoto | 0:0e0631af0305 | 3336 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3337 | //! @addtogroup imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 3338 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 3339 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3340 | /** @example grabcut.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3341 | An example using the GrabCut algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 3342 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3343 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3344 | /** @brief Runs the GrabCut algorithm. |
| RyoheiHagimoto | 0:0e0631af0305 | 3345 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3346 | The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut). |
| RyoheiHagimoto | 0:0e0631af0305 | 3347 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3348 | @param img Input 8-bit 3-channel image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3349 | @param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when |
| RyoheiHagimoto | 0:0e0631af0305 | 3350 | mode is set to GC_INIT_WITH_RECT. Its elements may have one of the cv::GrabCutClasses. |
| RyoheiHagimoto | 0:0e0631af0305 | 3351 | @param rect ROI containing a segmented object. The pixels outside of the ROI are marked as |
| RyoheiHagimoto | 0:0e0631af0305 | 3352 | "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT . |
| RyoheiHagimoto | 0:0e0631af0305 | 3353 | @param bgdModel Temporary array for the background model. Do not modify it while you are |
| RyoheiHagimoto | 0:0e0631af0305 | 3354 | processing the same image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3355 | @param fgdModel Temporary arrays for the foreground model. Do not modify it while you are |
| RyoheiHagimoto | 0:0e0631af0305 | 3356 | processing the same image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3357 | @param iterCount Number of iterations the algorithm should make before returning the result. Note |
| RyoheiHagimoto | 0:0e0631af0305 | 3358 | that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or |
| RyoheiHagimoto | 0:0e0631af0305 | 3359 | mode==GC_EVAL . |
| RyoheiHagimoto | 0:0e0631af0305 | 3360 | @param mode Operation mode that could be one of the cv::GrabCutModes |
| RyoheiHagimoto | 0:0e0631af0305 | 3361 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3362 | CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect, |
| RyoheiHagimoto | 0:0e0631af0305 | 3363 | InputOutputArray bgdModel, InputOutputArray fgdModel, |
| RyoheiHagimoto | 0:0e0631af0305 | 3364 | int iterCount, int mode = GC_EVAL ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3365 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3366 | /** @example distrans.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3367 | An example on using the distance transform\ |
| RyoheiHagimoto | 0:0e0631af0305 | 3368 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3369 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3370 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3371 | /** @brief Calculates the distance to the closest zero pixel for each pixel of the source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3372 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3373 | The function cv::distanceTransform calculates the approximate or precise distance from every binary |
| RyoheiHagimoto | 0:0e0631af0305 | 3374 | image pixel to the nearest zero pixel. For zero image pixels, the distance will obviously be zero. |
| RyoheiHagimoto | 0:0e0631af0305 | 3375 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3376 | When maskSize == DIST_MASK_PRECISE and distanceType == DIST_L2 , the function runs the |
| RyoheiHagimoto | 0:0e0631af0305 | 3377 | algorithm described in @cite Felzenszwalb04 . This algorithm is parallelized with the TBB library. |
| RyoheiHagimoto | 0:0e0631af0305 | 3378 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3379 | In other cases, the algorithm @cite Borgefors86 is used. This means that for a pixel the function |
| RyoheiHagimoto | 0:0e0631af0305 | 3380 | finds the shortest path to the nearest zero pixel consisting of basic shifts: horizontal, vertical, |
| RyoheiHagimoto | 0:0e0631af0305 | 3381 | diagonal, or knight's move (the latest is available for a \f$5\times 5\f$ mask). The overall |
| RyoheiHagimoto | 0:0e0631af0305 | 3382 | distance is calculated as a sum of these basic distances. Since the distance function should be |
| RyoheiHagimoto | 0:0e0631af0305 | 3383 | symmetric, all of the horizontal and vertical shifts must have the same cost (denoted as a ), all |
| RyoheiHagimoto | 0:0e0631af0305 | 3384 | the diagonal shifts must have the same cost (denoted as `b`), and all knight's moves must have the |
| RyoheiHagimoto | 0:0e0631af0305 | 3385 | same cost (denoted as `c`). For the cv::DIST_C and cv::DIST_L1 types, the distance is calculated |
| RyoheiHagimoto | 0:0e0631af0305 | 3386 | precisely, whereas for cv::DIST_L2 (Euclidean distance) the distance can be calculated only with a |
| RyoheiHagimoto | 0:0e0631af0305 | 3387 | relative error (a \f$5\times 5\f$ mask gives more accurate results). For `a`,`b`, and `c`, OpenCV |
| RyoheiHagimoto | 0:0e0631af0305 | 3388 | uses the values suggested in the original paper: |
| RyoheiHagimoto | 0:0e0631af0305 | 3389 | - DIST_L1: `a = 1, b = 2` |
| RyoheiHagimoto | 0:0e0631af0305 | 3390 | - DIST_L2: |
| RyoheiHagimoto | 0:0e0631af0305 | 3391 | - `3 x 3`: `a=0.955, b=1.3693` |
| RyoheiHagimoto | 0:0e0631af0305 | 3392 | - `5 x 5`: `a=1, b=1.4, c=2.1969` |
| RyoheiHagimoto | 0:0e0631af0305 | 3393 | - DIST_C: `a = 1, b = 1` |
| RyoheiHagimoto | 0:0e0631af0305 | 3394 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3395 | Typically, for a fast, coarse distance estimation DIST_L2, a \f$3\times 3\f$ mask is used. For a |
| RyoheiHagimoto | 0:0e0631af0305 | 3396 | more accurate distance estimation DIST_L2, a \f$5\times 5\f$ mask or the precise algorithm is used. |
| RyoheiHagimoto | 0:0e0631af0305 | 3397 | Note that both the precise and the approximate algorithms are linear on the number of pixels. |
| RyoheiHagimoto | 0:0e0631af0305 | 3398 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3399 | This variant of the function does not only compute the minimum distance for each pixel \f$(x, y)\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 3400 | but also identifies the nearest connected component consisting of zero pixels |
| RyoheiHagimoto | 0:0e0631af0305 | 3401 | (labelType==DIST_LABEL_CCOMP) or the nearest zero pixel (labelType==DIST_LABEL_PIXEL). Index of the |
| RyoheiHagimoto | 0:0e0631af0305 | 3402 | component/pixel is stored in `labels(x, y)`. When labelType==DIST_LABEL_CCOMP, the function |
| RyoheiHagimoto | 0:0e0631af0305 | 3403 | automatically finds connected components of zero pixels in the input image and marks them with |
| RyoheiHagimoto | 0:0e0631af0305 | 3404 | distinct labels. When labelType==DIST_LABEL_CCOMP, the function scans through the input image and |
| RyoheiHagimoto | 0:0e0631af0305 | 3405 | marks all the zero pixels with distinct labels. |
| RyoheiHagimoto | 0:0e0631af0305 | 3406 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3407 | In this mode, the complexity is still linear. That is, the function provides a very fast way to |
| RyoheiHagimoto | 0:0e0631af0305 | 3408 | compute the Voronoi diagram for a binary image. Currently, the second variant can use only the |
| RyoheiHagimoto | 0:0e0631af0305 | 3409 | approximate distance transform algorithm, i.e. maskSize=DIST_MASK_PRECISE is not supported |
| RyoheiHagimoto | 0:0e0631af0305 | 3410 | yet. |
| RyoheiHagimoto | 0:0e0631af0305 | 3411 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3412 | @param src 8-bit, single-channel (binary) source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3413 | @param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point, |
| RyoheiHagimoto | 0:0e0631af0305 | 3414 | single-channel image of the same size as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 3415 | @param labels Output 2D array of labels (the discrete Voronoi diagram). It has the type |
| RyoheiHagimoto | 0:0e0631af0305 | 3416 | CV_32SC1 and the same size as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 3417 | @param distanceType Type of distance, see cv::DistanceTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 3418 | @param maskSize Size of the distance transform mask, see cv::DistanceTransformMasks. |
| RyoheiHagimoto | 0:0e0631af0305 | 3419 | DIST_MASK_PRECISE is not supported by this variant. In case of the DIST_L1 or DIST_C distance type, |
| RyoheiHagimoto | 0:0e0631af0305 | 3420 | the parameter is forced to 3 because a \f$3\times 3\f$ mask gives the same result as \f$5\times |
| RyoheiHagimoto | 0:0e0631af0305 | 3421 | 5\f$ or any larger aperture. |
| RyoheiHagimoto | 0:0e0631af0305 | 3422 | @param labelType Type of the label array to build, see cv::DistanceTransformLabelTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 3423 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3424 | CV_EXPORTS_AS(distanceTransformWithLabels) void distanceTransform( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 3425 | OutputArray labels, int distanceType, int maskSize, |
| RyoheiHagimoto | 0:0e0631af0305 | 3426 | int labelType = DIST_LABEL_CCOMP ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3427 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3428 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 3429 | @param src 8-bit, single-channel (binary) source image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3430 | @param dst Output image with calculated distances. It is a 8-bit or 32-bit floating-point, |
| RyoheiHagimoto | 0:0e0631af0305 | 3431 | single-channel image of the same size as src . |
| RyoheiHagimoto | 0:0e0631af0305 | 3432 | @param distanceType Type of distance, see cv::DistanceTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 3433 | @param maskSize Size of the distance transform mask, see cv::DistanceTransformMasks. In case of the |
| RyoheiHagimoto | 0:0e0631af0305 | 3434 | DIST_L1 or DIST_C distance type, the parameter is forced to 3 because a \f$3\times 3\f$ mask gives |
| RyoheiHagimoto | 0:0e0631af0305 | 3435 | the same result as \f$5\times 5\f$ or any larger aperture. |
| RyoheiHagimoto | 0:0e0631af0305 | 3436 | @param dstType Type of output image. It can be CV_8U or CV_32F. Type CV_8U can be used only for |
| RyoheiHagimoto | 0:0e0631af0305 | 3437 | the first variant of the function and distanceType == DIST_L1. |
| RyoheiHagimoto | 0:0e0631af0305 | 3438 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3439 | CV_EXPORTS_W void distanceTransform( InputArray src, OutputArray dst, |
| RyoheiHagimoto | 0:0e0631af0305 | 3440 | int distanceType, int maskSize, int dstType=CV_32F); |
| RyoheiHagimoto | 0:0e0631af0305 | 3441 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3442 | /** @example ffilldemo.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3443 | An example using the FloodFill technique |
| RyoheiHagimoto | 0:0e0631af0305 | 3444 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3445 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3446 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 3447 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3448 | variant without `mask` parameter |
| RyoheiHagimoto | 0:0e0631af0305 | 3449 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3450 | CV_EXPORTS int floodFill( InputOutputArray image, |
| RyoheiHagimoto | 0:0e0631af0305 | 3451 | Point seedPoint, Scalar newVal, CV_OUT Rect* rect = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 3452 | Scalar loDiff = Scalar(), Scalar upDiff = Scalar(), |
| RyoheiHagimoto | 0:0e0631af0305 | 3453 | int flags = 4 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3454 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3455 | /** @brief Fills a connected component with the given color. |
| RyoheiHagimoto | 0:0e0631af0305 | 3456 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3457 | The function cv::floodFill fills a connected component starting from the seed point with the specified |
| RyoheiHagimoto | 0:0e0631af0305 | 3458 | color. The connectivity is determined by the color/brightness closeness of the neighbor pixels. The |
| RyoheiHagimoto | 0:0e0631af0305 | 3459 | pixel at \f$(x,y)\f$ is considered to belong to the repainted domain if: |
| RyoheiHagimoto | 0:0e0631af0305 | 3460 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3461 | - in case of a grayscale image and floating range |
| RyoheiHagimoto | 0:0e0631af0305 | 3462 | \f[\texttt{src} (x',y')- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} (x',y')+ \texttt{upDiff}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3463 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3464 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3465 | - in case of a grayscale image and fixed range |
| RyoheiHagimoto | 0:0e0631af0305 | 3466 | \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)- \texttt{loDiff} \leq \texttt{src} (x,y) \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)+ \texttt{upDiff}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3467 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3468 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3469 | - in case of a color image and floating range |
| RyoheiHagimoto | 0:0e0631af0305 | 3470 | \f[\texttt{src} (x',y')_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} (x',y')_r+ \texttt{upDiff} _r,\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3471 | \f[\texttt{src} (x',y')_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} (x',y')_g+ \texttt{upDiff} _g\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3472 | and |
| RyoheiHagimoto | 0:0e0631af0305 | 3473 | \f[\texttt{src} (x',y')_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} (x',y')_b+ \texttt{upDiff} _b\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3474 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3475 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3476 | - in case of a color image and fixed range |
| RyoheiHagimoto | 0:0e0631af0305 | 3477 | \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r- \texttt{loDiff} _r \leq \texttt{src} (x,y)_r \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_r+ \texttt{upDiff} _r,\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3478 | \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g- \texttt{loDiff} _g \leq \texttt{src} (x,y)_g \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_g+ \texttt{upDiff} _g\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3479 | and |
| RyoheiHagimoto | 0:0e0631af0305 | 3480 | \f[\texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b- \texttt{loDiff} _b \leq \texttt{src} (x,y)_b \leq \texttt{src} ( \texttt{seedPoint} .x, \texttt{seedPoint} .y)_b+ \texttt{upDiff} _b\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3481 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3482 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3483 | where \f$src(x',y')\f$ is the value of one of pixel neighbors that is already known to belong to the |
| RyoheiHagimoto | 0:0e0631af0305 | 3484 | component. That is, to be added to the connected component, a color/brightness of the pixel should |
| RyoheiHagimoto | 0:0e0631af0305 | 3485 | be close enough to: |
| RyoheiHagimoto | 0:0e0631af0305 | 3486 | - Color/brightness of one of its neighbors that already belong to the connected component in case |
| RyoheiHagimoto | 0:0e0631af0305 | 3487 | of a floating range. |
| RyoheiHagimoto | 0:0e0631af0305 | 3488 | - Color/brightness of the seed point in case of a fixed range. |
| RyoheiHagimoto | 0:0e0631af0305 | 3489 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3490 | Use these functions to either mark a connected component with the specified color in-place, or build |
| RyoheiHagimoto | 0:0e0631af0305 | 3491 | a mask and then extract the contour, or copy the region to another image, and so on. |
| RyoheiHagimoto | 0:0e0631af0305 | 3492 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3493 | @param image Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the |
| RyoheiHagimoto | 0:0e0631af0305 | 3494 | function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See |
| RyoheiHagimoto | 0:0e0631af0305 | 3495 | the details below. |
| RyoheiHagimoto | 0:0e0631af0305 | 3496 | @param mask Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels |
| RyoheiHagimoto | 0:0e0631af0305 | 3497 | taller than image. Since this is both an input and output parameter, you must take responsibility |
| RyoheiHagimoto | 0:0e0631af0305 | 3498 | of initializing it. Flood-filling cannot go across non-zero pixels in the input mask. For example, |
| RyoheiHagimoto | 0:0e0631af0305 | 3499 | an edge detector output can be used as a mask to stop filling at edges. On output, pixels in the |
| RyoheiHagimoto | 0:0e0631af0305 | 3500 | mask corresponding to filled pixels in the image are set to 1 or to the a value specified in flags |
| RyoheiHagimoto | 0:0e0631af0305 | 3501 | as described below. It is therefore possible to use the same mask in multiple calls to the function |
| RyoheiHagimoto | 0:0e0631af0305 | 3502 | to make sure the filled areas do not overlap. |
| RyoheiHagimoto | 0:0e0631af0305 | 3503 | @param seedPoint Starting point. |
| RyoheiHagimoto | 0:0e0631af0305 | 3504 | @param newVal New value of the repainted domain pixels. |
| RyoheiHagimoto | 0:0e0631af0305 | 3505 | @param loDiff Maximal lower brightness/color difference between the currently observed pixel and |
| RyoheiHagimoto | 0:0e0631af0305 | 3506 | one of its neighbors belonging to the component, or a seed pixel being added to the component. |
| RyoheiHagimoto | 0:0e0631af0305 | 3507 | @param upDiff Maximal upper brightness/color difference between the currently observed pixel and |
| RyoheiHagimoto | 0:0e0631af0305 | 3508 | one of its neighbors belonging to the component, or a seed pixel being added to the component. |
| RyoheiHagimoto | 0:0e0631af0305 | 3509 | @param rect Optional output parameter set by the function to the minimum bounding rectangle of the |
| RyoheiHagimoto | 0:0e0631af0305 | 3510 | repainted domain. |
| RyoheiHagimoto | 0:0e0631af0305 | 3511 | @param flags Operation flags. The first 8 bits contain a connectivity value. The default value of |
| RyoheiHagimoto | 0:0e0631af0305 | 3512 | 4 means that only the four nearest neighbor pixels (those that share an edge) are considered. A |
| RyoheiHagimoto | 0:0e0631af0305 | 3513 | connectivity value of 8 means that the eight nearest neighbor pixels (those that share a corner) |
| RyoheiHagimoto | 0:0e0631af0305 | 3514 | will be considered. The next 8 bits (8-16) contain a value between 1 and 255 with which to fill |
| RyoheiHagimoto | 0:0e0631af0305 | 3515 | the mask (the default value is 1). For example, 4 | ( 255 \<\< 8 ) will consider 4 nearest |
| RyoheiHagimoto | 0:0e0631af0305 | 3516 | neighbours and fill the mask with a value of 255. The following additional options occupy higher |
| RyoheiHagimoto | 0:0e0631af0305 | 3517 | bits and therefore may be further combined with the connectivity and mask fill values using |
| RyoheiHagimoto | 0:0e0631af0305 | 3518 | bit-wise or (|), see cv::FloodFillFlags. |
| RyoheiHagimoto | 0:0e0631af0305 | 3519 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3520 | @note Since the mask is larger than the filled image, a pixel \f$(x, y)\f$ in image corresponds to the |
| RyoheiHagimoto | 0:0e0631af0305 | 3521 | pixel \f$(x+1, y+1)\f$ in the mask . |
| RyoheiHagimoto | 0:0e0631af0305 | 3522 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3523 | @sa findContours |
| RyoheiHagimoto | 0:0e0631af0305 | 3524 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3525 | CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask, |
| RyoheiHagimoto | 0:0e0631af0305 | 3526 | Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0, |
| RyoheiHagimoto | 0:0e0631af0305 | 3527 | Scalar loDiff = Scalar(), Scalar upDiff = Scalar(), |
| RyoheiHagimoto | 0:0e0631af0305 | 3528 | int flags = 4 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3529 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3530 | /** @brief Converts an image from one color space to another. |
| RyoheiHagimoto | 0:0e0631af0305 | 3531 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3532 | The function converts an input image from one color space to another. In case of a transformation |
| RyoheiHagimoto | 0:0e0631af0305 | 3533 | to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note |
| RyoheiHagimoto | 0:0e0631af0305 | 3534 | that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the |
| RyoheiHagimoto | 0:0e0631af0305 | 3535 | bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue |
| RyoheiHagimoto | 0:0e0631af0305 | 3536 | component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and |
| RyoheiHagimoto | 0:0e0631af0305 | 3537 | sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on. |
| RyoheiHagimoto | 0:0e0631af0305 | 3538 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3539 | The conventional ranges for R, G, and B channel values are: |
| RyoheiHagimoto | 0:0e0631af0305 | 3540 | - 0 to 255 for CV_8U images |
| RyoheiHagimoto | 0:0e0631af0305 | 3541 | - 0 to 65535 for CV_16U images |
| RyoheiHagimoto | 0:0e0631af0305 | 3542 | - 0 to 1 for CV_32F images |
| RyoheiHagimoto | 0:0e0631af0305 | 3543 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3544 | In case of linear transformations, the range does not matter. But in case of a non-linear |
| RyoheiHagimoto | 0:0e0631af0305 | 3545 | transformation, an input RGB image should be normalized to the proper value range to get the correct |
| RyoheiHagimoto | 0:0e0631af0305 | 3546 | results, for example, for RGB \f$\rightarrow\f$ L\*u\*v\* transformation. For example, if you have a |
| RyoheiHagimoto | 0:0e0631af0305 | 3547 | 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will |
| RyoheiHagimoto | 0:0e0631af0305 | 3548 | have the 0..255 value range instead of 0..1 assumed by the function. So, before calling cvtColor , |
| RyoheiHagimoto | 0:0e0631af0305 | 3549 | you need first to scale the image down: |
| RyoheiHagimoto | 0:0e0631af0305 | 3550 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 3551 | img *= 1./255; |
| RyoheiHagimoto | 0:0e0631af0305 | 3552 | cvtColor(img, img, COLOR_BGR2Luv); |
| RyoheiHagimoto | 0:0e0631af0305 | 3553 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 3554 | If you use cvtColor with 8-bit images, the conversion will have some information lost. For many |
| RyoheiHagimoto | 0:0e0631af0305 | 3555 | applications, this will not be noticeable but it is recommended to use 32-bit images in applications |
| RyoheiHagimoto | 0:0e0631af0305 | 3556 | that need the full range of colors or that convert an image before an operation and then convert |
| RyoheiHagimoto | 0:0e0631af0305 | 3557 | back. |
| RyoheiHagimoto | 0:0e0631af0305 | 3558 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3559 | If conversion adds the alpha channel, its value will set to the maximum of corresponding channel |
| RyoheiHagimoto | 0:0e0631af0305 | 3560 | range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F. |
| RyoheiHagimoto | 0:0e0631af0305 | 3561 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3562 | @param src input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision |
| RyoheiHagimoto | 0:0e0631af0305 | 3563 | floating-point. |
| RyoheiHagimoto | 0:0e0631af0305 | 3564 | @param dst output image of the same size and depth as src. |
| RyoheiHagimoto | 0:0e0631af0305 | 3565 | @param code color space conversion code (see cv::ColorConversionCodes). |
| RyoheiHagimoto | 0:0e0631af0305 | 3566 | @param dstCn number of channels in the destination image; if the parameter is 0, the number of the |
| RyoheiHagimoto | 0:0e0631af0305 | 3567 | channels is derived automatically from src and code. |
| RyoheiHagimoto | 0:0e0631af0305 | 3568 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3569 | @see @ref imgproc_color_conversions |
| RyoheiHagimoto | 0:0e0631af0305 | 3570 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3571 | CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn = 0 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3572 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3573 | //! @} imgproc_misc |
| RyoheiHagimoto | 0:0e0631af0305 | 3574 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3575 | // main function for all demosaicing procceses |
| RyoheiHagimoto | 0:0e0631af0305 | 3576 | CV_EXPORTS_W void demosaicing(InputArray _src, OutputArray _dst, int code, int dcn = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 3577 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3578 | //! @addtogroup imgproc_shape |
| RyoheiHagimoto | 0:0e0631af0305 | 3579 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 3580 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3581 | /** @brief Calculates all of the moments up to the third order of a polygon or rasterized shape. |
| RyoheiHagimoto | 0:0e0631af0305 | 3582 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3583 | The function computes moments, up to the 3rd order, of a vector shape or a rasterized shape. The |
| RyoheiHagimoto | 0:0e0631af0305 | 3584 | results are returned in the structure cv::Moments. |
| RyoheiHagimoto | 0:0e0631af0305 | 3585 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3586 | @param array Raster image (single-channel, 8-bit or floating-point 2D array) or an array ( |
| RyoheiHagimoto | 0:0e0631af0305 | 3587 | \f$1 \times N\f$ or \f$N \times 1\f$ ) of 2D points (Point or Point2f ). |
| RyoheiHagimoto | 0:0e0631af0305 | 3588 | @param binaryImage If it is true, all non-zero image pixels are treated as 1's. The parameter is |
| RyoheiHagimoto | 0:0e0631af0305 | 3589 | used for images only. |
| RyoheiHagimoto | 0:0e0631af0305 | 3590 | @returns moments. |
| RyoheiHagimoto | 0:0e0631af0305 | 3591 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3592 | @note Only applicable to contour moments calculations from Python bindings: Note that the numpy |
| RyoheiHagimoto | 0:0e0631af0305 | 3593 | type for the input array should be either np.int32 or np.float32. |
| RyoheiHagimoto | 0:0e0631af0305 | 3594 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3595 | @sa contourArea, arcLength |
| RyoheiHagimoto | 0:0e0631af0305 | 3596 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3597 | CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3598 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3599 | /** @brief Calculates seven Hu invariants. |
| RyoheiHagimoto | 0:0e0631af0305 | 3600 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3601 | The function calculates seven Hu invariants (introduced in @cite Hu62; see also |
| RyoheiHagimoto | 0:0e0631af0305 | 3602 | <http://en.wikipedia.org/wiki/Image_moment>) defined as: |
| RyoheiHagimoto | 0:0e0631af0305 | 3603 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3604 | \f[\begin{array}{l} hu[0]= \eta _{20}+ \eta _{02} \\ hu[1]=( \eta _{20}- \eta _{02})^{2}+4 \eta _{11}^{2} \\ hu[2]=( \eta _{30}-3 \eta _{12})^{2}+ (3 \eta _{21}- \eta _{03})^{2} \\ hu[3]=( \eta _{30}+ \eta _{12})^{2}+ ( \eta _{21}+ \eta _{03})^{2} \\ hu[4]=( \eta _{30}-3 \eta _{12})( \eta _{30}+ \eta _{12})[( \eta _{30}+ \eta _{12})^{2}-3( \eta _{21}+ \eta _{03})^{2}]+(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ hu[5]=( \eta _{20}- \eta _{02})[( \eta _{30}+ \eta _{12})^{2}- ( \eta _{21}+ \eta _{03})^{2}]+4 \eta _{11}( \eta _{30}+ \eta _{12})( \eta _{21}+ \eta _{03}) \\ hu[6]=(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}]-( \eta _{30}-3 \eta _{12})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3605 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3606 | where \f$\eta_{ji}\f$ stands for \f$\texttt{Moments::nu}_{ji}\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 3607 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3608 | These values are proved to be invariants to the image scale, rotation, and reflection except the |
| RyoheiHagimoto | 0:0e0631af0305 | 3609 | seventh one, whose sign is changed by reflection. This invariance is proved with the assumption of |
| RyoheiHagimoto | 0:0e0631af0305 | 3610 | infinite image resolution. In case of raster images, the computed Hu invariants for the original and |
| RyoheiHagimoto | 0:0e0631af0305 | 3611 | transformed images are a bit different. |
| RyoheiHagimoto | 0:0e0631af0305 | 3612 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3613 | @param moments Input moments computed with moments . |
| RyoheiHagimoto | 0:0e0631af0305 | 3614 | @param hu Output Hu invariants. |
| RyoheiHagimoto | 0:0e0631af0305 | 3615 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3616 | @sa matchShapes |
| RyoheiHagimoto | 0:0e0631af0305 | 3617 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3618 | CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3619 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3620 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3621 | CV_EXPORTS_W void HuMoments( const Moments& m, OutputArray hu ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3622 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3623 | //! @} imgproc_shape |
| RyoheiHagimoto | 0:0e0631af0305 | 3624 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3625 | //! @addtogroup imgproc_object |
| RyoheiHagimoto | 0:0e0631af0305 | 3626 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 3627 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3628 | //! type of the template matching operation |
| RyoheiHagimoto | 0:0e0631af0305 | 3629 | enum TemplateMatchModes { |
| RyoheiHagimoto | 0:0e0631af0305 | 3630 | TM_SQDIFF = 0, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y')-I(x+x',y+y'))^2\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3631 | TM_SQDIFF_NORMED = 1, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y')-I(x+x',y+y'))^2}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3632 | TM_CCORR = 2, //!< \f[R(x,y)= \sum _{x',y'} (T(x',y') \cdot I(x+x',y+y'))\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3633 | TM_CCORR_NORMED = 3, //!< \f[R(x,y)= \frac{\sum_{x',y'} (T(x',y') \cdot I(x+x',y+y'))}{\sqrt{\sum_{x',y'}T(x',y')^2 \cdot \sum_{x',y'} I(x+x',y+y')^2}}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3634 | TM_CCOEFF = 4, //!< \f[R(x,y)= \sum _{x',y'} (T'(x',y') \cdot I'(x+x',y+y'))\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3635 | //!< where |
| RyoheiHagimoto | 0:0e0631af0305 | 3636 | //!< \f[\begin{array}{l} T'(x',y')=T(x',y') - 1/(w \cdot h) \cdot \sum _{x'',y''} T(x'',y'') \\ I'(x+x',y+y')=I(x+x',y+y') - 1/(w \cdot h) \cdot \sum _{x'',y''} I(x+x'',y+y'') \end{array}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3637 | TM_CCOEFF_NORMED = 5 //!< \f[R(x,y)= \frac{ \sum_{x',y'} (T'(x',y') \cdot I'(x+x',y+y')) }{ \sqrt{\sum_{x',y'}T'(x',y')^2 \cdot \sum_{x',y'} I'(x+x',y+y')^2} }\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3638 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 3639 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3640 | /** @brief Compares a template against overlapped image regions. |
| RyoheiHagimoto | 0:0e0631af0305 | 3641 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3642 | The function slides through image , compares the overlapped patches of size \f$w \times h\f$ against |
| RyoheiHagimoto | 0:0e0631af0305 | 3643 | templ using the specified method and stores the comparison results in result . Here are the formulae |
| RyoheiHagimoto | 0:0e0631af0305 | 3644 | for the available comparison methods ( \f$I\f$ denotes image, \f$T\f$ template, \f$R\f$ result ). The summation |
| RyoheiHagimoto | 0:0e0631af0305 | 3645 | is done over template and/or the image patch: \f$x' = 0...w-1, y' = 0...h-1\f$ |
| RyoheiHagimoto | 0:0e0631af0305 | 3646 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3647 | After the function finishes the comparison, the best matches can be found as global minimums (when |
| RyoheiHagimoto | 0:0e0631af0305 | 3648 | TM_SQDIFF was used) or maximums (when TM_CCORR or TM_CCOEFF was used) using the |
| RyoheiHagimoto | 0:0e0631af0305 | 3649 | minMaxLoc function. In case of a color image, template summation in the numerator and each sum in |
| RyoheiHagimoto | 0:0e0631af0305 | 3650 | the denominator is done over all of the channels and separate mean values are used for each channel. |
| RyoheiHagimoto | 0:0e0631af0305 | 3651 | That is, the function can take a color template and a color image. The result will still be a |
| RyoheiHagimoto | 0:0e0631af0305 | 3652 | single-channel image, which is easier to analyze. |
| RyoheiHagimoto | 0:0e0631af0305 | 3653 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3654 | @param image Image where the search is running. It must be 8-bit or 32-bit floating-point. |
| RyoheiHagimoto | 0:0e0631af0305 | 3655 | @param templ Searched template. It must be not greater than the source image and have the same |
| RyoheiHagimoto | 0:0e0631af0305 | 3656 | data type. |
| RyoheiHagimoto | 0:0e0631af0305 | 3657 | @param result Map of comparison results. It must be single-channel 32-bit floating-point. If image |
| RyoheiHagimoto | 0:0e0631af0305 | 3658 | is \f$W \times H\f$ and templ is \f$w \times h\f$ , then result is \f$(W-w+1) \times (H-h+1)\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 3659 | @param method Parameter specifying the comparison method, see cv::TemplateMatchModes |
| RyoheiHagimoto | 0:0e0631af0305 | 3660 | @param mask Mask of searched template. It must have the same datatype and size with templ. It is |
| RyoheiHagimoto | 0:0e0631af0305 | 3661 | not set by default. |
| RyoheiHagimoto | 0:0e0631af0305 | 3662 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3663 | CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ, |
| RyoheiHagimoto | 0:0e0631af0305 | 3664 | OutputArray result, int method, InputArray mask = noArray() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3665 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3666 | //! @} |
| RyoheiHagimoto | 0:0e0631af0305 | 3667 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3668 | //! @addtogroup imgproc_shape |
| RyoheiHagimoto | 0:0e0631af0305 | 3669 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 3670 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3671 | /** @brief computes the connected components labeled image of boolean image |
| RyoheiHagimoto | 0:0e0631af0305 | 3672 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3673 | image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 |
| RyoheiHagimoto | 0:0e0631af0305 | 3674 | represents the background label. ltype specifies the output label image type, an important |
| RyoheiHagimoto | 0:0e0631af0305 | 3675 | consideration based on the total number of labels or alternatively the total number of pixels in |
| RyoheiHagimoto | 0:0e0631af0305 | 3676 | the source image. ccltype specifies the connected components labeling algorithm to use, currently |
| RyoheiHagimoto | 0:0e0631af0305 | 3677 | Grana's (BBDT) and Wu's (SAUF) algorithms are supported, see the cv::ConnectedComponentsAlgorithmsTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 3678 | for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. |
| RyoheiHagimoto | 0:0e0631af0305 | 3679 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3680 | @param image the 8-bit single-channel image to be labeled |
| RyoheiHagimoto | 0:0e0631af0305 | 3681 | @param labels destination labeled image |
| RyoheiHagimoto | 0:0e0631af0305 | 3682 | @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively |
| RyoheiHagimoto | 0:0e0631af0305 | 3683 | @param ltype output image label type. Currently CV_32S and CV_16U are supported. |
| RyoheiHagimoto | 0:0e0631af0305 | 3684 | @param ccltype connected components algorithm type (see the cv::ConnectedComponentsAlgorithmsTypes). |
| RyoheiHagimoto | 0:0e0631af0305 | 3685 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3686 | CV_EXPORTS_AS(connectedComponentsWithAlgorithm) int connectedComponents(InputArray image, OutputArray labels, |
| RyoheiHagimoto | 0:0e0631af0305 | 3687 | int connectivity, int ltype, int ccltype); |
| RyoheiHagimoto | 0:0e0631af0305 | 3688 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3689 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3690 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 3691 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3692 | @param image the 8-bit single-channel image to be labeled |
| RyoheiHagimoto | 0:0e0631af0305 | 3693 | @param labels destination labeled image |
| RyoheiHagimoto | 0:0e0631af0305 | 3694 | @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively |
| RyoheiHagimoto | 0:0e0631af0305 | 3695 | @param ltype output image label type. Currently CV_32S and CV_16U are supported. |
| RyoheiHagimoto | 0:0e0631af0305 | 3696 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3697 | CV_EXPORTS_W int connectedComponents(InputArray image, OutputArray labels, |
| RyoheiHagimoto | 0:0e0631af0305 | 3698 | int connectivity = 8, int ltype = CV_32S); |
| RyoheiHagimoto | 0:0e0631af0305 | 3699 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3700 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3701 | /** @brief computes the connected components labeled image of boolean image and also produces a statistics output for each label |
| RyoheiHagimoto | 0:0e0631af0305 | 3702 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3703 | image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 |
| RyoheiHagimoto | 0:0e0631af0305 | 3704 | represents the background label. ltype specifies the output label image type, an important |
| RyoheiHagimoto | 0:0e0631af0305 | 3705 | consideration based on the total number of labels or alternatively the total number of pixels in |
| RyoheiHagimoto | 0:0e0631af0305 | 3706 | the source image. ccltype specifies the connected components labeling algorithm to use, currently |
| RyoheiHagimoto | 0:0e0631af0305 | 3707 | Grana's (BBDT) and Wu's (SAUF) algorithms are supported, see the cv::ConnectedComponentsAlgorithmsTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 3708 | for details. Note that SAUF algorithm forces a row major ordering of labels while BBDT does not. |
| RyoheiHagimoto | 0:0e0631af0305 | 3709 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3710 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3711 | @param image the 8-bit single-channel image to be labeled |
| RyoheiHagimoto | 0:0e0631af0305 | 3712 | @param labels destination labeled image |
| RyoheiHagimoto | 0:0e0631af0305 | 3713 | @param stats statistics output for each label, including the background label, see below for |
| RyoheiHagimoto | 0:0e0631af0305 | 3714 | available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of |
| RyoheiHagimoto | 0:0e0631af0305 | 3715 | cv::ConnectedComponentsTypes. The data type is CV_32S. |
| RyoheiHagimoto | 0:0e0631af0305 | 3716 | @param centroids centroid output for each label, including the background label. Centroids are |
| RyoheiHagimoto | 0:0e0631af0305 | 3717 | accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 3718 | @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively |
| RyoheiHagimoto | 0:0e0631af0305 | 3719 | @param ltype output image label type. Currently CV_32S and CV_16U are supported. |
| RyoheiHagimoto | 0:0e0631af0305 | 3720 | @param ccltype connected components algorithm type (see the cv::ConnectedComponentsAlgorithmsTypes). |
| RyoheiHagimoto | 0:0e0631af0305 | 3721 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3722 | CV_EXPORTS_AS(connectedComponentsWithStatsWithAlgorithm) int connectedComponentsWithStats(InputArray image, OutputArray labels, |
| RyoheiHagimoto | 0:0e0631af0305 | 3723 | OutputArray stats, OutputArray centroids, |
| RyoheiHagimoto | 0:0e0631af0305 | 3724 | int connectivity, int ltype, int ccltype); |
| RyoheiHagimoto | 0:0e0631af0305 | 3725 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3726 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 3727 | @param image the 8-bit single-channel image to be labeled |
| RyoheiHagimoto | 0:0e0631af0305 | 3728 | @param labels destination labeled image |
| RyoheiHagimoto | 0:0e0631af0305 | 3729 | @param stats statistics output for each label, including the background label, see below for |
| RyoheiHagimoto | 0:0e0631af0305 | 3730 | available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of |
| RyoheiHagimoto | 0:0e0631af0305 | 3731 | cv::ConnectedComponentsTypes. The data type is CV_32S. |
| RyoheiHagimoto | 0:0e0631af0305 | 3732 | @param centroids centroid output for each label, including the background label. Centroids are |
| RyoheiHagimoto | 0:0e0631af0305 | 3733 | accessed via centroids(label, 0) for x and centroids(label, 1) for y. The data type CV_64F. |
| RyoheiHagimoto | 0:0e0631af0305 | 3734 | @param connectivity 8 or 4 for 8-way or 4-way connectivity respectively |
| RyoheiHagimoto | 0:0e0631af0305 | 3735 | @param ltype output image label type. Currently CV_32S and CV_16U are supported. |
| RyoheiHagimoto | 0:0e0631af0305 | 3736 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3737 | CV_EXPORTS_W int connectedComponentsWithStats(InputArray image, OutputArray labels, |
| RyoheiHagimoto | 0:0e0631af0305 | 3738 | OutputArray stats, OutputArray centroids, |
| RyoheiHagimoto | 0:0e0631af0305 | 3739 | int connectivity = 8, int ltype = CV_32S); |
| RyoheiHagimoto | 0:0e0631af0305 | 3740 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3741 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3742 | /** @brief Finds contours in a binary image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3743 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3744 | The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours |
| RyoheiHagimoto | 0:0e0631af0305 | 3745 | are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the |
| RyoheiHagimoto | 0:0e0631af0305 | 3746 | OpenCV sample directory. |
| RyoheiHagimoto | 0:0e0631af0305 | 3747 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3748 | @param image Source, an 8-bit single-channel image. Non-zero pixels are treated as 1's. Zero |
| RyoheiHagimoto | 0:0e0631af0305 | 3749 | pixels remain 0's, so the image is treated as binary . You can use cv::compare, cv::inRange, cv::threshold , |
| RyoheiHagimoto | 0:0e0631af0305 | 3750 | cv::adaptiveThreshold, cv::Canny, and others to create a binary image out of a grayscale or color one. |
| RyoheiHagimoto | 0:0e0631af0305 | 3751 | If mode equals to cv::RETR_CCOMP or cv::RETR_FLOODFILL, the input can also be a 32-bit integer image of labels (CV_32SC1). |
| RyoheiHagimoto | 0:0e0631af0305 | 3752 | @param contours Detected contours. Each contour is stored as a vector of points (e.g. |
| RyoheiHagimoto | 0:0e0631af0305 | 3753 | std::vector<std::vector<cv::Point> >). |
| RyoheiHagimoto | 0:0e0631af0305 | 3754 | @param hierarchy Optional output vector (e.g. std::vector<cv::Vec4i>), containing information about the image topology. It has |
| RyoheiHagimoto | 0:0e0631af0305 | 3755 | as many elements as the number of contours. For each i-th contour contours[i], the elements |
| RyoheiHagimoto | 0:0e0631af0305 | 3756 | hierarchy[i][0] , hiearchy[i][1] , hiearchy[i][2] , and hiearchy[i][3] are set to 0-based indices |
| RyoheiHagimoto | 0:0e0631af0305 | 3757 | in contours of the next and previous contours at the same hierarchical level, the first child |
| RyoheiHagimoto | 0:0e0631af0305 | 3758 | contour and the parent contour, respectively. If for the contour i there are no next, previous, |
| RyoheiHagimoto | 0:0e0631af0305 | 3759 | parent, or nested contours, the corresponding elements of hierarchy[i] will be negative. |
| RyoheiHagimoto | 0:0e0631af0305 | 3760 | @param mode Contour retrieval mode, see cv::RetrievalModes |
| RyoheiHagimoto | 0:0e0631af0305 | 3761 | @param method Contour approximation method, see cv::ContourApproximationModes |
| RyoheiHagimoto | 0:0e0631af0305 | 3762 | @param offset Optional offset by which every contour point is shifted. This is useful if the |
| RyoheiHagimoto | 0:0e0631af0305 | 3763 | contours are extracted from the image ROI and then they should be analyzed in the whole image |
| RyoheiHagimoto | 0:0e0631af0305 | 3764 | context. |
| RyoheiHagimoto | 0:0e0631af0305 | 3765 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3766 | CV_EXPORTS_W void findContours( InputOutputArray image, OutputArrayOfArrays contours, |
| RyoheiHagimoto | 0:0e0631af0305 | 3767 | OutputArray hierarchy, int mode, |
| RyoheiHagimoto | 0:0e0631af0305 | 3768 | int method, Point offset = Point()); |
| RyoheiHagimoto | 0:0e0631af0305 | 3769 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3770 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3771 | CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours, |
| RyoheiHagimoto | 0:0e0631af0305 | 3772 | int mode, int method, Point offset = Point()); |
| RyoheiHagimoto | 0:0e0631af0305 | 3773 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3774 | /** @brief Approximates a polygonal curve(s) with the specified precision. |
| RyoheiHagimoto | 0:0e0631af0305 | 3775 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3776 | The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less |
| RyoheiHagimoto | 0:0e0631af0305 | 3777 | vertices so that the distance between them is less or equal to the specified precision. It uses the |
| RyoheiHagimoto | 0:0e0631af0305 | 3778 | Douglas-Peucker algorithm <http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm> |
| RyoheiHagimoto | 0:0e0631af0305 | 3779 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3780 | @param curve Input vector of a 2D point stored in std::vector or Mat |
| RyoheiHagimoto | 0:0e0631af0305 | 3781 | @param approxCurve Result of the approximation. The type should match the type of the input curve. |
| RyoheiHagimoto | 0:0e0631af0305 | 3782 | @param epsilon Parameter specifying the approximation accuracy. This is the maximum distance |
| RyoheiHagimoto | 0:0e0631af0305 | 3783 | between the original curve and its approximation. |
| RyoheiHagimoto | 0:0e0631af0305 | 3784 | @param closed If true, the approximated curve is closed (its first and last vertices are |
| RyoheiHagimoto | 0:0e0631af0305 | 3785 | connected). Otherwise, it is not closed. |
| RyoheiHagimoto | 0:0e0631af0305 | 3786 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3787 | CV_EXPORTS_W void approxPolyDP( InputArray curve, |
| RyoheiHagimoto | 0:0e0631af0305 | 3788 | OutputArray approxCurve, |
| RyoheiHagimoto | 0:0e0631af0305 | 3789 | double epsilon, bool closed ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3790 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3791 | /** @brief Calculates a contour perimeter or a curve length. |
| RyoheiHagimoto | 0:0e0631af0305 | 3792 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3793 | The function computes a curve length or a closed contour perimeter. |
| RyoheiHagimoto | 0:0e0631af0305 | 3794 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3795 | @param curve Input vector of 2D points, stored in std::vector or Mat. |
| RyoheiHagimoto | 0:0e0631af0305 | 3796 | @param closed Flag indicating whether the curve is closed or not. |
| RyoheiHagimoto | 0:0e0631af0305 | 3797 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3798 | CV_EXPORTS_W double arcLength( InputArray curve, bool closed ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3799 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3800 | /** @brief Calculates the up-right bounding rectangle of a point set. |
| RyoheiHagimoto | 0:0e0631af0305 | 3801 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3802 | The function calculates and returns the minimal up-right bounding rectangle for the specified point set. |
| RyoheiHagimoto | 0:0e0631af0305 | 3803 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3804 | @param points Input 2D point set, stored in std::vector or Mat. |
| RyoheiHagimoto | 0:0e0631af0305 | 3805 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3806 | CV_EXPORTS_W Rect boundingRect( InputArray points ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3807 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3808 | /** @brief Calculates a contour area. |
| RyoheiHagimoto | 0:0e0631af0305 | 3809 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3810 | The function computes a contour area. Similarly to moments , the area is computed using the Green |
| RyoheiHagimoto | 0:0e0631af0305 | 3811 | formula. Thus, the returned area and the number of non-zero pixels, if you draw the contour using |
| RyoheiHagimoto | 0:0e0631af0305 | 3812 | drawContours or fillPoly , can be different. Also, the function will most certainly give a wrong |
| RyoheiHagimoto | 0:0e0631af0305 | 3813 | results for contours with self-intersections. |
| RyoheiHagimoto | 0:0e0631af0305 | 3814 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3815 | Example: |
| RyoheiHagimoto | 0:0e0631af0305 | 3816 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 3817 | vector<Point> contour; |
| RyoheiHagimoto | 0:0e0631af0305 | 3818 | contour.push_back(Point2f(0, 0)); |
| RyoheiHagimoto | 0:0e0631af0305 | 3819 | contour.push_back(Point2f(10, 0)); |
| RyoheiHagimoto | 0:0e0631af0305 | 3820 | contour.push_back(Point2f(10, 10)); |
| RyoheiHagimoto | 0:0e0631af0305 | 3821 | contour.push_back(Point2f(5, 4)); |
| RyoheiHagimoto | 0:0e0631af0305 | 3822 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3823 | double area0 = contourArea(contour); |
| RyoheiHagimoto | 0:0e0631af0305 | 3824 | vector<Point> approx; |
| RyoheiHagimoto | 0:0e0631af0305 | 3825 | approxPolyDP(contour, approx, 5, true); |
| RyoheiHagimoto | 0:0e0631af0305 | 3826 | double area1 = contourArea(approx); |
| RyoheiHagimoto | 0:0e0631af0305 | 3827 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3828 | cout << "area0 =" << area0 << endl << |
| RyoheiHagimoto | 0:0e0631af0305 | 3829 | "area1 =" << area1 << endl << |
| RyoheiHagimoto | 0:0e0631af0305 | 3830 | "approx poly vertices" << approx.size() << endl; |
| RyoheiHagimoto | 0:0e0631af0305 | 3831 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 3832 | @param contour Input vector of 2D points (contour vertices), stored in std::vector or Mat. |
| RyoheiHagimoto | 0:0e0631af0305 | 3833 | @param oriented Oriented area flag. If it is true, the function returns a signed area value, |
| RyoheiHagimoto | 0:0e0631af0305 | 3834 | depending on the contour orientation (clockwise or counter-clockwise). Using this feature you can |
| RyoheiHagimoto | 0:0e0631af0305 | 3835 | determine orientation of a contour by taking the sign of an area. By default, the parameter is |
| RyoheiHagimoto | 0:0e0631af0305 | 3836 | false, which means that the absolute value is returned. |
| RyoheiHagimoto | 0:0e0631af0305 | 3837 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3838 | CV_EXPORTS_W double contourArea( InputArray contour, bool oriented = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3839 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3840 | /** @brief Finds a rotated rectangle of the minimum area enclosing the input 2D point set. |
| RyoheiHagimoto | 0:0e0631af0305 | 3841 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3842 | The function calculates and returns the minimum-area bounding rectangle (possibly rotated) for a |
| RyoheiHagimoto | 0:0e0631af0305 | 3843 | specified point set. See the OpenCV sample minarea.cpp . Developer should keep in mind that the |
| RyoheiHagimoto | 0:0e0631af0305 | 3844 | returned rotatedRect can contain negative indices when data is close to the containing Mat element |
| RyoheiHagimoto | 0:0e0631af0305 | 3845 | boundary. |
| RyoheiHagimoto | 0:0e0631af0305 | 3846 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3847 | @param points Input vector of 2D points, stored in std::vector\<\> or Mat |
| RyoheiHagimoto | 0:0e0631af0305 | 3848 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3849 | CV_EXPORTS_W RotatedRect minAreaRect( InputArray points ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3850 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3851 | /** @brief Finds the four vertices of a rotated rect. Useful to draw the rotated rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 3852 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3853 | The function finds the four vertices of a rotated rectangle. This function is useful to draw the |
| RyoheiHagimoto | 0:0e0631af0305 | 3854 | rectangle. In C++, instead of using this function, you can directly use box.points() method. Please |
| RyoheiHagimoto | 0:0e0631af0305 | 3855 | visit the [tutorial on bounding |
| RyoheiHagimoto | 0:0e0631af0305 | 3856 | rectangle](http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html#bounding-rects-circles) |
| RyoheiHagimoto | 0:0e0631af0305 | 3857 | for more information. |
| RyoheiHagimoto | 0:0e0631af0305 | 3858 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3859 | @param box The input rotated rectangle. It may be the output of |
| RyoheiHagimoto | 0:0e0631af0305 | 3860 | @param points The output array of four vertices of rectangles. |
| RyoheiHagimoto | 0:0e0631af0305 | 3861 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3862 | CV_EXPORTS_W void boxPoints(RotatedRect box, OutputArray points); |
| RyoheiHagimoto | 0:0e0631af0305 | 3863 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3864 | /** @brief Finds a circle of the minimum area enclosing a 2D point set. |
| RyoheiHagimoto | 0:0e0631af0305 | 3865 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3866 | The function finds the minimal enclosing circle of a 2D point set using an iterative algorithm. See |
| RyoheiHagimoto | 0:0e0631af0305 | 3867 | the OpenCV sample minarea.cpp . |
| RyoheiHagimoto | 0:0e0631af0305 | 3868 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3869 | @param points Input vector of 2D points, stored in std::vector\<\> or Mat |
| RyoheiHagimoto | 0:0e0631af0305 | 3870 | @param center Output center of the circle. |
| RyoheiHagimoto | 0:0e0631af0305 | 3871 | @param radius Output radius of the circle. |
| RyoheiHagimoto | 0:0e0631af0305 | 3872 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3873 | CV_EXPORTS_W void minEnclosingCircle( InputArray points, |
| RyoheiHagimoto | 0:0e0631af0305 | 3874 | CV_OUT Point2f& center, CV_OUT float& radius ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3875 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3876 | /** @example minarea.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3877 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3878 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3879 | /** @brief Finds a triangle of minimum area enclosing a 2D point set and returns its area. |
| RyoheiHagimoto | 0:0e0631af0305 | 3880 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3881 | The function finds a triangle of minimum area enclosing the given set of 2D points and returns its |
| RyoheiHagimoto | 0:0e0631af0305 | 3882 | area. The output for a given 2D point set is shown in the image below. 2D points are depicted in |
| RyoheiHagimoto | 0:0e0631af0305 | 3883 | *red* and the enclosing triangle in *yellow*. |
| RyoheiHagimoto | 0:0e0631af0305 | 3884 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3885 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 3886 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3887 | The implementation of the algorithm is based on O'Rourke's @cite ORourke86 and Klee and Laskowski's |
| RyoheiHagimoto | 0:0e0631af0305 | 3888 | @cite KleeLaskowski85 papers. O'Rourke provides a \f$\theta(n)\f$ algorithm for finding the minimal |
| RyoheiHagimoto | 0:0e0631af0305 | 3889 | enclosing triangle of a 2D convex polygon with n vertices. Since the minEnclosingTriangle function |
| RyoheiHagimoto | 0:0e0631af0305 | 3890 | takes a 2D point set as input an additional preprocessing step of computing the convex hull of the |
| RyoheiHagimoto | 0:0e0631af0305 | 3891 | 2D point set is required. The complexity of the convexHull function is \f$O(n log(n))\f$ which is higher |
| RyoheiHagimoto | 0:0e0631af0305 | 3892 | than \f$\theta(n)\f$. Thus the overall complexity of the function is \f$O(n log(n))\f$. |
| RyoheiHagimoto | 0:0e0631af0305 | 3893 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3894 | @param points Input vector of 2D points with depth CV_32S or CV_32F, stored in std::vector\<\> or Mat |
| RyoheiHagimoto | 0:0e0631af0305 | 3895 | @param triangle Output vector of three 2D points defining the vertices of the triangle. The depth |
| RyoheiHagimoto | 0:0e0631af0305 | 3896 | of the OutputArray must be CV_32F. |
| RyoheiHagimoto | 0:0e0631af0305 | 3897 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3898 | CV_EXPORTS_W double minEnclosingTriangle( InputArray points, CV_OUT OutputArray triangle ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3899 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3900 | /** @brief Compares two shapes. |
| RyoheiHagimoto | 0:0e0631af0305 | 3901 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3902 | The function compares two shapes. All three implemented methods use the Hu invariants (see cv::HuMoments) |
| RyoheiHagimoto | 0:0e0631af0305 | 3903 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3904 | @param contour1 First contour or grayscale image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3905 | @param contour2 Second contour or grayscale image. |
| RyoheiHagimoto | 0:0e0631af0305 | 3906 | @param method Comparison method, see ::ShapeMatchModes |
| RyoheiHagimoto | 0:0e0631af0305 | 3907 | @param parameter Method-specific parameter (not supported now). |
| RyoheiHagimoto | 0:0e0631af0305 | 3908 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3909 | CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2, |
| RyoheiHagimoto | 0:0e0631af0305 | 3910 | int method, double parameter ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3911 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3912 | /** @example convexhull.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3913 | An example using the convexHull functionality |
| RyoheiHagimoto | 0:0e0631af0305 | 3914 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3915 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3916 | /** @brief Finds the convex hull of a point set. |
| RyoheiHagimoto | 0:0e0631af0305 | 3917 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3918 | The function cv::convexHull finds the convex hull of a 2D point set using the Sklansky's algorithm @cite Sklansky82 |
| RyoheiHagimoto | 0:0e0631af0305 | 3919 | that has *O(N logN)* complexity in the current implementation. See the OpenCV sample convexhull.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3920 | that demonstrates the usage of different function variants. |
| RyoheiHagimoto | 0:0e0631af0305 | 3921 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3922 | @param points Input 2D point set, stored in std::vector or Mat. |
| RyoheiHagimoto | 0:0e0631af0305 | 3923 | @param hull Output convex hull. It is either an integer vector of indices or vector of points. In |
| RyoheiHagimoto | 0:0e0631af0305 | 3924 | the first case, the hull elements are 0-based indices of the convex hull points in the original |
| RyoheiHagimoto | 0:0e0631af0305 | 3925 | array (since the set of convex hull points is a subset of the original point set). In the second |
| RyoheiHagimoto | 0:0e0631af0305 | 3926 | case, hull elements are the convex hull points themselves. |
| RyoheiHagimoto | 0:0e0631af0305 | 3927 | @param clockwise Orientation flag. If it is true, the output convex hull is oriented clockwise. |
| RyoheiHagimoto | 0:0e0631af0305 | 3928 | Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing |
| RyoheiHagimoto | 0:0e0631af0305 | 3929 | to the right, and its Y axis pointing upwards. |
| RyoheiHagimoto | 0:0e0631af0305 | 3930 | @param returnPoints Operation flag. In case of a matrix, when the flag is true, the function |
| RyoheiHagimoto | 0:0e0631af0305 | 3931 | returns convex hull points. Otherwise, it returns indices of the convex hull points. When the |
| RyoheiHagimoto | 0:0e0631af0305 | 3932 | output array is std::vector, the flag is ignored, and the output depends on the type of the |
| RyoheiHagimoto | 0:0e0631af0305 | 3933 | vector: std::vector\<int\> implies returnPoints=false, std::vector\<Point\> implies |
| RyoheiHagimoto | 0:0e0631af0305 | 3934 | returnPoints=true. |
| RyoheiHagimoto | 0:0e0631af0305 | 3935 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3936 | CV_EXPORTS_W void convexHull( InputArray points, OutputArray hull, |
| RyoheiHagimoto | 0:0e0631af0305 | 3937 | bool clockwise = false, bool returnPoints = true ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3938 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3939 | /** @brief Finds the convexity defects of a contour. |
| RyoheiHagimoto | 0:0e0631af0305 | 3940 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3941 | The figure below displays convexity defects of a hand contour: |
| RyoheiHagimoto | 0:0e0631af0305 | 3942 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3943 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 3944 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3945 | @param contour Input contour. |
| RyoheiHagimoto | 0:0e0631af0305 | 3946 | @param convexhull Convex hull obtained using convexHull that should contain indices of the contour |
| RyoheiHagimoto | 0:0e0631af0305 | 3947 | points that make the hull. |
| RyoheiHagimoto | 0:0e0631af0305 | 3948 | @param convexityDefects The output vector of convexity defects. In C++ and the new Python/Java |
| RyoheiHagimoto | 0:0e0631af0305 | 3949 | interface each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): |
| RyoheiHagimoto | 0:0e0631af0305 | 3950 | (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices |
| RyoheiHagimoto | 0:0e0631af0305 | 3951 | in the original contour of the convexity defect beginning, end and the farthest point, and |
| RyoheiHagimoto | 0:0e0631af0305 | 3952 | fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the |
| RyoheiHagimoto | 0:0e0631af0305 | 3953 | farthest contour point and the hull. That is, to get the floating-point value of the depth will be |
| RyoheiHagimoto | 0:0e0631af0305 | 3954 | fixpt_depth/256.0. |
| RyoheiHagimoto | 0:0e0631af0305 | 3955 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3956 | CV_EXPORTS_W void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3957 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3958 | /** @brief Tests a contour convexity. |
| RyoheiHagimoto | 0:0e0631af0305 | 3959 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3960 | The function tests whether the input contour is convex or not. The contour must be simple, that is, |
| RyoheiHagimoto | 0:0e0631af0305 | 3961 | without self-intersections. Otherwise, the function output is undefined. |
| RyoheiHagimoto | 0:0e0631af0305 | 3962 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3963 | @param contour Input vector of 2D points, stored in std::vector\<\> or Mat |
| RyoheiHagimoto | 0:0e0631af0305 | 3964 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3965 | CV_EXPORTS_W bool isContourConvex( InputArray contour ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3966 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3967 | //! finds intersection of two convex polygons |
| RyoheiHagimoto | 0:0e0631af0305 | 3968 | CV_EXPORTS_W float intersectConvexConvex( InputArray _p1, InputArray _p2, |
| RyoheiHagimoto | 0:0e0631af0305 | 3969 | OutputArray _p12, bool handleNested = true ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3970 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3971 | /** @example fitellipse.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 3972 | An example using the fitEllipse technique |
| RyoheiHagimoto | 0:0e0631af0305 | 3973 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3974 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3975 | /** @brief Fits an ellipse around a set of 2D points. |
| RyoheiHagimoto | 0:0e0631af0305 | 3976 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3977 | The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of |
| RyoheiHagimoto | 0:0e0631af0305 | 3978 | all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95 |
| RyoheiHagimoto | 0:0e0631af0305 | 3979 | is used. Developer should keep in mind that it is possible that the returned |
| RyoheiHagimoto | 0:0e0631af0305 | 3980 | ellipse/rotatedRect data contains negative indices, due to the data points being close to the |
| RyoheiHagimoto | 0:0e0631af0305 | 3981 | border of the containing Mat element. |
| RyoheiHagimoto | 0:0e0631af0305 | 3982 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3983 | @param points Input 2D point set, stored in std::vector\<\> or Mat |
| RyoheiHagimoto | 0:0e0631af0305 | 3984 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 3985 | CV_EXPORTS_W RotatedRect fitEllipse( InputArray points ); |
| RyoheiHagimoto | 0:0e0631af0305 | 3986 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3987 | /** @brief Fits a line to a 2D or 3D point set. |
| RyoheiHagimoto | 0:0e0631af0305 | 3988 | |
| RyoheiHagimoto | 0:0e0631af0305 | 3989 | The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where |
| RyoheiHagimoto | 0:0e0631af0305 | 3990 | \f$r_i\f$ is a distance between the \f$i^{th}\f$ point, the line and \f$\rho(r)\f$ is a distance function, one |
| RyoheiHagimoto | 0:0e0631af0305 | 3991 | of the following: |
| RyoheiHagimoto | 0:0e0631af0305 | 3992 | - DIST_L2 |
| RyoheiHagimoto | 0:0e0631af0305 | 3993 | \f[\rho (r) = r^2/2 \quad \text{(the simplest and the fastest least-squares method)}\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3994 | - DIST_L1 |
| RyoheiHagimoto | 0:0e0631af0305 | 3995 | \f[\rho (r) = r\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3996 | - DIST_L12 |
| RyoheiHagimoto | 0:0e0631af0305 | 3997 | \f[\rho (r) = 2 \cdot ( \sqrt{1 + \frac{r^2}{2}} - 1)\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 3998 | - DIST_FAIR |
| RyoheiHagimoto | 0:0e0631af0305 | 3999 | \f[\rho \left (r \right ) = C^2 \cdot \left ( \frac{r}{C} - \log{\left(1 + \frac{r}{C}\right)} \right ) \quad \text{where} \quad C=1.3998\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 4000 | - DIST_WELSCH |
| RyoheiHagimoto | 0:0e0631af0305 | 4001 | \f[\rho \left (r \right ) = \frac{C^2}{2} \cdot \left ( 1 - \exp{\left(-\left(\frac{r}{C}\right)^2\right)} \right ) \quad \text{where} \quad C=2.9846\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 4002 | - DIST_HUBER |
| RyoheiHagimoto | 0:0e0631af0305 | 4003 | \f[\rho (r) = \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\f] |
| RyoheiHagimoto | 0:0e0631af0305 | 4004 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4005 | The algorithm is based on the M-estimator ( <http://en.wikipedia.org/wiki/M-estimator> ) technique |
| RyoheiHagimoto | 0:0e0631af0305 | 4006 | that iteratively fits the line using the weighted least-squares algorithm. After each iteration the |
| RyoheiHagimoto | 0:0e0631af0305 | 4007 | weights \f$w_i\f$ are adjusted to be inversely proportional to \f$\rho(r_i)\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 4008 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4009 | @param points Input vector of 2D or 3D points, stored in std::vector\<\> or Mat. |
| RyoheiHagimoto | 0:0e0631af0305 | 4010 | @param line Output line parameters. In case of 2D fitting, it should be a vector of 4 elements |
| RyoheiHagimoto | 0:0e0631af0305 | 4011 | (like Vec4f) - (vx, vy, x0, y0), where (vx, vy) is a normalized vector collinear to the line and |
| RyoheiHagimoto | 0:0e0631af0305 | 4012 | (x0, y0) is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (like |
| RyoheiHagimoto | 0:0e0631af0305 | 4013 | Vec6f) - (vx, vy, vz, x0, y0, z0), where (vx, vy, vz) is a normalized vector collinear to the line |
| RyoheiHagimoto | 0:0e0631af0305 | 4014 | and (x0, y0, z0) is a point on the line. |
| RyoheiHagimoto | 0:0e0631af0305 | 4015 | @param distType Distance used by the M-estimator, see cv::DistanceTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4016 | @param param Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value |
| RyoheiHagimoto | 0:0e0631af0305 | 4017 | is chosen. |
| RyoheiHagimoto | 0:0e0631af0305 | 4018 | @param reps Sufficient accuracy for the radius (distance between the coordinate origin and the line). |
| RyoheiHagimoto | 0:0e0631af0305 | 4019 | @param aeps Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps. |
| RyoheiHagimoto | 0:0e0631af0305 | 4020 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4021 | CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType, |
| RyoheiHagimoto | 0:0e0631af0305 | 4022 | double param, double reps, double aeps ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4023 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4024 | /** @brief Performs a point-in-contour test. |
| RyoheiHagimoto | 0:0e0631af0305 | 4025 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4026 | The function determines whether the point is inside a contour, outside, or lies on an edge (or |
| RyoheiHagimoto | 0:0e0631af0305 | 4027 | coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) |
| RyoheiHagimoto | 0:0e0631af0305 | 4028 | value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. |
| RyoheiHagimoto | 0:0e0631af0305 | 4029 | Otherwise, the return value is a signed distance between the point and the nearest contour edge. |
| RyoheiHagimoto | 0:0e0631af0305 | 4030 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4031 | See below a sample output of the function where each image pixel is tested against the contour: |
| RyoheiHagimoto | 0:0e0631af0305 | 4032 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4033 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 4034 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4035 | @param contour Input contour. |
| RyoheiHagimoto | 0:0e0631af0305 | 4036 | @param pt Point tested against the contour. |
| RyoheiHagimoto | 0:0e0631af0305 | 4037 | @param measureDist If true, the function estimates the signed distance from the point to the |
| RyoheiHagimoto | 0:0e0631af0305 | 4038 | nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not. |
| RyoheiHagimoto | 0:0e0631af0305 | 4039 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4040 | CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4041 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4042 | /** @brief Finds out if there is any intersection between two rotated rectangles. |
| RyoheiHagimoto | 0:0e0631af0305 | 4043 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4044 | If there is then the vertices of the interesecting region are returned as well. |
| RyoheiHagimoto | 0:0e0631af0305 | 4045 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4046 | Below are some examples of intersection configurations. The hatched pattern indicates the |
| RyoheiHagimoto | 0:0e0631af0305 | 4047 | intersecting region and the red vertices are returned by the function. |
| RyoheiHagimoto | 0:0e0631af0305 | 4048 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4049 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 4050 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4051 | @param rect1 First rectangle |
| RyoheiHagimoto | 0:0e0631af0305 | 4052 | @param rect2 Second rectangle |
| RyoheiHagimoto | 0:0e0631af0305 | 4053 | @param intersectingRegion The output array of the verticies of the intersecting region. It returns |
| RyoheiHagimoto | 0:0e0631af0305 | 4054 | at most 8 vertices. Stored as std::vector\<cv::Point2f\> or cv::Mat as Mx1 of type CV_32FC2. |
| RyoheiHagimoto | 0:0e0631af0305 | 4055 | @returns One of cv::RectanglesIntersectTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4056 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4057 | CV_EXPORTS_W int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4058 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4059 | //! @} imgproc_shape |
| RyoheiHagimoto | 0:0e0631af0305 | 4060 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4061 | CV_EXPORTS_W Ptr<CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8)); |
| RyoheiHagimoto | 0:0e0631af0305 | 4062 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4063 | //! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122. |
| RyoheiHagimoto | 0:0e0631af0305 | 4064 | //! Detects position only without traslation and rotation |
| RyoheiHagimoto | 0:0e0631af0305 | 4065 | CV_EXPORTS Ptr<GeneralizedHoughBallard> createGeneralizedHoughBallard(); |
| RyoheiHagimoto | 0:0e0631af0305 | 4066 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4067 | //! Guil, N., González-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038. |
| RyoheiHagimoto | 0:0e0631af0305 | 4068 | //! Detects position, traslation and rotation |
| RyoheiHagimoto | 0:0e0631af0305 | 4069 | CV_EXPORTS Ptr<GeneralizedHoughGuil> createGeneralizedHoughGuil(); |
| RyoheiHagimoto | 0:0e0631af0305 | 4070 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4071 | //! Performs linear blending of two images |
| RyoheiHagimoto | 0:0e0631af0305 | 4072 | CV_EXPORTS void blendLinear(InputArray src1, InputArray src2, InputArray weights1, InputArray weights2, OutputArray dst); |
| RyoheiHagimoto | 0:0e0631af0305 | 4073 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4074 | //! @addtogroup imgproc_colormap |
| RyoheiHagimoto | 0:0e0631af0305 | 4075 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 4076 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4077 | //! GNU Octave/MATLAB equivalent colormaps |
| RyoheiHagimoto | 0:0e0631af0305 | 4078 | enum ColormapTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4079 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4080 | COLORMAP_AUTUMN = 0, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4081 | COLORMAP_BONE = 1, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4082 | COLORMAP_JET = 2, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4083 | COLORMAP_WINTER = 3, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4084 | COLORMAP_RAINBOW = 4, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4085 | COLORMAP_OCEAN = 5, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4086 | COLORMAP_SUMMER = 6, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4087 | COLORMAP_SPRING = 7, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4088 | COLORMAP_COOL = 8, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4089 | COLORMAP_HSV = 9, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4090 | COLORMAP_PINK = 10, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4091 | COLORMAP_HOT = 11, //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4092 | COLORMAP_PARULA = 12 //!<  |
| RyoheiHagimoto | 0:0e0631af0305 | 4093 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 4094 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4095 | /** @brief Applies a GNU Octave/MATLAB equivalent colormap on a given image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4096 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4097 | @param src The source image, grayscale or colored of type CV_8UC1 or CV_8UC3. |
| RyoheiHagimoto | 0:0e0631af0305 | 4098 | @param dst The result is the colormapped source image. Note: Mat::create is called on dst. |
| RyoheiHagimoto | 0:0e0631af0305 | 4099 | @param colormap The colormap to apply, see cv::ColormapTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4100 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4101 | CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, int colormap); |
| RyoheiHagimoto | 0:0e0631af0305 | 4102 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4103 | //! @} imgproc_colormap |
| RyoheiHagimoto | 0:0e0631af0305 | 4104 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4105 | //! @addtogroup imgproc_draw |
| RyoheiHagimoto | 0:0e0631af0305 | 4106 | //! @{ |
| RyoheiHagimoto | 0:0e0631af0305 | 4107 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4108 | /** @brief Draws a line segment connecting two points. |
| RyoheiHagimoto | 0:0e0631af0305 | 4109 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4110 | The function line draws the line segment between pt1 and pt2 points in the image. The line is |
| RyoheiHagimoto | 0:0e0631af0305 | 4111 | clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected |
| RyoheiHagimoto | 0:0e0631af0305 | 4112 | or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased |
| RyoheiHagimoto | 0:0e0631af0305 | 4113 | lines are drawn using Gaussian filtering. |
| RyoheiHagimoto | 0:0e0631af0305 | 4114 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4115 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4116 | @param pt1 First point of the line segment. |
| RyoheiHagimoto | 0:0e0631af0305 | 4117 | @param pt2 Second point of the line segment. |
| RyoheiHagimoto | 0:0e0631af0305 | 4118 | @param color Line color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4119 | @param thickness Line thickness. |
| RyoheiHagimoto | 0:0e0631af0305 | 4120 | @param lineType Type of the line, see cv::LineTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 4121 | @param shift Number of fractional bits in the point coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 4122 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4123 | CV_EXPORTS_W void line(InputOutputArray img, Point pt1, Point pt2, const Scalar& color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4124 | int thickness = 1, int lineType = LINE_8, int shift = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4125 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4126 | /** @brief Draws a arrow segment pointing from the first point to the second one. |
| RyoheiHagimoto | 0:0e0631af0305 | 4127 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4128 | The function arrowedLine draws an arrow between pt1 and pt2 points in the image. See also cv::line. |
| RyoheiHagimoto | 0:0e0631af0305 | 4129 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4130 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4131 | @param pt1 The point the arrow starts from. |
| RyoheiHagimoto | 0:0e0631af0305 | 4132 | @param pt2 The point the arrow points to. |
| RyoheiHagimoto | 0:0e0631af0305 | 4133 | @param color Line color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4134 | @param thickness Line thickness. |
| RyoheiHagimoto | 0:0e0631af0305 | 4135 | @param line_type Type of the line, see cv::LineTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4136 | @param shift Number of fractional bits in the point coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 4137 | @param tipLength The length of the arrow tip in relation to the arrow length |
| RyoheiHagimoto | 0:0e0631af0305 | 4138 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4139 | CV_EXPORTS_W void arrowedLine(InputOutputArray img, Point pt1, Point pt2, const Scalar& color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4140 | int thickness=1, int line_type=8, int shift=0, double tipLength=0.1); |
| RyoheiHagimoto | 0:0e0631af0305 | 4141 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4142 | /** @brief Draws a simple, thick, or filled up-right rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4143 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4144 | The function rectangle draws a rectangle outline or a filled rectangle whose two opposite corners |
| RyoheiHagimoto | 0:0e0631af0305 | 4145 | are pt1 and pt2. |
| RyoheiHagimoto | 0:0e0631af0305 | 4146 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4147 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4148 | @param pt1 Vertex of the rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4149 | @param pt2 Vertex of the rectangle opposite to pt1 . |
| RyoheiHagimoto | 0:0e0631af0305 | 4150 | @param color Rectangle color or brightness (grayscale image). |
| RyoheiHagimoto | 0:0e0631af0305 | 4151 | @param thickness Thickness of lines that make up the rectangle. Negative values, like CV_FILLED , |
| RyoheiHagimoto | 0:0e0631af0305 | 4152 | mean that the function has to draw a filled rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4153 | @param lineType Type of the line. See the line description. |
| RyoheiHagimoto | 0:0e0631af0305 | 4154 | @param shift Number of fractional bits in the point coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 4155 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4156 | CV_EXPORTS_W void rectangle(InputOutputArray img, Point pt1, Point pt2, |
| RyoheiHagimoto | 0:0e0631af0305 | 4157 | const Scalar& color, int thickness = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 4158 | int lineType = LINE_8, int shift = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4159 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4160 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 4161 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4162 | use `rec` parameter as alternative specification of the drawn rectangle: `r.tl() and |
| RyoheiHagimoto | 0:0e0631af0305 | 4163 | r.br()-Point(1,1)` are opposite corners |
| RyoheiHagimoto | 0:0e0631af0305 | 4164 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4165 | CV_EXPORTS void rectangle(CV_IN_OUT Mat& img, Rect rec, |
| RyoheiHagimoto | 0:0e0631af0305 | 4166 | const Scalar& color, int thickness = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 4167 | int lineType = LINE_8, int shift = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4168 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4169 | /** @brief Draws a circle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4170 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4171 | The function circle draws a simple or filled circle with a given center and radius. |
| RyoheiHagimoto | 0:0e0631af0305 | 4172 | @param img Image where the circle is drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4173 | @param center Center of the circle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4174 | @param radius Radius of the circle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4175 | @param color Circle color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4176 | @param thickness Thickness of the circle outline, if positive. Negative thickness means that a |
| RyoheiHagimoto | 0:0e0631af0305 | 4177 | filled circle is to be drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4178 | @param lineType Type of the circle boundary. See the line description. |
| RyoheiHagimoto | 0:0e0631af0305 | 4179 | @param shift Number of fractional bits in the coordinates of the center and in the radius value. |
| RyoheiHagimoto | 0:0e0631af0305 | 4180 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4181 | CV_EXPORTS_W void circle(InputOutputArray img, Point center, int radius, |
| RyoheiHagimoto | 0:0e0631af0305 | 4182 | const Scalar& color, int thickness = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 4183 | int lineType = LINE_8, int shift = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4184 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4185 | /** @brief Draws a simple or thick elliptic arc or fills an ellipse sector. |
| RyoheiHagimoto | 0:0e0631af0305 | 4186 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4187 | The function cv::ellipse with less parameters draws an ellipse outline, a filled ellipse, an elliptic |
| RyoheiHagimoto | 0:0e0631af0305 | 4188 | arc, or a filled ellipse sector. A piecewise-linear curve is used to approximate the elliptic arc |
| RyoheiHagimoto | 0:0e0631af0305 | 4189 | boundary. If you need more control of the ellipse rendering, you can retrieve the curve using |
| RyoheiHagimoto | 0:0e0631af0305 | 4190 | ellipse2Poly and then render it with polylines or fill it with fillPoly . If you use the first |
| RyoheiHagimoto | 0:0e0631af0305 | 4191 | variant of the function and want to draw the whole ellipse, not an arc, pass startAngle=0 and |
| RyoheiHagimoto | 0:0e0631af0305 | 4192 | endAngle=360 . The figure below explains the meaning of the parameters. |
| RyoheiHagimoto | 0:0e0631af0305 | 4193 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4194 |  |
| RyoheiHagimoto | 0:0e0631af0305 | 4195 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4196 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4197 | @param center Center of the ellipse. |
| RyoheiHagimoto | 0:0e0631af0305 | 4198 | @param axes Half of the size of the ellipse main axes. |
| RyoheiHagimoto | 0:0e0631af0305 | 4199 | @param angle Ellipse rotation angle in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 4200 | @param startAngle Starting angle of the elliptic arc in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 4201 | @param endAngle Ending angle of the elliptic arc in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 4202 | @param color Ellipse color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4203 | @param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that |
| RyoheiHagimoto | 0:0e0631af0305 | 4204 | a filled ellipse sector is to be drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4205 | @param lineType Type of the ellipse boundary. See the line description. |
| RyoheiHagimoto | 0:0e0631af0305 | 4206 | @param shift Number of fractional bits in the coordinates of the center and values of axes. |
| RyoheiHagimoto | 0:0e0631af0305 | 4207 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4208 | CV_EXPORTS_W void ellipse(InputOutputArray img, Point center, Size axes, |
| RyoheiHagimoto | 0:0e0631af0305 | 4209 | double angle, double startAngle, double endAngle, |
| RyoheiHagimoto | 0:0e0631af0305 | 4210 | const Scalar& color, int thickness = 1, |
| RyoheiHagimoto | 0:0e0631af0305 | 4211 | int lineType = LINE_8, int shift = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4212 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4213 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 4214 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4215 | @param box Alternative ellipse representation via RotatedRect. This means that the function draws |
| RyoheiHagimoto | 0:0e0631af0305 | 4216 | an ellipse inscribed in the rotated rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4217 | @param color Ellipse color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4218 | @param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that |
| RyoheiHagimoto | 0:0e0631af0305 | 4219 | a filled ellipse sector is to be drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4220 | @param lineType Type of the ellipse boundary. See the line description. |
| RyoheiHagimoto | 0:0e0631af0305 | 4221 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4222 | CV_EXPORTS_W void ellipse(InputOutputArray img, const RotatedRect& box, const Scalar& color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4223 | int thickness = 1, int lineType = LINE_8); |
| RyoheiHagimoto | 0:0e0631af0305 | 4224 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4225 | /* ----------------------------------------------------------------------------------------- */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4226 | /* ADDING A SET OF PREDEFINED MARKERS WHICH COULD BE USED TO HIGHLIGHT POSITIONS IN AN IMAGE */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4227 | /* ----------------------------------------------------------------------------------------- */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4228 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4229 | //! Possible set of marker types used for the cv::drawMarker function |
| RyoheiHagimoto | 0:0e0631af0305 | 4230 | enum MarkerTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4231 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4232 | MARKER_CROSS = 0, //!< A crosshair marker shape |
| RyoheiHagimoto | 0:0e0631af0305 | 4233 | MARKER_TILTED_CROSS = 1, //!< A 45 degree tilted crosshair marker shape |
| RyoheiHagimoto | 0:0e0631af0305 | 4234 | MARKER_STAR = 2, //!< A star marker shape, combination of cross and tilted cross |
| RyoheiHagimoto | 0:0e0631af0305 | 4235 | MARKER_DIAMOND = 3, //!< A diamond marker shape |
| RyoheiHagimoto | 0:0e0631af0305 | 4236 | MARKER_SQUARE = 4, //!< A square marker shape |
| RyoheiHagimoto | 0:0e0631af0305 | 4237 | MARKER_TRIANGLE_UP = 5, //!< An upwards pointing triangle marker shape |
| RyoheiHagimoto | 0:0e0631af0305 | 4238 | MARKER_TRIANGLE_DOWN = 6 //!< A downwards pointing triangle marker shape |
| RyoheiHagimoto | 0:0e0631af0305 | 4239 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 4240 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4241 | /** @brief Draws a marker on a predefined position in an image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4242 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4243 | The function drawMarker draws a marker on a given position in the image. For the moment several |
| RyoheiHagimoto | 0:0e0631af0305 | 4244 | marker types are supported, see cv::MarkerTypes for more information. |
| RyoheiHagimoto | 0:0e0631af0305 | 4245 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4246 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4247 | @param position The point where the crosshair is positioned. |
| RyoheiHagimoto | 0:0e0631af0305 | 4248 | @param color Line color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4249 | @param markerType The specific type of marker you want to use, see cv::MarkerTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4250 | @param thickness Line thickness. |
| RyoheiHagimoto | 0:0e0631af0305 | 4251 | @param line_type Type of the line, see cv::LineTypes |
| RyoheiHagimoto | 0:0e0631af0305 | 4252 | @param markerSize The length of the marker axis [default = 20 pixels] |
| RyoheiHagimoto | 0:0e0631af0305 | 4253 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4254 | CV_EXPORTS_W void drawMarker(CV_IN_OUT Mat& img, Point position, const Scalar& color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4255 | int markerType = MARKER_CROSS, int markerSize=20, int thickness=1, |
| RyoheiHagimoto | 0:0e0631af0305 | 4256 | int line_type=8); |
| RyoheiHagimoto | 0:0e0631af0305 | 4257 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4258 | /* ----------------------------------------------------------------------------------------- */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4259 | /* END OF MARKER SECTION */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4260 | /* ----------------------------------------------------------------------------------------- */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4261 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4262 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4263 | CV_EXPORTS void fillConvexPoly(Mat& img, const Point* pts, int npts, |
| RyoheiHagimoto | 0:0e0631af0305 | 4264 | const Scalar& color, int lineType = LINE_8, |
| RyoheiHagimoto | 0:0e0631af0305 | 4265 | int shift = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4266 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4267 | /** @brief Fills a convex polygon. |
| RyoheiHagimoto | 0:0e0631af0305 | 4268 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4269 | The function fillConvexPoly draws a filled convex polygon. This function is much faster than the |
| RyoheiHagimoto | 0:0e0631af0305 | 4270 | function cv::fillPoly . It can fill not only convex polygons but any monotonic polygon without |
| RyoheiHagimoto | 0:0e0631af0305 | 4271 | self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line) |
| RyoheiHagimoto | 0:0e0631af0305 | 4272 | twice at the most (though, its top-most and/or the bottom edge could be horizontal). |
| RyoheiHagimoto | 0:0e0631af0305 | 4273 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4274 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4275 | @param points Polygon vertices. |
| RyoheiHagimoto | 0:0e0631af0305 | 4276 | @param color Polygon color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4277 | @param lineType Type of the polygon boundaries. See the line description. |
| RyoheiHagimoto | 0:0e0631af0305 | 4278 | @param shift Number of fractional bits in the vertex coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 4279 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4280 | CV_EXPORTS_W void fillConvexPoly(InputOutputArray img, InputArray points, |
| RyoheiHagimoto | 0:0e0631af0305 | 4281 | const Scalar& color, int lineType = LINE_8, |
| RyoheiHagimoto | 0:0e0631af0305 | 4282 | int shift = 0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4283 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4284 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4285 | CV_EXPORTS void fillPoly(Mat& img, const Point** pts, |
| RyoheiHagimoto | 0:0e0631af0305 | 4286 | const int* npts, int ncontours, |
| RyoheiHagimoto | 0:0e0631af0305 | 4287 | const Scalar& color, int lineType = LINE_8, int shift = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 4288 | Point offset = Point() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4289 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4290 | /** @brief Fills the area bounded by one or more polygons. |
| RyoheiHagimoto | 0:0e0631af0305 | 4291 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4292 | The function fillPoly fills an area bounded by several polygonal contours. The function can fill |
| RyoheiHagimoto | 0:0e0631af0305 | 4293 | complex areas, for example, areas with holes, contours with self-intersections (some of their |
| RyoheiHagimoto | 0:0e0631af0305 | 4294 | parts), and so forth. |
| RyoheiHagimoto | 0:0e0631af0305 | 4295 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4296 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4297 | @param pts Array of polygons where each polygon is represented as an array of points. |
| RyoheiHagimoto | 0:0e0631af0305 | 4298 | @param color Polygon color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4299 | @param lineType Type of the polygon boundaries. See the line description. |
| RyoheiHagimoto | 0:0e0631af0305 | 4300 | @param shift Number of fractional bits in the vertex coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 4301 | @param offset Optional offset of all points of the contours. |
| RyoheiHagimoto | 0:0e0631af0305 | 4302 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4303 | CV_EXPORTS_W void fillPoly(InputOutputArray img, InputArrayOfArrays pts, |
| RyoheiHagimoto | 0:0e0631af0305 | 4304 | const Scalar& color, int lineType = LINE_8, int shift = 0, |
| RyoheiHagimoto | 0:0e0631af0305 | 4305 | Point offset = Point() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4306 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4307 | /** @overload */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4308 | CV_EXPORTS void polylines(Mat& img, const Point* const* pts, const int* npts, |
| RyoheiHagimoto | 0:0e0631af0305 | 4309 | int ncontours, bool isClosed, const Scalar& color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4310 | int thickness = 1, int lineType = LINE_8, int shift = 0 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4311 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4312 | /** @brief Draws several polygonal curves. |
| RyoheiHagimoto | 0:0e0631af0305 | 4313 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4314 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4315 | @param pts Array of polygonal curves. |
| RyoheiHagimoto | 0:0e0631af0305 | 4316 | @param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed, |
| RyoheiHagimoto | 0:0e0631af0305 | 4317 | the function draws a line from the last vertex of each curve to its first vertex. |
| RyoheiHagimoto | 0:0e0631af0305 | 4318 | @param color Polyline color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4319 | @param thickness Thickness of the polyline edges. |
| RyoheiHagimoto | 0:0e0631af0305 | 4320 | @param lineType Type of the line segments. See the line description. |
| RyoheiHagimoto | 0:0e0631af0305 | 4321 | @param shift Number of fractional bits in the vertex coordinates. |
| RyoheiHagimoto | 0:0e0631af0305 | 4322 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4323 | The function polylines draws one or more polygonal curves. |
| RyoheiHagimoto | 0:0e0631af0305 | 4324 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4325 | CV_EXPORTS_W void polylines(InputOutputArray img, InputArrayOfArrays pts, |
| RyoheiHagimoto | 0:0e0631af0305 | 4326 | bool isClosed, const Scalar& color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4327 | int thickness = 1, int lineType = LINE_8, int shift = 0 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4328 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4329 | /** @example contours2.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 4330 | An example using the drawContour functionality |
| RyoheiHagimoto | 0:0e0631af0305 | 4331 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4332 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4333 | /** @example segment_objects.cpp |
| RyoheiHagimoto | 0:0e0631af0305 | 4334 | An example using drawContours to clean up a background segmentation result |
| RyoheiHagimoto | 0:0e0631af0305 | 4335 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4336 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4337 | /** @brief Draws contours outlines or filled contours. |
| RyoheiHagimoto | 0:0e0631af0305 | 4338 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4339 | The function draws contour outlines in the image if \f$\texttt{thickness} \ge 0\f$ or fills the area |
| RyoheiHagimoto | 0:0e0631af0305 | 4340 | bounded by the contours if \f$\texttt{thickness}<0\f$ . The example below shows how to retrieve |
| RyoheiHagimoto | 0:0e0631af0305 | 4341 | connected components from the binary image and label them: : |
| RyoheiHagimoto | 0:0e0631af0305 | 4342 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 4343 | #include "opencv2/imgproc.hpp" |
| RyoheiHagimoto | 0:0e0631af0305 | 4344 | #include "opencv2/highgui.hpp" |
| RyoheiHagimoto | 0:0e0631af0305 | 4345 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4346 | using namespace cv; |
| RyoheiHagimoto | 0:0e0631af0305 | 4347 | using namespace std; |
| RyoheiHagimoto | 0:0e0631af0305 | 4348 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4349 | int main( int argc, char** argv ) |
| RyoheiHagimoto | 0:0e0631af0305 | 4350 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4351 | Mat src; |
| RyoheiHagimoto | 0:0e0631af0305 | 4352 | // the first command-line parameter must be a filename of the binary |
| RyoheiHagimoto | 0:0e0631af0305 | 4353 | // (black-n-white) image |
| RyoheiHagimoto | 0:0e0631af0305 | 4354 | if( argc != 2 || !(src=imread(argv[1], 0)).data) |
| RyoheiHagimoto | 0:0e0631af0305 | 4355 | return -1; |
| RyoheiHagimoto | 0:0e0631af0305 | 4356 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4357 | Mat dst = Mat::zeros(src.rows, src.cols, CV_8UC3); |
| RyoheiHagimoto | 0:0e0631af0305 | 4358 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4359 | src = src > 1; |
| RyoheiHagimoto | 0:0e0631af0305 | 4360 | namedWindow( "Source", 1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4361 | imshow( "Source", src ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4362 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4363 | vector<vector<Point> > contours; |
| RyoheiHagimoto | 0:0e0631af0305 | 4364 | vector<Vec4i> hierarchy; |
| RyoheiHagimoto | 0:0e0631af0305 | 4365 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4366 | findContours( src, contours, hierarchy, |
| RyoheiHagimoto | 0:0e0631af0305 | 4367 | RETR_CCOMP, CHAIN_APPROX_SIMPLE ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4368 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4369 | // iterate through all the top-level contours, |
| RyoheiHagimoto | 0:0e0631af0305 | 4370 | // draw each connected component with its own random color |
| RyoheiHagimoto | 0:0e0631af0305 | 4371 | int idx = 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 4372 | for( ; idx >= 0; idx = hierarchy[idx][0] ) |
| RyoheiHagimoto | 0:0e0631af0305 | 4373 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4374 | Scalar color( rand()&255, rand()&255, rand()&255 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4375 | drawContours( dst, contours, idx, color, FILLED, 8, hierarchy ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4376 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 4377 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4378 | namedWindow( "Components", 1 ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4379 | imshow( "Components", dst ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4380 | waitKey(0); |
| RyoheiHagimoto | 0:0e0631af0305 | 4381 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 4382 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 4383 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4384 | @param image Destination image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4385 | @param contours All the input contours. Each contour is stored as a point vector. |
| RyoheiHagimoto | 0:0e0631af0305 | 4386 | @param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4387 | @param color Color of the contours. |
| RyoheiHagimoto | 0:0e0631af0305 | 4388 | @param thickness Thickness of lines the contours are drawn with. If it is negative (for example, |
| RyoheiHagimoto | 0:0e0631af0305 | 4389 | thickness=CV_FILLED ), the contour interiors are drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4390 | @param lineType Line connectivity. See cv::LineTypes. |
| RyoheiHagimoto | 0:0e0631af0305 | 4391 | @param hierarchy Optional information about hierarchy. It is only needed if you want to draw only |
| RyoheiHagimoto | 0:0e0631af0305 | 4392 | some of the contours (see maxLevel ). |
| RyoheiHagimoto | 0:0e0631af0305 | 4393 | @param maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4394 | If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function |
| RyoheiHagimoto | 0:0e0631af0305 | 4395 | draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This |
| RyoheiHagimoto | 0:0e0631af0305 | 4396 | parameter is only taken into account when there is hierarchy available. |
| RyoheiHagimoto | 0:0e0631af0305 | 4397 | @param offset Optional contour shift parameter. Shift all the drawn contours by the specified |
| RyoheiHagimoto | 0:0e0631af0305 | 4398 | \f$\texttt{offset}=(dx,dy)\f$ . |
| RyoheiHagimoto | 0:0e0631af0305 | 4399 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4400 | CV_EXPORTS_W void drawContours( InputOutputArray image, InputArrayOfArrays contours, |
| RyoheiHagimoto | 0:0e0631af0305 | 4401 | int contourIdx, const Scalar& color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4402 | int thickness = 1, int lineType = LINE_8, |
| RyoheiHagimoto | 0:0e0631af0305 | 4403 | InputArray hierarchy = noArray(), |
| RyoheiHagimoto | 0:0e0631af0305 | 4404 | int maxLevel = INT_MAX, Point offset = Point() ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4405 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4406 | /** @brief Clips the line against the image rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4407 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4408 | The function cv::clipLine calculates a part of the line segment that is entirely within the specified |
| RyoheiHagimoto | 0:0e0631af0305 | 4409 | rectangle. it returns false if the line segment is completely outside the rectangle. Otherwise, |
| RyoheiHagimoto | 0:0e0631af0305 | 4410 | it returns true . |
| RyoheiHagimoto | 0:0e0631af0305 | 4411 | @param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) . |
| RyoheiHagimoto | 0:0e0631af0305 | 4412 | @param pt1 First line point. |
| RyoheiHagimoto | 0:0e0631af0305 | 4413 | @param pt2 Second line point. |
| RyoheiHagimoto | 0:0e0631af0305 | 4414 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4415 | CV_EXPORTS bool clipLine(Size imgSize, CV_IN_OUT Point& pt1, CV_IN_OUT Point& pt2); |
| RyoheiHagimoto | 0:0e0631af0305 | 4416 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4417 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 4418 | @param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) . |
| RyoheiHagimoto | 0:0e0631af0305 | 4419 | @param pt1 First line point. |
| RyoheiHagimoto | 0:0e0631af0305 | 4420 | @param pt2 Second line point. |
| RyoheiHagimoto | 0:0e0631af0305 | 4421 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4422 | CV_EXPORTS bool clipLine(Size2l imgSize, CV_IN_OUT Point2l& pt1, CV_IN_OUT Point2l& pt2); |
| RyoheiHagimoto | 0:0e0631af0305 | 4423 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4424 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 4425 | @param imgRect Image rectangle. |
| RyoheiHagimoto | 0:0e0631af0305 | 4426 | @param pt1 First line point. |
| RyoheiHagimoto | 0:0e0631af0305 | 4427 | @param pt2 Second line point. |
| RyoheiHagimoto | 0:0e0631af0305 | 4428 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4429 | CV_EXPORTS_W bool clipLine(Rect imgRect, CV_OUT CV_IN_OUT Point& pt1, CV_OUT CV_IN_OUT Point& pt2); |
| RyoheiHagimoto | 0:0e0631af0305 | 4430 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4431 | /** @brief Approximates an elliptic arc with a polyline. |
| RyoheiHagimoto | 0:0e0631af0305 | 4432 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4433 | The function ellipse2Poly computes the vertices of a polyline that approximates the specified |
| RyoheiHagimoto | 0:0e0631af0305 | 4434 | elliptic arc. It is used by cv::ellipse. |
| RyoheiHagimoto | 0:0e0631af0305 | 4435 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4436 | @param center Center of the arc. |
| RyoheiHagimoto | 0:0e0631af0305 | 4437 | @param axes Half of the size of the ellipse main axes. See the ellipse for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 4438 | @param angle Rotation angle of the ellipse in degrees. See the ellipse for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 4439 | @param arcStart Starting angle of the elliptic arc in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 4440 | @param arcEnd Ending angle of the elliptic arc in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 4441 | @param delta Angle between the subsequent polyline vertices. It defines the approximation |
| RyoheiHagimoto | 0:0e0631af0305 | 4442 | accuracy. |
| RyoheiHagimoto | 0:0e0631af0305 | 4443 | @param pts Output vector of polyline vertices. |
| RyoheiHagimoto | 0:0e0631af0305 | 4444 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4445 | CV_EXPORTS_W void ellipse2Poly( Point center, Size axes, int angle, |
| RyoheiHagimoto | 0:0e0631af0305 | 4446 | int arcStart, int arcEnd, int delta, |
| RyoheiHagimoto | 0:0e0631af0305 | 4447 | CV_OUT std::vector<Point>& pts ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4448 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4449 | /** @overload |
| RyoheiHagimoto | 0:0e0631af0305 | 4450 | @param center Center of the arc. |
| RyoheiHagimoto | 0:0e0631af0305 | 4451 | @param axes Half of the size of the ellipse main axes. See the ellipse for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 4452 | @param angle Rotation angle of the ellipse in degrees. See the ellipse for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 4453 | @param arcStart Starting angle of the elliptic arc in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 4454 | @param arcEnd Ending angle of the elliptic arc in degrees. |
| RyoheiHagimoto | 0:0e0631af0305 | 4455 | @param delta Angle between the subsequent polyline vertices. It defines the approximation |
| RyoheiHagimoto | 0:0e0631af0305 | 4456 | accuracy. |
| RyoheiHagimoto | 0:0e0631af0305 | 4457 | @param pts Output vector of polyline vertices. |
| RyoheiHagimoto | 0:0e0631af0305 | 4458 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4459 | CV_EXPORTS void ellipse2Poly(Point2d center, Size2d axes, int angle, |
| RyoheiHagimoto | 0:0e0631af0305 | 4460 | int arcStart, int arcEnd, int delta, |
| RyoheiHagimoto | 0:0e0631af0305 | 4461 | CV_OUT std::vector<Point2d>& pts); |
| RyoheiHagimoto | 0:0e0631af0305 | 4462 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4463 | /** @brief Draws a text string. |
| RyoheiHagimoto | 0:0e0631af0305 | 4464 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4465 | The function putText renders the specified text string in the image. Symbols that cannot be rendered |
| RyoheiHagimoto | 0:0e0631af0305 | 4466 | using the specified font are replaced by question marks. See getTextSize for a text rendering code |
| RyoheiHagimoto | 0:0e0631af0305 | 4467 | example. |
| RyoheiHagimoto | 0:0e0631af0305 | 4468 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4469 | @param img Image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4470 | @param text Text string to be drawn. |
| RyoheiHagimoto | 0:0e0631af0305 | 4471 | @param org Bottom-left corner of the text string in the image. |
| RyoheiHagimoto | 0:0e0631af0305 | 4472 | @param fontFace Font type, see cv::HersheyFonts. |
| RyoheiHagimoto | 0:0e0631af0305 | 4473 | @param fontScale Font scale factor that is multiplied by the font-specific base size. |
| RyoheiHagimoto | 0:0e0631af0305 | 4474 | @param color Text color. |
| RyoheiHagimoto | 0:0e0631af0305 | 4475 | @param thickness Thickness of the lines used to draw a text. |
| RyoheiHagimoto | 0:0e0631af0305 | 4476 | @param lineType Line type. See the line for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 4477 | @param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, |
| RyoheiHagimoto | 0:0e0631af0305 | 4478 | it is at the top-left corner. |
| RyoheiHagimoto | 0:0e0631af0305 | 4479 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4480 | CV_EXPORTS_W void putText( InputOutputArray img, const String& text, Point org, |
| RyoheiHagimoto | 0:0e0631af0305 | 4481 | int fontFace, double fontScale, Scalar color, |
| RyoheiHagimoto | 0:0e0631af0305 | 4482 | int thickness = 1, int lineType = LINE_8, |
| RyoheiHagimoto | 0:0e0631af0305 | 4483 | bool bottomLeftOrigin = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4484 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4485 | /** @brief Calculates the width and height of a text string. |
| RyoheiHagimoto | 0:0e0631af0305 | 4486 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4487 | The function getTextSize calculates and returns the size of a box that contains the specified text. |
| RyoheiHagimoto | 0:0e0631af0305 | 4488 | That is, the following code renders some text, the tight box surrounding it, and the baseline: : |
| RyoheiHagimoto | 0:0e0631af0305 | 4489 | @code |
| RyoheiHagimoto | 0:0e0631af0305 | 4490 | String text = "Funny text inside the box"; |
| RyoheiHagimoto | 0:0e0631af0305 | 4491 | int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX; |
| RyoheiHagimoto | 0:0e0631af0305 | 4492 | double fontScale = 2; |
| RyoheiHagimoto | 0:0e0631af0305 | 4493 | int thickness = 3; |
| RyoheiHagimoto | 0:0e0631af0305 | 4494 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4495 | Mat img(600, 800, CV_8UC3, Scalar::all(0)); |
| RyoheiHagimoto | 0:0e0631af0305 | 4496 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4497 | int baseline=0; |
| RyoheiHagimoto | 0:0e0631af0305 | 4498 | Size textSize = getTextSize(text, fontFace, |
| RyoheiHagimoto | 0:0e0631af0305 | 4499 | fontScale, thickness, &baseline); |
| RyoheiHagimoto | 0:0e0631af0305 | 4500 | baseline += thickness; |
| RyoheiHagimoto | 0:0e0631af0305 | 4501 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4502 | // center the text |
| RyoheiHagimoto | 0:0e0631af0305 | 4503 | Point textOrg((img.cols - textSize.width)/2, |
| RyoheiHagimoto | 0:0e0631af0305 | 4504 | (img.rows + textSize.height)/2); |
| RyoheiHagimoto | 0:0e0631af0305 | 4505 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4506 | // draw the box |
| RyoheiHagimoto | 0:0e0631af0305 | 4507 | rectangle(img, textOrg + Point(0, baseline), |
| RyoheiHagimoto | 0:0e0631af0305 | 4508 | textOrg + Point(textSize.width, -textSize.height), |
| RyoheiHagimoto | 0:0e0631af0305 | 4509 | Scalar(0,0,255)); |
| RyoheiHagimoto | 0:0e0631af0305 | 4510 | // ... and the baseline first |
| RyoheiHagimoto | 0:0e0631af0305 | 4511 | line(img, textOrg + Point(0, thickness), |
| RyoheiHagimoto | 0:0e0631af0305 | 4512 | textOrg + Point(textSize.width, thickness), |
| RyoheiHagimoto | 0:0e0631af0305 | 4513 | Scalar(0, 0, 255)); |
| RyoheiHagimoto | 0:0e0631af0305 | 4514 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4515 | // then put the text itself |
| RyoheiHagimoto | 0:0e0631af0305 | 4516 | putText(img, text, textOrg, fontFace, fontScale, |
| RyoheiHagimoto | 0:0e0631af0305 | 4517 | Scalar::all(255), thickness, 8); |
| RyoheiHagimoto | 0:0e0631af0305 | 4518 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 4519 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4520 | @param text Input text string. |
| RyoheiHagimoto | 0:0e0631af0305 | 4521 | @param fontFace Font to use, see cv::HersheyFonts. |
| RyoheiHagimoto | 0:0e0631af0305 | 4522 | @param fontScale Font scale factor that is multiplied by the font-specific base size. |
| RyoheiHagimoto | 0:0e0631af0305 | 4523 | @param thickness Thickness of lines used to render the text. See putText for details. |
| RyoheiHagimoto | 0:0e0631af0305 | 4524 | @param[out] baseLine y-coordinate of the baseline relative to the bottom-most text |
| RyoheiHagimoto | 0:0e0631af0305 | 4525 | point. |
| RyoheiHagimoto | 0:0e0631af0305 | 4526 | @return The size of a box that contains the specified text. |
| RyoheiHagimoto | 0:0e0631af0305 | 4527 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4528 | @see cv::putText |
| RyoheiHagimoto | 0:0e0631af0305 | 4529 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4530 | CV_EXPORTS_W Size getTextSize(const String& text, int fontFace, |
| RyoheiHagimoto | 0:0e0631af0305 | 4531 | double fontScale, int thickness, |
| RyoheiHagimoto | 0:0e0631af0305 | 4532 | CV_OUT int* baseLine); |
| RyoheiHagimoto | 0:0e0631af0305 | 4533 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4534 | /** @brief Line iterator |
| RyoheiHagimoto | 0:0e0631af0305 | 4535 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4536 | The class is used to iterate over all the pixels on the raster line |
| RyoheiHagimoto | 0:0e0631af0305 | 4537 | segment connecting two specified points. |
| RyoheiHagimoto | 0:0e0631af0305 | 4538 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4539 | The class LineIterator is used to get each pixel of a raster line. It |
| RyoheiHagimoto | 0:0e0631af0305 | 4540 | can be treated as versatile implementation of the Bresenham algorithm |
| RyoheiHagimoto | 0:0e0631af0305 | 4541 | where you can stop at each pixel and do some extra processing, for |
| RyoheiHagimoto | 0:0e0631af0305 | 4542 | example, grab pixel values along the line or draw a line with an effect |
| RyoheiHagimoto | 0:0e0631af0305 | 4543 | (for example, with XOR operation). |
| RyoheiHagimoto | 0:0e0631af0305 | 4544 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4545 | The number of pixels along the line is stored in LineIterator::count. |
| RyoheiHagimoto | 0:0e0631af0305 | 4546 | The method LineIterator::pos returns the current position in the image: |
| RyoheiHagimoto | 0:0e0631af0305 | 4547 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4548 | @code{.cpp} |
| RyoheiHagimoto | 0:0e0631af0305 | 4549 | // grabs pixels along the line (pt1, pt2) |
| RyoheiHagimoto | 0:0e0631af0305 | 4550 | // from 8-bit 3-channel image to the buffer |
| RyoheiHagimoto | 0:0e0631af0305 | 4551 | LineIterator it(img, pt1, pt2, 8); |
| RyoheiHagimoto | 0:0e0631af0305 | 4552 | LineIterator it2 = it; |
| RyoheiHagimoto | 0:0e0631af0305 | 4553 | vector<Vec3b> buf(it.count); |
| RyoheiHagimoto | 0:0e0631af0305 | 4554 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4555 | for(int i = 0; i < it.count; i++, ++it) |
| RyoheiHagimoto | 0:0e0631af0305 | 4556 | buf[i] = *(const Vec3b)*it; |
| RyoheiHagimoto | 0:0e0631af0305 | 4557 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4558 | // alternative way of iterating through the line |
| RyoheiHagimoto | 0:0e0631af0305 | 4559 | for(int i = 0; i < it2.count; i++, ++it2) |
| RyoheiHagimoto | 0:0e0631af0305 | 4560 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4561 | Vec3b val = img.at<Vec3b>(it2.pos()); |
| RyoheiHagimoto | 0:0e0631af0305 | 4562 | CV_Assert(buf[i] == val); |
| RyoheiHagimoto | 0:0e0631af0305 | 4563 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 4564 | @endcode |
| RyoheiHagimoto | 0:0e0631af0305 | 4565 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4566 | class CV_EXPORTS LineIterator |
| RyoheiHagimoto | 0:0e0631af0305 | 4567 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4568 | public: |
| RyoheiHagimoto | 0:0e0631af0305 | 4569 | /** @brief intializes the iterator |
| RyoheiHagimoto | 0:0e0631af0305 | 4570 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4571 | creates iterators for the line connecting pt1 and pt2 |
| RyoheiHagimoto | 0:0e0631af0305 | 4572 | the line will be clipped on the image boundaries |
| RyoheiHagimoto | 0:0e0631af0305 | 4573 | the line is 8-connected or 4-connected |
| RyoheiHagimoto | 0:0e0631af0305 | 4574 | If leftToRight=true, then the iteration is always done |
| RyoheiHagimoto | 0:0e0631af0305 | 4575 | from the left-most point to the right most, |
| RyoheiHagimoto | 0:0e0631af0305 | 4576 | not to depend on the ordering of pt1 and pt2 parameters |
| RyoheiHagimoto | 0:0e0631af0305 | 4577 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4578 | LineIterator( const Mat& img, Point pt1, Point pt2, |
| RyoheiHagimoto | 0:0e0631af0305 | 4579 | int connectivity = 8, bool leftToRight = false ); |
| RyoheiHagimoto | 0:0e0631af0305 | 4580 | /** @brief returns pointer to the current pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 4581 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4582 | uchar* operator *(); |
| RyoheiHagimoto | 0:0e0631af0305 | 4583 | /** @brief prefix increment operator (++it). shifts iterator to the next pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 4584 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4585 | LineIterator& operator ++(); |
| RyoheiHagimoto | 0:0e0631af0305 | 4586 | /** @brief postfix increment operator (it++). shifts iterator to the next pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 4587 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4588 | LineIterator operator ++(int); |
| RyoheiHagimoto | 0:0e0631af0305 | 4589 | /** @brief returns coordinates of the current pixel |
| RyoheiHagimoto | 0:0e0631af0305 | 4590 | */ |
| RyoheiHagimoto | 0:0e0631af0305 | 4591 | Point pos() const; |
| RyoheiHagimoto | 0:0e0631af0305 | 4592 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4593 | uchar* ptr; |
| RyoheiHagimoto | 0:0e0631af0305 | 4594 | const uchar* ptr0; |
| RyoheiHagimoto | 0:0e0631af0305 | 4595 | int step, elemSize; |
| RyoheiHagimoto | 0:0e0631af0305 | 4596 | int err, count; |
| RyoheiHagimoto | 0:0e0631af0305 | 4597 | int minusDelta, plusDelta; |
| RyoheiHagimoto | 0:0e0631af0305 | 4598 | int minusStep, plusStep; |
| RyoheiHagimoto | 0:0e0631af0305 | 4599 | }; |
| RyoheiHagimoto | 0:0e0631af0305 | 4600 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4601 | //! @cond IGNORED |
| RyoheiHagimoto | 0:0e0631af0305 | 4602 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4603 | // === LineIterator implementation === |
| RyoheiHagimoto | 0:0e0631af0305 | 4604 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4605 | inline |
| RyoheiHagimoto | 0:0e0631af0305 | 4606 | uchar* LineIterator::operator *() |
| RyoheiHagimoto | 0:0e0631af0305 | 4607 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4608 | return ptr; |
| RyoheiHagimoto | 0:0e0631af0305 | 4609 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 4610 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4611 | inline |
| RyoheiHagimoto | 0:0e0631af0305 | 4612 | LineIterator& LineIterator::operator ++() |
| RyoheiHagimoto | 0:0e0631af0305 | 4613 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4614 | int mask = err < 0 ? -1 : 0; |
| RyoheiHagimoto | 0:0e0631af0305 | 4615 | err += minusDelta + (plusDelta & mask); |
| RyoheiHagimoto | 0:0e0631af0305 | 4616 | ptr += minusStep + (plusStep & mask); |
| RyoheiHagimoto | 0:0e0631af0305 | 4617 | return *this; |
| RyoheiHagimoto | 0:0e0631af0305 | 4618 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 4619 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4620 | inline |
| RyoheiHagimoto | 0:0e0631af0305 | 4621 | LineIterator LineIterator::operator ++(int) |
| RyoheiHagimoto | 0:0e0631af0305 | 4622 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4623 | LineIterator it = *this; |
| RyoheiHagimoto | 0:0e0631af0305 | 4624 | ++(*this); |
| RyoheiHagimoto | 0:0e0631af0305 | 4625 | return it; |
| RyoheiHagimoto | 0:0e0631af0305 | 4626 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 4627 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4628 | inline |
| RyoheiHagimoto | 0:0e0631af0305 | 4629 | Point LineIterator::pos() const |
| RyoheiHagimoto | 0:0e0631af0305 | 4630 | { |
| RyoheiHagimoto | 0:0e0631af0305 | 4631 | Point p; |
| RyoheiHagimoto | 0:0e0631af0305 | 4632 | p.y = (int)((ptr - ptr0)/step); |
| RyoheiHagimoto | 0:0e0631af0305 | 4633 | p.x = (int)(((ptr - ptr0) - p.y*step)/elemSize); |
| RyoheiHagimoto | 0:0e0631af0305 | 4634 | return p; |
| RyoheiHagimoto | 0:0e0631af0305 | 4635 | } |
| RyoheiHagimoto | 0:0e0631af0305 | 4636 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4637 | //! @endcond |
| RyoheiHagimoto | 0:0e0631af0305 | 4638 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4639 | //! @} imgproc_draw |
| RyoheiHagimoto | 0:0e0631af0305 | 4640 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4641 | //! @} imgproc |
| RyoheiHagimoto | 0:0e0631af0305 | 4642 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4643 | } // cv |
| RyoheiHagimoto | 0:0e0631af0305 | 4644 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4645 | #ifndef DISABLE_OPENCV_24_COMPATIBILITY |
| RyoheiHagimoto | 0:0e0631af0305 | 4646 | #include "opencv2/imgproc/imgproc_c.h" |
| RyoheiHagimoto | 0:0e0631af0305 | 4647 | #endif |
| RyoheiHagimoto | 0:0e0631af0305 | 4648 | |
| RyoheiHagimoto | 0:0e0631af0305 | 4649 | #endif |