image_processing.rst 11.5 KB
Newer Older
wester committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
Image Processing
=============================

.. highlight:: cpp

ocl::meanShiftFiltering
---------------------------
Performs mean-shift filtering for each point of the source image.

.. ocv:function:: void ocl::meanShiftFiltering(const oclMat &src, oclMat &dst, int sp, int sr, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))

    :param src: Source image. Only  ``CV_8UC4`` images are supported for now.

    :param dst: Destination image containing the color of mapped points. It has the same size and type as  ``src`` .

    :param sp: Spatial window radius.

    :param sr: Color window radius.

    :param criteria: Termination criteria. See :ocv:class:`TermCriteria`.

It maps each point of the source image into another point. As a result, you have a new color and new position of each point.


ocl::meanShiftProc
----------------------
Performs a mean-shift procedure and stores information about processed points (their colors and positions) in two images.

.. ocv:function:: void ocl::meanShiftProc(const oclMat &src, oclMat &dstr, oclMat &dstsp, int sp, int sr, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))

    :param src: Source image. Only  ``CV_8UC4`` images are supported for now.

    :param dstr: Destination image containing the color of mapped points. The size and type is the same as  ``src`` .

    :param dstsp: Destination image containing the position of mapped points. The size is the same as  ``src`` size. The type is  ``CV_16SC2`` .

    :param sp: Spatial window radius.

    :param sr: Color window radius.

    :param criteria: Termination criteria. See :ocv:class:`TermCriteria`.

.. seealso:: :ocv:func:`ocl::meanShiftFiltering`


ocl::meanShiftSegmentation
------------------------------
Performs a mean-shift segmentation of the source image and eliminates small segments.

.. ocv:function:: void ocl::meanShiftSegmentation(const oclMat &src, Mat &dst, int sp, int sr, int minsize, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))

    :param src: Source image. Only  ``CV_8UC4`` images are supported for now.

    :param dst: Segmented image with the same size and type as  ``src`` .

    :param sp: Spatial window radius.

    :param sr: Color window radius.

    :param minsize: Minimum segment size. Smaller segments are merged.

    :param criteria: Termination criteria. See :ocv:class:`TermCriteria`.

ocl::integral
-----------------
Computes an integral image.

.. ocv:function:: void ocl::integral(const oclMat &src, oclMat &sum, oclMat &sqsum)

.. ocv:function:: void ocl::integral(const oclMat &src, oclMat &sum)

    :param src: Source image. Only  ``CV_8UC1`` images are supported for now.

    :param sum: Integral image containing 32-bit unsigned integer values packed into  ``CV_32SC1`` .

    :param sqsum: Sqsum values is ``CV_32FC1`` type.

.. seealso:: :ocv:func:`integral`

ocl::cornerHarris
---------------------
Returns void

.. ocv:function:: void ocl::cornerHarris(const oclMat &src, oclMat &dst, int blockSize, int ksize, double k, int bordertype = cv::BORDER_DEFAULT)

    :param src: Source image. Only CV_8UC1 and CV_32FC1 images are supported now.

    :param dst: Destination image containing cornerness values. It has the same size as src and CV_32FC1 type.

    :param blockSize: Neighborhood size

    :param ksize: Aperture parameter for the Sobel operator

    :param k: Harris detector free parameter

    :param bordertype: Pixel extrapolation method. Only BORDER_REFLECT101, BORDER_REFLECT, BORDER_CONSTANT and BORDER_REPLICATE are supported now.

Calculate Harris corner.

ocl::cornerMinEigenVal
--------------------------
Returns void

.. ocv:function:: void ocl::cornerMinEigenVal(const oclMat &src, oclMat &dst, int blockSize, int ksize, int bordertype = cv::BORDER_DEFAULT)

    :param src: Source image. Only CV_8UC1 and CV_32FC1 images are supported now.

    :param dst: Destination image containing cornerness values. It has the same size as src and CV_32FC1 type.

    :param blockSize: Neighborhood size

    :param ksize: Aperture parameter for the Sobel operator

    :param bordertype: Pixel extrapolation method. Only BORDER_REFLECT101, BORDER_REFLECT, BORDER_CONSTANT and BORDER_REPLICATE are supported now.

Calculate MinEigenVal.

ocl::calcHist
------------------
Returns void

.. ocv:function:: void ocl::calcHist(const oclMat &mat_src, oclMat &mat_hist)

    :param src: Source arrays. They all should have the same depth, CV 8U, and the same size. Each of them can have an arbitrary number of channels.

    :param dst: The output histogram, a dense or sparse dims-dimensional

Calculates histogram of one or more arrays. Supports only 8UC1 data type.

ocl::equalizeHist
---------------------
Equalizes the histogram of a grayscale image.

.. ocv:function:: void ocl::equalizeHist(const oclMat &mat_src, oclMat &mat_dst)

    :param mat_src: Source image.

    :param mat_dst: Destination image.

.. seealso:: :ocv:func:`equalizeHist`


ocl::remap
------------------
Returns void

.. ocv:function:: void ocl::remap(const oclMat &src, oclMat &dst, oclMat &map1, oclMat &map2, int interpolation, int bordertype, const Scalar &value = Scalar())

    :param src: Source image.

    :param dst: Destination image containing cornerness values. It has the same size as src and CV_32FC1 type.

    :param map1: The first map of either (x,y) points or just x values having the type CV_16SC2 , CV_32FC1 , or CV_32FC2 . See covertMaps() for details on converting a floating point representation to fixed-point for speed.

    :param map2: The second map of y values having the type CV_32FC1 , or none (empty map if map1 is (x,y) points), respectively.

    :param interpolation: The interpolation method

    :param bordertype: Pixel extrapolation method.

    :param value: The border value if borderType==BORDER CONSTANT

The function remap transforms the source image using the specified map: dst (x ,y) = src (map1(x , y) , map2(x , y)) where values of pixels with non-integer coordinates are computed using one of available interpolation methods. map1 and map2 can be encoded as separate floating-point maps in map1 and map2 respectively, or interleaved floating-point maps of (x,y) in map1.

ocl::resize
------------------
Returns void

.. ocv:function:: void ocl::resize(const oclMat &src, oclMat &dst, Size dsize, double fx = 0, double fy = 0, int interpolation = INTER_LINEAR)

    :param src: Source image.

    :param dst: Destination image.

    :param dsize: he destination image size. If it is zero, then it is computed as: dsize = Size(round(fx*src.cols), round(fy*src.rows)). Either dsize or both fx or fy must be non-zero.

    :param fx: The scale factor along the horizontal axis. When 0, it is computed as (double)dsize.width/src.cols

    :param fy: The scale factor along the vertical axis. When 0, it is computed as (double)dsize.height/src.rows

    :param interpolation: The interpolation method: INTER NEAREST or INTER LINEAR

Resizes an image. Supports CV_8UC1, CV_8UC3, CV_8UC4, CV_32FC1 , CV_32FC3 and CV_32FC4 data types.

ocl::warpAffine
-------------------
Returns void

.. ocv:function:: void ocl::warpAffine(const oclMat &src, oclMat &dst, const Mat &M, Size dsize, int flags = INTER_LINEAR)

    :param src: Source image.

    :param dst: Destination image.

    :param M: 2times 3 transformation matrix

    :param dsize: Size of the destination image

    :param flags: A combination of interpolation methods, see cv::resize, and the optional flag WARP INVERSE MAP that means that M is the inverse transformation (dst to $src)

The function warpAffine transforms the source image using the specified matrix. Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC types.

ocl::warpPerspective
------------------------
Returns void

.. ocv:function:: void ocl::warpPerspective(const oclMat &src, oclMat &dst, const Mat &M, Size dsize, int flags = INTER_LINEAR)

    :param src: Source image.

    :param dst: Destination image.

    :param M: 2times 3 transformation matrix

    :param dsize: Size of the destination image

    :param flags: A combination of interpolation methods, see cv::resize, and the optional flag WARP INVERSE MAP that means that M is the inverse transformation (dst to $src)

Applies a perspective transformation to an image. Supports INTER_NEAREST, INTER_LINEAR, INTER_CUBIC types.

ocl::cvtColor
------------------
Returns void

.. ocv:function:: void ocl::cvtColor(const oclMat &src, oclMat &dst, int code, int dcn = 0)

    :param src: Source image.

    :param dst: Destination image.

    :param code:The color space conversion code

    :param dcn: The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code

Converts image from one color space to another.For now, only RGB2GRAY is supportted. Supports.CV_8UC1,CV_8UC4,CV_32SC1,CV_32SC4,CV_32FC1,CV_32FC4

ocl::threshold
------------------
Returns Threshold value

.. ocv:function:: double ocl::threshold(const oclMat &src, oclMat &dst, double thresh, double maxVal, int type = THRESH_TRUNC)

    :param src: The source array

    :param dst: Destination array; will have the same size and the same type as src

    :param thresh: Threshold value

    :param maxVal: Maximum value to use with THRESH BINARY and THRESH BINARY INV thresholding types

    :param type: Thresholding type

The function applies fixed-level thresholding to a single-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image or for removing a noise, i.e. filtering out pixels with too small or too large values. There are several types of thresholding that the function supports that are determined by thresholdType.

ocl::buildWarpPlaneMaps
-----------------------
Builds plane warping maps.

.. ocv:function:: void ocl::buildWarpPlaneMaps( Size src_size, Rect dst_roi, const Mat& K, const Mat& R, const Mat& T, float scale, oclMat& map_x, oclMat& map_y )



ocl::buildWarpCylindricalMaps
-----------------------------
Builds cylindrical warping maps.

.. ocv:function:: void ocl::buildWarpCylindricalMaps( Size src_size, Rect dst_roi, const Mat& K, const Mat& R, float scale, oclMat& map_x, oclMat& map_y )




ocl::buildWarpSphericalMaps
---------------------------
Builds spherical warping maps.

.. ocv:function:: void ocl::buildWarpSphericalMaps( Size src_size, Rect dst_roi, const Mat& K, const Mat& R, float scale, oclMat& map_x, oclMat& map_y )


ocl::buildWarpPerspectiveMaps
-----------------------------
Builds transformation maps for perspective transformation.

.. ocv:function:: void ocl::buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, oclMat& xmap, oclMat& ymap)

    :param M: *3x3*  transformation matrix.

    :param inverse: Flag  specifying that  ``M`` is an inverse transformation ( ``dst=>src`` ).

    :param dsize: Size of the destination image.

    :param xmap: X values with  ``CV_32FC1`` type.

    :param ymap: Y values with  ``CV_32FC1`` type.

.. seealso:: :ocv:func:`ocl::warpPerspective` , :ocv:func:`ocl::remap`


ocl::buildWarpAffineMaps
----------------------------
Builds transformation maps for affine transformation.

.. ocv:function:: void ocl::buildWarpAffineMaps(const Mat& M, bool inverse, Size dsize, oclMat& xmap, oclMat& ymap)

    :param M: *2x3*  transformation matrix.

    :param inverse: Flag  specifying that  ``M`` is an inverse transformation ( ``dst=>src`` ).

    :param dsize: Size of the destination image.

    :param xmap: X values with  ``CV_32FC1`` type.

    :param ymap: Y values with  ``CV_32FC1`` type.

.. seealso:: :ocv:func:`ocl::warpAffine` , :ocv:func:`ocl::remap`