2010-05-12 01:44:00 +08:00
|
|
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
|
|
|
//
|
|
|
|
// By downloading, copying, installing or using the software you agree to this license.
|
|
|
|
// If you do not agree to this license, do not download, install,
|
|
|
|
// copy or use the software.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// License Agreement
|
|
|
|
// For Open Source Computer Vision Library
|
|
|
|
//
|
|
|
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
|
|
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
|
|
|
// Third party copyrights are property of their respective owners.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
// are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistribution's of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
//
|
|
|
|
// * Redistribution's in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
//
|
|
|
|
// * The name of the copyright holders may not be used to endorse or promote products
|
|
|
|
// derived from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// This software is provided by the copyright holders and contributors "as is" and
|
|
|
|
// any express or implied warranties, including, but not limited to, the implied
|
|
|
|
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
|
|
|
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
|
|
|
// indirect, incidental, special, exemplary, or consequential damages
|
|
|
|
// (including, but not limited to, procurement of substitute goods or services;
|
|
|
|
// loss of use, data, or profits; or business interruption) however caused
|
|
|
|
// and on any theory of liability, whether in contract, strict liability,
|
|
|
|
// or tort (including negligence or otherwise) arising in any way out of
|
|
|
|
// the use of this software, even if advised of the possibility of such damage.
|
|
|
|
//
|
|
|
|
//M*/
|
|
|
|
|
|
|
|
#ifndef __OPENCV_IMGPROC_HPP__
|
|
|
|
#define __OPENCV_IMGPROC_HPP__
|
|
|
|
|
2013-03-29 16:59:55 +08:00
|
|
|
#include "opencv2/core.hpp"
|
|
|
|
|
2010-05-25 23:59:48 +08:00
|
|
|
/*! \namespace cv
|
|
|
|
Namespace where all the C++ OpenCV functionality resides
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
namespace cv
|
|
|
|
{
|
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
//! type of the kernel
|
|
|
|
enum { KERNEL_GENERAL = 0, // the kernel is generic. No any type of symmetry or other properties.
|
|
|
|
KERNEL_SYMMETRICAL = 1, // kernel[i] == kernel[ksize-i-1] , and the anchor is at the center
|
|
|
|
KERNEL_ASYMMETRICAL = 2, // kernel[i] == -kernel[ksize-i-1] , and the anchor is at the center
|
|
|
|
KERNEL_SMOOTH = 4, // all the kernel elements are non-negative and summed to 1
|
|
|
|
KERNEL_INTEGER = 8 // all the kernel coefficients are integer numbers
|
|
|
|
};
|
|
|
|
|
|
|
|
//! type of morphological operation
|
|
|
|
enum { MORPH_ERODE = 0,
|
|
|
|
MORPH_DILATE = 1,
|
|
|
|
MORPH_OPEN = 2,
|
|
|
|
MORPH_CLOSE = 3,
|
|
|
|
MORPH_GRADIENT = 4,
|
|
|
|
MORPH_TOPHAT = 5,
|
|
|
|
MORPH_BLACKHAT = 6
|
|
|
|
};
|
|
|
|
|
|
|
|
//! shape of the structuring element
|
|
|
|
enum { MORPH_RECT = 0,
|
|
|
|
MORPH_CROSS = 1,
|
|
|
|
MORPH_ELLIPSE = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
//! interpolation algorithm
|
|
|
|
enum { INTER_NEAREST = 0, //!< nearest neighbor interpolation
|
|
|
|
INTER_LINEAR = 1, //!< bilinear interpolation
|
|
|
|
INTER_CUBIC = 2, //!< bicubic interpolation
|
|
|
|
INTER_AREA = 3, //!< area-based (or super) interpolation
|
|
|
|
INTER_LANCZOS4 = 4, //!< Lanczos interpolation over 8x8 neighborhood
|
|
|
|
|
|
|
|
INTER_MAX = 7, //!< mask for interpolation codes
|
|
|
|
WARP_INVERSE_MAP = 16
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { INTER_BITS = 5,
|
|
|
|
INTER_BITS2 = INTER_BITS * 2,
|
|
|
|
INTER_TAB_SIZE = 1 << INTER_BITS,
|
|
|
|
INTER_TAB_SIZE2 = INTER_TAB_SIZE * INTER_TAB_SIZE
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Distance types for Distance Transform and M-estimators
|
|
|
|
enum { DIST_USER = -1, // User defined distance
|
|
|
|
DIST_L1 = 1, // distance = |x1-x2| + |y1-y2|
|
|
|
|
DIST_L2 = 2, // the simple euclidean distance
|
|
|
|
DIST_C = 3, // distance = max(|x1-x2|,|y1-y2|)
|
|
|
|
DIST_L12 = 4, // L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1))
|
|
|
|
DIST_FAIR = 5, // distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998
|
|
|
|
DIST_WELSCH = 6, // distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846
|
|
|
|
DIST_HUBER = 7 // distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Mask size for distance transform
|
|
|
|
enum { DIST_MASK_3 = 3,
|
|
|
|
DIST_MASK_5 = 5,
|
|
|
|
DIST_MASK_PRECISE = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
//! type of the threshold operation
|
|
|
|
enum { THRESH_BINARY = 0, // value = value > threshold ? max_value : 0
|
|
|
|
THRESH_BINARY_INV = 1, // value = value > threshold ? 0 : max_value
|
|
|
|
THRESH_TRUNC = 2, // value = value > threshold ? threshold : value
|
|
|
|
THRESH_TOZERO = 3, // value = value > threshold ? value : 0
|
|
|
|
THRESH_TOZERO_INV = 4, // value = value > threshold ? 0 : value
|
|
|
|
THRESH_MASK = 7,
|
|
|
|
THRESH_OTSU = 8 // use Otsu algorithm to choose the optimal threshold value
|
|
|
|
};
|
|
|
|
|
|
|
|
//! adaptive threshold algorithm
|
|
|
|
enum { ADAPTIVE_THRESH_MEAN_C = 0,
|
|
|
|
ADAPTIVE_THRESH_GAUSSIAN_C = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { PROJ_SPHERICAL_ORTHO = 0,
|
|
|
|
PROJ_SPHERICAL_EQRECT = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
//! class of the pixel in GrabCut algorithm
|
|
|
|
enum { GC_BGD = 0, //!< background
|
|
|
|
GC_FGD = 1, //!< foreground
|
|
|
|
GC_PR_BGD = 2, //!< most probably background
|
|
|
|
GC_PR_FGD = 3 //!< most probably foreground
|
|
|
|
};
|
|
|
|
|
|
|
|
//! GrabCut algorithm flags
|
|
|
|
enum { GC_INIT_WITH_RECT = 0,
|
|
|
|
GC_INIT_WITH_MASK = 1,
|
|
|
|
GC_EVAL = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
//! distanceTransform algorithm flags
|
|
|
|
enum { DIST_LABEL_CCOMP = 0,
|
|
|
|
DIST_LABEL_PIXEL = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
//! floodfill algorithm flags
|
|
|
|
enum { FLOODFILL_FIXED_RANGE = 1 << 16,
|
|
|
|
FLOODFILL_MASK_ONLY = 1 << 17
|
|
|
|
};
|
|
|
|
|
|
|
|
//! type of the template matching operation
|
|
|
|
enum { TM_SQDIFF = 0,
|
|
|
|
TM_SQDIFF_NORMED = 1,
|
|
|
|
TM_CCORR = 2,
|
|
|
|
TM_CCORR_NORMED = 3,
|
|
|
|
TM_CCOEFF = 4,
|
|
|
|
TM_CCOEFF_NORMED = 5
|
|
|
|
};
|
|
|
|
|
|
|
|
//! connected components algorithm output formats
|
|
|
|
enum { CC_STAT_LEFT = 0,
|
|
|
|
CC_STAT_TOP = 1,
|
|
|
|
CC_STAT_WIDTH = 2,
|
|
|
|
CC_STAT_HEIGHT = 3,
|
|
|
|
CC_STAT_AREA = 4,
|
|
|
|
CC_STAT_MAX = 5
|
|
|
|
};
|
|
|
|
|
|
|
|
//! mode of the contour retrieval algorithm
|
|
|
|
enum { RETR_EXTERNAL = 0, //!< retrieve only the most external (top-level) contours
|
|
|
|
RETR_LIST = 1, //!< retrieve all the contours without any hierarchical information
|
|
|
|
RETR_CCOMP = 2, //!< retrieve the connected components (that can possibly be nested)
|
|
|
|
RETR_TREE = 3, //!< retrieve all the contours and the whole hierarchy
|
|
|
|
RETR_FLOODFILL = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
//! the contour approximation algorithm
|
|
|
|
enum { CHAIN_APPROX_NONE = 1,
|
|
|
|
CHAIN_APPROX_SIMPLE = 2,
|
|
|
|
CHAIN_APPROX_TC89_L1 = 3,
|
|
|
|
CHAIN_APPROX_TC89_KCOS = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Variants of a Hough transform
|
|
|
|
enum { HOUGH_STANDARD = 0,
|
|
|
|
HOUGH_PROBABILISTIC = 1,
|
|
|
|
HOUGH_MULTI_SCALE = 2,
|
|
|
|
HOUGH_GRADIENT = 3
|
|
|
|
};
|
|
|
|
|
2013-07-14 17:56:22 +08:00
|
|
|
//! Variants of Line Segment Detector
|
2013-07-13 05:21:02 +08:00
|
|
|
enum lsd_refine_lvl
|
2013-07-14 17:56:22 +08:00
|
|
|
{ LSD_REFINE_NONE = 0,
|
|
|
|
LSD_REFINE_STD = 1,
|
2013-07-13 05:21:02 +08:00
|
|
|
LSD_REFINE_ADV = 2
|
|
|
|
};
|
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
//! Histogram comparison methods
|
|
|
|
enum { HISTCMP_CORREL = 0,
|
|
|
|
HISTCMP_CHISQR = 1,
|
|
|
|
HISTCMP_INTERSECT = 2,
|
|
|
|
HISTCMP_BHATTACHARYYA = 3,
|
|
|
|
HISTCMP_HELLINGER = HISTCMP_BHATTACHARYYA
|
|
|
|
};
|
|
|
|
|
|
|
|
//! the color conversion code
|
|
|
|
enum { COLOR_BGR2BGRA = 0,
|
|
|
|
COLOR_RGB2RGBA = COLOR_BGR2BGRA,
|
|
|
|
|
|
|
|
COLOR_BGRA2BGR = 1,
|
|
|
|
COLOR_RGBA2RGB = COLOR_BGRA2BGR,
|
|
|
|
|
|
|
|
COLOR_BGR2RGBA = 2,
|
|
|
|
COLOR_RGB2BGRA = COLOR_BGR2RGBA,
|
|
|
|
|
|
|
|
COLOR_RGBA2BGR = 3,
|
|
|
|
COLOR_BGRA2RGB = COLOR_RGBA2BGR,
|
|
|
|
|
|
|
|
COLOR_BGR2RGB = 4,
|
|
|
|
COLOR_RGB2BGR = COLOR_BGR2RGB,
|
|
|
|
|
|
|
|
COLOR_BGRA2RGBA = 5,
|
|
|
|
COLOR_RGBA2BGRA = COLOR_BGRA2RGBA,
|
|
|
|
|
|
|
|
COLOR_BGR2GRAY = 6,
|
|
|
|
COLOR_RGB2GRAY = 7,
|
|
|
|
COLOR_GRAY2BGR = 8,
|
|
|
|
COLOR_GRAY2RGB = COLOR_GRAY2BGR,
|
|
|
|
COLOR_GRAY2BGRA = 9,
|
|
|
|
COLOR_GRAY2RGBA = COLOR_GRAY2BGRA,
|
|
|
|
COLOR_BGRA2GRAY = 10,
|
|
|
|
COLOR_RGBA2GRAY = 11,
|
|
|
|
|
|
|
|
COLOR_BGR2BGR565 = 12,
|
|
|
|
COLOR_RGB2BGR565 = 13,
|
|
|
|
COLOR_BGR5652BGR = 14,
|
|
|
|
COLOR_BGR5652RGB = 15,
|
|
|
|
COLOR_BGRA2BGR565 = 16,
|
|
|
|
COLOR_RGBA2BGR565 = 17,
|
|
|
|
COLOR_BGR5652BGRA = 18,
|
|
|
|
COLOR_BGR5652RGBA = 19,
|
|
|
|
|
|
|
|
COLOR_GRAY2BGR565 = 20,
|
|
|
|
COLOR_BGR5652GRAY = 21,
|
|
|
|
|
|
|
|
COLOR_BGR2BGR555 = 22,
|
|
|
|
COLOR_RGB2BGR555 = 23,
|
|
|
|
COLOR_BGR5552BGR = 24,
|
|
|
|
COLOR_BGR5552RGB = 25,
|
|
|
|
COLOR_BGRA2BGR555 = 26,
|
|
|
|
COLOR_RGBA2BGR555 = 27,
|
|
|
|
COLOR_BGR5552BGRA = 28,
|
|
|
|
COLOR_BGR5552RGBA = 29,
|
|
|
|
|
|
|
|
COLOR_GRAY2BGR555 = 30,
|
|
|
|
COLOR_BGR5552GRAY = 31,
|
|
|
|
|
|
|
|
COLOR_BGR2XYZ = 32,
|
|
|
|
COLOR_RGB2XYZ = 33,
|
|
|
|
COLOR_XYZ2BGR = 34,
|
|
|
|
COLOR_XYZ2RGB = 35,
|
|
|
|
|
|
|
|
COLOR_BGR2YCrCb = 36,
|
|
|
|
COLOR_RGB2YCrCb = 37,
|
|
|
|
COLOR_YCrCb2BGR = 38,
|
|
|
|
COLOR_YCrCb2RGB = 39,
|
|
|
|
|
|
|
|
COLOR_BGR2HSV = 40,
|
|
|
|
COLOR_RGB2HSV = 41,
|
|
|
|
|
|
|
|
COLOR_BGR2Lab = 44,
|
|
|
|
COLOR_RGB2Lab = 45,
|
|
|
|
|
|
|
|
COLOR_BGR2Luv = 50,
|
|
|
|
COLOR_RGB2Luv = 51,
|
|
|
|
COLOR_BGR2HLS = 52,
|
|
|
|
COLOR_RGB2HLS = 53,
|
|
|
|
|
|
|
|
COLOR_HSV2BGR = 54,
|
|
|
|
COLOR_HSV2RGB = 55,
|
|
|
|
|
|
|
|
COLOR_Lab2BGR = 56,
|
|
|
|
COLOR_Lab2RGB = 57,
|
|
|
|
COLOR_Luv2BGR = 58,
|
|
|
|
COLOR_Luv2RGB = 59,
|
|
|
|
COLOR_HLS2BGR = 60,
|
|
|
|
COLOR_HLS2RGB = 61,
|
|
|
|
|
|
|
|
COLOR_BGR2HSV_FULL = 66,
|
|
|
|
COLOR_RGB2HSV_FULL = 67,
|
|
|
|
COLOR_BGR2HLS_FULL = 68,
|
|
|
|
COLOR_RGB2HLS_FULL = 69,
|
|
|
|
|
|
|
|
COLOR_HSV2BGR_FULL = 70,
|
|
|
|
COLOR_HSV2RGB_FULL = 71,
|
|
|
|
COLOR_HLS2BGR_FULL = 72,
|
|
|
|
COLOR_HLS2RGB_FULL = 73,
|
|
|
|
|
|
|
|
COLOR_LBGR2Lab = 74,
|
|
|
|
COLOR_LRGB2Lab = 75,
|
|
|
|
COLOR_LBGR2Luv = 76,
|
|
|
|
COLOR_LRGB2Luv = 77,
|
|
|
|
|
|
|
|
COLOR_Lab2LBGR = 78,
|
|
|
|
COLOR_Lab2LRGB = 79,
|
|
|
|
COLOR_Luv2LBGR = 80,
|
|
|
|
COLOR_Luv2LRGB = 81,
|
|
|
|
|
|
|
|
COLOR_BGR2YUV = 82,
|
|
|
|
COLOR_RGB2YUV = 83,
|
|
|
|
COLOR_YUV2BGR = 84,
|
|
|
|
COLOR_YUV2RGB = 85,
|
|
|
|
|
|
|
|
// YUV 4:2:0 family to RGB
|
|
|
|
COLOR_YUV2RGB_NV12 = 90,
|
|
|
|
COLOR_YUV2BGR_NV12 = 91,
|
|
|
|
COLOR_YUV2RGB_NV21 = 92,
|
|
|
|
COLOR_YUV2BGR_NV21 = 93,
|
|
|
|
COLOR_YUV420sp2RGB = COLOR_YUV2RGB_NV21,
|
|
|
|
COLOR_YUV420sp2BGR = COLOR_YUV2BGR_NV21,
|
|
|
|
|
|
|
|
COLOR_YUV2RGBA_NV12 = 94,
|
|
|
|
COLOR_YUV2BGRA_NV12 = 95,
|
|
|
|
COLOR_YUV2RGBA_NV21 = 96,
|
|
|
|
COLOR_YUV2BGRA_NV21 = 97,
|
|
|
|
COLOR_YUV420sp2RGBA = COLOR_YUV2RGBA_NV21,
|
|
|
|
COLOR_YUV420sp2BGRA = COLOR_YUV2BGRA_NV21,
|
|
|
|
|
|
|
|
COLOR_YUV2RGB_YV12 = 98,
|
|
|
|
COLOR_YUV2BGR_YV12 = 99,
|
|
|
|
COLOR_YUV2RGB_IYUV = 100,
|
|
|
|
COLOR_YUV2BGR_IYUV = 101,
|
|
|
|
COLOR_YUV2RGB_I420 = COLOR_YUV2RGB_IYUV,
|
|
|
|
COLOR_YUV2BGR_I420 = COLOR_YUV2BGR_IYUV,
|
|
|
|
COLOR_YUV420p2RGB = COLOR_YUV2RGB_YV12,
|
|
|
|
COLOR_YUV420p2BGR = COLOR_YUV2BGR_YV12,
|
|
|
|
|
|
|
|
COLOR_YUV2RGBA_YV12 = 102,
|
|
|
|
COLOR_YUV2BGRA_YV12 = 103,
|
|
|
|
COLOR_YUV2RGBA_IYUV = 104,
|
|
|
|
COLOR_YUV2BGRA_IYUV = 105,
|
|
|
|
COLOR_YUV2RGBA_I420 = COLOR_YUV2RGBA_IYUV,
|
|
|
|
COLOR_YUV2BGRA_I420 = COLOR_YUV2BGRA_IYUV,
|
|
|
|
COLOR_YUV420p2RGBA = COLOR_YUV2RGBA_YV12,
|
|
|
|
COLOR_YUV420p2BGRA = COLOR_YUV2BGRA_YV12,
|
|
|
|
|
|
|
|
COLOR_YUV2GRAY_420 = 106,
|
|
|
|
COLOR_YUV2GRAY_NV21 = COLOR_YUV2GRAY_420,
|
|
|
|
COLOR_YUV2GRAY_NV12 = COLOR_YUV2GRAY_420,
|
|
|
|
COLOR_YUV2GRAY_YV12 = COLOR_YUV2GRAY_420,
|
|
|
|
COLOR_YUV2GRAY_IYUV = COLOR_YUV2GRAY_420,
|
|
|
|
COLOR_YUV2GRAY_I420 = COLOR_YUV2GRAY_420,
|
|
|
|
COLOR_YUV420sp2GRAY = COLOR_YUV2GRAY_420,
|
|
|
|
COLOR_YUV420p2GRAY = COLOR_YUV2GRAY_420,
|
|
|
|
|
|
|
|
// YUV 4:2:2 family to RGB
|
|
|
|
COLOR_YUV2RGB_UYVY = 107,
|
|
|
|
COLOR_YUV2BGR_UYVY = 108,
|
|
|
|
//COLOR_YUV2RGB_VYUY = 109,
|
|
|
|
//COLOR_YUV2BGR_VYUY = 110,
|
|
|
|
COLOR_YUV2RGB_Y422 = COLOR_YUV2RGB_UYVY,
|
|
|
|
COLOR_YUV2BGR_Y422 = COLOR_YUV2BGR_UYVY,
|
|
|
|
COLOR_YUV2RGB_UYNV = COLOR_YUV2RGB_UYVY,
|
|
|
|
COLOR_YUV2BGR_UYNV = COLOR_YUV2BGR_UYVY,
|
|
|
|
|
|
|
|
COLOR_YUV2RGBA_UYVY = 111,
|
|
|
|
COLOR_YUV2BGRA_UYVY = 112,
|
|
|
|
//COLOR_YUV2RGBA_VYUY = 113,
|
|
|
|
//COLOR_YUV2BGRA_VYUY = 114,
|
|
|
|
COLOR_YUV2RGBA_Y422 = COLOR_YUV2RGBA_UYVY,
|
|
|
|
COLOR_YUV2BGRA_Y422 = COLOR_YUV2BGRA_UYVY,
|
|
|
|
COLOR_YUV2RGBA_UYNV = COLOR_YUV2RGBA_UYVY,
|
|
|
|
COLOR_YUV2BGRA_UYNV = COLOR_YUV2BGRA_UYVY,
|
|
|
|
|
|
|
|
COLOR_YUV2RGB_YUY2 = 115,
|
|
|
|
COLOR_YUV2BGR_YUY2 = 116,
|
|
|
|
COLOR_YUV2RGB_YVYU = 117,
|
|
|
|
COLOR_YUV2BGR_YVYU = 118,
|
|
|
|
COLOR_YUV2RGB_YUYV = COLOR_YUV2RGB_YUY2,
|
|
|
|
COLOR_YUV2BGR_YUYV = COLOR_YUV2BGR_YUY2,
|
|
|
|
COLOR_YUV2RGB_YUNV = COLOR_YUV2RGB_YUY2,
|
|
|
|
COLOR_YUV2BGR_YUNV = COLOR_YUV2BGR_YUY2,
|
|
|
|
|
|
|
|
COLOR_YUV2RGBA_YUY2 = 119,
|
|
|
|
COLOR_YUV2BGRA_YUY2 = 120,
|
|
|
|
COLOR_YUV2RGBA_YVYU = 121,
|
|
|
|
COLOR_YUV2BGRA_YVYU = 122,
|
|
|
|
COLOR_YUV2RGBA_YUYV = COLOR_YUV2RGBA_YUY2,
|
|
|
|
COLOR_YUV2BGRA_YUYV = COLOR_YUV2BGRA_YUY2,
|
|
|
|
COLOR_YUV2RGBA_YUNV = COLOR_YUV2RGBA_YUY2,
|
|
|
|
COLOR_YUV2BGRA_YUNV = COLOR_YUV2BGRA_YUY2,
|
|
|
|
|
|
|
|
COLOR_YUV2GRAY_UYVY = 123,
|
|
|
|
COLOR_YUV2GRAY_YUY2 = 124,
|
|
|
|
//CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY,
|
|
|
|
COLOR_YUV2GRAY_Y422 = COLOR_YUV2GRAY_UYVY,
|
|
|
|
COLOR_YUV2GRAY_UYNV = COLOR_YUV2GRAY_UYVY,
|
|
|
|
COLOR_YUV2GRAY_YVYU = COLOR_YUV2GRAY_YUY2,
|
|
|
|
COLOR_YUV2GRAY_YUYV = COLOR_YUV2GRAY_YUY2,
|
|
|
|
COLOR_YUV2GRAY_YUNV = COLOR_YUV2GRAY_YUY2,
|
|
|
|
|
|
|
|
// alpha premultiplication
|
|
|
|
COLOR_RGBA2mRGBA = 125,
|
|
|
|
COLOR_mRGBA2RGBA = 126,
|
|
|
|
|
|
|
|
// RGB to YUV 4:2:0 family
|
|
|
|
COLOR_RGB2YUV_I420 = 127,
|
|
|
|
COLOR_BGR2YUV_I420 = 128,
|
|
|
|
COLOR_RGB2YUV_IYUV = COLOR_RGB2YUV_I420,
|
|
|
|
COLOR_BGR2YUV_IYUV = COLOR_BGR2YUV_I420,
|
|
|
|
|
|
|
|
COLOR_RGBA2YUV_I420 = 129,
|
|
|
|
COLOR_BGRA2YUV_I420 = 130,
|
|
|
|
COLOR_RGBA2YUV_IYUV = COLOR_RGBA2YUV_I420,
|
|
|
|
COLOR_BGRA2YUV_IYUV = COLOR_BGRA2YUV_I420,
|
|
|
|
COLOR_RGB2YUV_YV12 = 131,
|
|
|
|
COLOR_BGR2YUV_YV12 = 132,
|
|
|
|
COLOR_RGBA2YUV_YV12 = 133,
|
|
|
|
COLOR_BGRA2YUV_YV12 = 134,
|
|
|
|
|
|
|
|
// Demosaicing
|
|
|
|
COLOR_BayerBG2BGR = 46,
|
|
|
|
COLOR_BayerGB2BGR = 47,
|
|
|
|
COLOR_BayerRG2BGR = 48,
|
|
|
|
COLOR_BayerGR2BGR = 49,
|
|
|
|
|
|
|
|
COLOR_BayerBG2RGB = COLOR_BayerRG2BGR,
|
|
|
|
COLOR_BayerGB2RGB = COLOR_BayerGR2BGR,
|
|
|
|
COLOR_BayerRG2RGB = COLOR_BayerBG2BGR,
|
|
|
|
COLOR_BayerGR2RGB = COLOR_BayerGB2BGR,
|
|
|
|
|
|
|
|
COLOR_BayerBG2GRAY = 86,
|
|
|
|
COLOR_BayerGB2GRAY = 87,
|
|
|
|
COLOR_BayerRG2GRAY = 88,
|
|
|
|
COLOR_BayerGR2GRAY = 89,
|
|
|
|
|
|
|
|
// Demosaicing using Variable Number of Gradients
|
|
|
|
COLOR_BayerBG2BGR_VNG = 62,
|
|
|
|
COLOR_BayerGB2BGR_VNG = 63,
|
|
|
|
COLOR_BayerRG2BGR_VNG = 64,
|
|
|
|
COLOR_BayerGR2BGR_VNG = 65,
|
|
|
|
|
|
|
|
COLOR_BayerBG2RGB_VNG = COLOR_BayerRG2BGR_VNG,
|
|
|
|
COLOR_BayerGB2RGB_VNG = COLOR_BayerGR2BGR_VNG,
|
|
|
|
COLOR_BayerRG2RGB_VNG = COLOR_BayerBG2BGR_VNG,
|
|
|
|
COLOR_BayerGR2RGB_VNG = COLOR_BayerGB2BGR_VNG,
|
|
|
|
|
|
|
|
// Edge-Aware Demosaicing
|
|
|
|
COLOR_BayerBG2BGR_EA = 135,
|
|
|
|
COLOR_BayerGB2BGR_EA = 136,
|
|
|
|
COLOR_BayerRG2BGR_EA = 137,
|
|
|
|
COLOR_BayerGR2BGR_EA = 138,
|
|
|
|
|
|
|
|
COLOR_BayerBG2RGB_EA = COLOR_BayerRG2BGR_EA,
|
|
|
|
COLOR_BayerGB2RGB_EA = COLOR_BayerGR2BGR_EA,
|
|
|
|
COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA,
|
|
|
|
COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA,
|
|
|
|
|
|
|
|
|
|
|
|
COLOR_COLORCVT_MAX = 139
|
|
|
|
};
|
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Base Class for 1D or Row-wise Filters
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
This is the base class for linear or non-linear filters that process 1D data.
|
|
|
|
In particular, such filters are used for the "horizontal" filtering parts in separable filters.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
Several functions in OpenCV return Ptr<BaseRowFilter> for the specific types of filters,
|
|
|
|
and those pointers can be used directly or within cv::FilterEngine.
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS BaseRowFilter
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
BaseRowFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~BaseRowFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the filtering operator. Must be overrided in the derived classes. The horizontal border interpolation is done outside of the class.
|
2013-04-06 22:16:51 +08:00
|
|
|
virtual void operator()(const uchar* src, uchar* dst, int width, int cn) = 0;
|
|
|
|
|
|
|
|
int ksize;
|
|
|
|
int anchor;
|
2010-05-12 01:44:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Base Class for Column-wise Filters
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
This is the base class for linear or non-linear filters that process columns of 2D arrays.
|
|
|
|
Such filters are used for the "vertical" filtering parts in separable filters.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
Several functions in OpenCV return Ptr<BaseColumnFilter> for the specific types of filters,
|
|
|
|
and those pointers can be used directly or within cv::FilterEngine.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
Unlike cv::BaseRowFilter, cv::BaseColumnFilter may have some context information,
|
|
|
|
i.e. box filter keeps the sliding sum of elements. To reset the state BaseColumnFilter::reset()
|
|
|
|
must be called (e.g. the method is called by cv::FilterEngine)
|
2012-05-29 18:36:19 +08:00
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS BaseColumnFilter
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
BaseColumnFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~BaseColumnFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the filtering operator. Must be overrided in the derived classes. The vertical border interpolation is done outside of the class.
|
2013-04-06 22:16:51 +08:00
|
|
|
virtual void operator()(const uchar** src, uchar* dst, int dststep, int dstcount, int width) = 0;
|
2010-05-25 22:57:10 +08:00
|
|
|
//! resets the internal buffers, if any
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void reset();
|
2013-04-06 22:16:51 +08:00
|
|
|
|
|
|
|
int ksize;
|
|
|
|
int anchor;
|
2010-05-12 01:44:00 +08:00
|
|
|
};
|
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Base Class for Non-Separable 2D Filters.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
This is the base class for linear or non-linear 2D filters.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
Several functions in OpenCV return Ptr<BaseFilter> for the specific types of filters,
|
|
|
|
and those pointers can be used directly or within cv::FilterEngine.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
Similar to cv::BaseColumnFilter, the class may have some context information,
|
|
|
|
that should be reset using BaseFilter::reset() method before processing the new array.
|
2012-05-29 18:36:19 +08:00
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS BaseFilter
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
BaseFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~BaseFilter();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the filtering operator. The horizontal and the vertical border interpolation is done outside of the class.
|
2013-04-06 22:16:51 +08:00
|
|
|
virtual void operator()(const uchar** src, uchar* dst, int dststep, int dstcount, int width, int cn) = 0;
|
2010-05-25 22:57:10 +08:00
|
|
|
//! resets the internal buffers, if any
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void reset();
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
Size ksize;
|
|
|
|
Point anchor;
|
|
|
|
};
|
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
/*!
|
|
|
|
The Main Class for Image Filtering.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
The class can be used to apply an arbitrary filtering operation to an image.
|
|
|
|
It contains all the necessary intermediate buffers, it computes extrapolated values
|
|
|
|
of the "virtual" pixels outside of the image etc.
|
|
|
|
Pointers to the initialized cv::FilterEngine instances
|
|
|
|
are returned by various OpenCV functions, such as cv::createSeparableLinearFilter(),
|
|
|
|
cv::createLinearFilter(), cv::createGaussianFilter(), cv::createDerivFilter(),
|
|
|
|
cv::createBoxFilter() and cv::createMorphologyFilter().
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
Using the class you can process large images by parts and build complex pipelines
|
|
|
|
that include filtering as some of the stages. If all you need is to apply some pre-defined
|
|
|
|
filtering operation, you may use cv::filter2D(), cv::erode(), cv::dilate() etc.
|
|
|
|
functions that create FilterEngine internally.
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
Here is the example on how to use the class to implement Laplacian operator, which is the sum of
|
|
|
|
second-order derivatives. More complex variant for different types is implemented in cv::Laplacian().
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
\code
|
|
|
|
void laplace_f(const Mat& src, Mat& dst)
|
|
|
|
{
|
|
|
|
CV_Assert( src.type() == CV_32F );
|
|
|
|
// make sure the destination array has the proper size and type
|
|
|
|
dst.create(src.size(), src.type());
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
// get the derivative and smooth kernels for d2I/dx2.
|
|
|
|
// for d2I/dy2 we could use the same kernels, just swapped
|
|
|
|
Mat kd, ks;
|
|
|
|
getSobelKernels( kd, ks, 2, 0, ksize, false, ktype );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
// let's process 10 source rows at once
|
|
|
|
int DELTA = std::min(10, src.rows);
|
|
|
|
Ptr<FilterEngine> Fxx = createSeparableLinearFilter(src.type(),
|
2012-05-29 18:36:19 +08:00
|
|
|
dst.type(), kd, ks, Point(-1,-1), 0, borderType, borderType, Scalar() );
|
2010-05-25 22:57:10 +08:00
|
|
|
Ptr<FilterEngine> Fyy = createSeparableLinearFilter(src.type(),
|
|
|
|
dst.type(), ks, kd, Point(-1,-1), 0, borderType, borderType, Scalar() );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
int y = Fxx->start(src), dsty = 0, dy = 0;
|
|
|
|
Fyy->start(src);
|
|
|
|
const uchar* sptr = src.data + y*src.step;
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
// allocate the buffers for the spatial image derivatives;
|
|
|
|
// the buffers need to have more than DELTA rows, because at the
|
|
|
|
// last iteration the output may take max(kd.rows-1,ks.rows-1)
|
|
|
|
// rows more than the input.
|
|
|
|
Mat Ixx( DELTA + kd.rows - 1, src.cols, dst.type() );
|
|
|
|
Mat Iyy( DELTA + kd.rows - 1, src.cols, dst.type() );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
// inside the loop we always pass DELTA rows to the filter
|
|
|
|
// (note that the "proceed" method takes care of possibe overflow, since
|
|
|
|
// it was given the actual image height in the "start" method)
|
|
|
|
// on output we can get:
|
|
|
|
// * < DELTA rows (the initial buffer accumulation stage)
|
|
|
|
// * = DELTA rows (settled state in the middle)
|
|
|
|
// * > DELTA rows (then the input image is over, but we generate
|
|
|
|
// "virtual" rows using the border mode and filter them)
|
|
|
|
// this variable number of output rows is dy.
|
|
|
|
// dsty is the current output row.
|
|
|
|
// sptr is the pointer to the first input row in the portion to process
|
|
|
|
for( ; dsty < dst.rows; sptr += DELTA*src.step, dsty += dy )
|
|
|
|
{
|
|
|
|
Fxx->proceed( sptr, (int)src.step, DELTA, Ixx.data, (int)Ixx.step );
|
|
|
|
dy = Fyy->proceed( sptr, (int)src.step, DELTA, d2y.data, (int)Iyy.step );
|
|
|
|
if( dy > 0 )
|
|
|
|
{
|
|
|
|
Mat dstripe = dst.rowRange(dsty, dsty + dy);
|
|
|
|
add(Ixx.rowRange(0, dy), Iyy.rowRange(0, dy), dstripe);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
\endcode
|
|
|
|
*/
|
2010-05-12 01:44:00 +08:00
|
|
|
class CV_EXPORTS FilterEngine
|
|
|
|
{
|
|
|
|
public:
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the default constructor
|
2010-05-12 01:44:00 +08:00
|
|
|
FilterEngine();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the full constructor. Either _filter2D or both _rowFilter and _columnFilter must be non-empty.
|
2010-05-12 01:44:00 +08:00
|
|
|
FilterEngine(const Ptr<BaseFilter>& _filter2D,
|
|
|
|
const Ptr<BaseRowFilter>& _rowFilter,
|
|
|
|
const Ptr<BaseColumnFilter>& _columnFilter,
|
|
|
|
int srcType, int dstType, int bufType,
|
2013-04-06 22:16:51 +08:00
|
|
|
int _rowBorderType = BORDER_REPLICATE,
|
|
|
|
int _columnBorderType = -1,
|
|
|
|
const Scalar& _borderValue = Scalar());
|
2010-05-25 22:57:10 +08:00
|
|
|
//! the destructor
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual ~FilterEngine();
|
2010-05-25 22:57:10 +08:00
|
|
|
//! reinitializes the engine. The previously assigned filters are released.
|
2010-05-12 01:44:00 +08:00
|
|
|
void init(const Ptr<BaseFilter>& _filter2D,
|
|
|
|
const Ptr<BaseRowFilter>& _rowFilter,
|
|
|
|
const Ptr<BaseColumnFilter>& _columnFilter,
|
|
|
|
int srcType, int dstType, int bufType,
|
2013-04-06 22:16:51 +08:00
|
|
|
int _rowBorderType = BORDER_REPLICATE,
|
|
|
|
int _columnBorderType = -1,
|
|
|
|
const Scalar& _borderValue = Scalar());
|
2012-05-29 18:36:19 +08:00
|
|
|
//! starts filtering of the specified ROI of an image of size wholeSize.
|
2013-04-06 22:16:51 +08:00
|
|
|
virtual int start(Size wholeSize, Rect roi, int maxBufRows = -1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! starts filtering of the specified ROI of the specified image.
|
2013-04-06 22:16:51 +08:00
|
|
|
virtual int start(const Mat& src, const Rect& srcRoi = Rect(0,0,-1,-1),
|
|
|
|
bool isolated = false, int maxBufRows = -1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! processes the next srcCount rows of the image.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual int proceed(const uchar* src, int srcStep, int srcCount,
|
|
|
|
uchar* dst, int dstStep);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies filter to the specified ROI of the image. if srcRoi=(0,0,-1,-1), the whole image is filtered.
|
2010-05-12 01:44:00 +08:00
|
|
|
virtual void apply( const Mat& src, Mat& dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
const Rect& srcRoi = Rect(0,0,-1,-1),
|
|
|
|
Point dstOfs = Point(0,0),
|
|
|
|
bool isolated = false);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns true if the filter is separable
|
2010-05-12 01:44:00 +08:00
|
|
|
bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
|
2012-05-29 18:36:19 +08:00
|
|
|
//! returns the number
|
2010-05-12 01:44:00 +08:00
|
|
|
int remainingInputRows() const;
|
|
|
|
int remainingOutputRows() const;
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
int srcType;
|
|
|
|
int dstType;
|
|
|
|
int bufType;
|
2010-05-12 01:44:00 +08:00
|
|
|
Size ksize;
|
|
|
|
Point anchor;
|
|
|
|
int maxWidth;
|
|
|
|
Size wholeSize;
|
|
|
|
Rect roi;
|
2013-04-06 22:16:51 +08:00
|
|
|
int dx1;
|
|
|
|
int dx2;
|
|
|
|
int rowBorderType;
|
|
|
|
int columnBorderType;
|
2013-02-25 00:14:01 +08:00
|
|
|
std::vector<int> borderTab;
|
2010-05-12 01:44:00 +08:00
|
|
|
int borderElemSize;
|
2013-02-25 00:14:01 +08:00
|
|
|
std::vector<uchar> ringBuf;
|
|
|
|
std::vector<uchar> srcRow;
|
|
|
|
std::vector<uchar> constBorderValue;
|
|
|
|
std::vector<uchar> constBorderRow;
|
2013-04-06 22:16:51 +08:00
|
|
|
int bufStep;
|
|
|
|
int startY;
|
|
|
|
int startY0;
|
|
|
|
int endY;
|
|
|
|
int rowCount;
|
|
|
|
int dstY;
|
2013-02-25 00:14:01 +08:00
|
|
|
std::vector<uchar*> rows;
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
Ptr<BaseFilter> filter2D;
|
|
|
|
Ptr<BaseRowFilter> rowFilter;
|
|
|
|
Ptr<BaseColumnFilter> columnFilter;
|
|
|
|
};
|
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
|
|
|
|
//! finds arbitrary template in the grayscale image using Generalized Hough Transform
|
|
|
|
//! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
|
|
|
|
//! 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.
|
|
|
|
class CV_EXPORTS GeneralizedHough : public Algorithm
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum { GHT_POSITION = 0,
|
|
|
|
GHT_SCALE = 1,
|
|
|
|
GHT_ROTATION = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
static Ptr<GeneralizedHough> create(int method);
|
|
|
|
|
|
|
|
virtual ~GeneralizedHough();
|
|
|
|
|
|
|
|
//! set template to search
|
|
|
|
void setTemplate(InputArray templ, int cannyThreshold = 100, Point templCenter = Point(-1, -1));
|
|
|
|
void setTemplate(InputArray edges, InputArray dx, InputArray dy, Point templCenter = Point(-1, -1));
|
|
|
|
|
|
|
|
//! find template on image
|
|
|
|
void detect(InputArray image, OutputArray positions, OutputArray votes = cv::noArray(), int cannyThreshold = 100);
|
|
|
|
void detect(InputArray edges, InputArray dx, InputArray dy, OutputArray positions, OutputArray votes = cv::noArray());
|
|
|
|
|
|
|
|
void release();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void setTemplateImpl(const Mat& edges, const Mat& dx, const Mat& dy, Point templCenter) = 0;
|
|
|
|
virtual void detectImpl(const Mat& edges, const Mat& dx, const Mat& dy, OutputArray positions, OutputArray votes) = 0;
|
|
|
|
virtual void releaseImpl() = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Mat edges_;
|
|
|
|
Mat dx_;
|
|
|
|
Mat dy_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class CV_EXPORTS CLAHE : public Algorithm
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void apply(InputArray src, OutputArray dst) = 0;
|
|
|
|
|
|
|
|
virtual void setClipLimit(double clipLimit) = 0;
|
|
|
|
virtual double getClipLimit() const = 0;
|
|
|
|
|
|
|
|
virtual void setTilesGridSize(Size tileGridSize) = 0;
|
|
|
|
virtual Size getTilesGridSize() const = 0;
|
|
|
|
|
|
|
|
virtual void collectGarbage() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class CV_EXPORTS_W Subdiv2D
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum { PTLOC_ERROR = -2,
|
|
|
|
PTLOC_OUTSIDE_RECT = -1,
|
|
|
|
PTLOC_INSIDE = 0,
|
|
|
|
PTLOC_VERTEX = 1,
|
|
|
|
PTLOC_ON_EDGE = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { NEXT_AROUND_ORG = 0x00,
|
|
|
|
NEXT_AROUND_DST = 0x22,
|
|
|
|
PREV_AROUND_ORG = 0x11,
|
|
|
|
PREV_AROUND_DST = 0x33,
|
|
|
|
NEXT_AROUND_LEFT = 0x13,
|
|
|
|
NEXT_AROUND_RIGHT = 0x31,
|
|
|
|
PREV_AROUND_LEFT = 0x20,
|
|
|
|
PREV_AROUND_RIGHT = 0x02
|
|
|
|
};
|
|
|
|
|
|
|
|
CV_WRAP Subdiv2D();
|
|
|
|
CV_WRAP Subdiv2D(Rect rect);
|
|
|
|
CV_WRAP void initDelaunay(Rect rect);
|
|
|
|
|
|
|
|
CV_WRAP int insert(Point2f pt);
|
|
|
|
CV_WRAP void insert(const std::vector<Point2f>& ptvec);
|
|
|
|
CV_WRAP int locate(Point2f pt, CV_OUT int& edge, CV_OUT int& vertex);
|
|
|
|
|
|
|
|
CV_WRAP int findNearest(Point2f pt, CV_OUT Point2f* nearestPt = 0);
|
|
|
|
CV_WRAP void getEdgeList(CV_OUT std::vector<Vec4f>& edgeList) const;
|
|
|
|
CV_WRAP void getTriangleList(CV_OUT std::vector<Vec6f>& triangleList) const;
|
|
|
|
CV_WRAP void getVoronoiFacetList(const std::vector<int>& idx, CV_OUT std::vector<std::vector<Point2f> >& facetList,
|
|
|
|
CV_OUT std::vector<Point2f>& facetCenters);
|
|
|
|
|
|
|
|
CV_WRAP Point2f getVertex(int vertex, CV_OUT int* firstEdge = 0) const;
|
|
|
|
|
|
|
|
CV_WRAP int getEdge( int edge, int nextEdgeType ) const;
|
|
|
|
CV_WRAP int nextEdge(int edge) const;
|
|
|
|
CV_WRAP int rotateEdge(int edge, int rotate) const;
|
|
|
|
CV_WRAP int symEdge(int edge) const;
|
|
|
|
CV_WRAP int edgeOrg(int edge, CV_OUT Point2f* orgpt = 0) const;
|
|
|
|
CV_WRAP int edgeDst(int edge, CV_OUT Point2f* dstpt = 0) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int newEdge();
|
|
|
|
void deleteEdge(int edge);
|
|
|
|
int newPoint(Point2f pt, bool isvirtual, int firstEdge = 0);
|
|
|
|
void deletePoint(int vtx);
|
|
|
|
void setEdgePoints( int edge, int orgPt, int dstPt );
|
|
|
|
void splice( int edgeA, int edgeB );
|
|
|
|
int connectEdges( int edgeA, int edgeB );
|
|
|
|
void swapEdges( int edge );
|
|
|
|
int isRightOf(Point2f pt, int edge) const;
|
|
|
|
void calcVoronoi();
|
|
|
|
void clearVoronoi();
|
|
|
|
void checkSubdiv() const;
|
|
|
|
|
|
|
|
struct CV_EXPORTS Vertex
|
|
|
|
{
|
|
|
|
Vertex();
|
|
|
|
Vertex(Point2f pt, bool _isvirtual, int _firstEdge=0);
|
|
|
|
bool isvirtual() const;
|
|
|
|
bool isfree() const;
|
|
|
|
|
|
|
|
int firstEdge;
|
|
|
|
int type;
|
|
|
|
Point2f pt;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CV_EXPORTS QuadEdge
|
|
|
|
{
|
|
|
|
QuadEdge();
|
|
|
|
QuadEdge(int edgeidx);
|
|
|
|
bool isfree() const;
|
|
|
|
|
|
|
|
int next[4];
|
|
|
|
int pt[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<Vertex> vtx;
|
|
|
|
std::vector<QuadEdge> qedges;
|
|
|
|
int freeQEdge;
|
|
|
|
int freePoint;
|
|
|
|
bool validGeometry;
|
|
|
|
|
|
|
|
int recentEdge;
|
|
|
|
Point2f topLeft;
|
|
|
|
Point2f bottomRight;
|
|
|
|
};
|
|
|
|
|
2013-07-13 05:21:02 +08:00
|
|
|
class CV_EXPORTS_W LSD
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an LSD object. Specifying scale, number of subdivisions for the image, should the lines be refined and other constants as follows:
|
|
|
|
*
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param _refine How should the lines found be refined?
|
2013-07-13 05:25:33 +08:00
|
|
|
* REFINE_NONE - No refinement applied.
|
2013-07-14 17:56:22 +08:00
|
|
|
* REFINE_STD - Standard refinement is applied. E.g. breaking arches into smaller line approximations.
|
|
|
|
* REFINE_ADV - Advanced refinement. Number of false alarms is calculated,
|
2013-07-13 05:21:02 +08:00
|
|
|
* lines are refined through increase of precision, decrement in size, etc.
|
|
|
|
* @param _scale The scale of the image that will be used to find the lines. Range (0..1].
|
|
|
|
* @param _sigma_scale Sigma for Gaussian filter is computed as sigma = _sigma_scale/_scale.
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param _quant Bound to the quantization error on the gradient norm.
|
2013-07-13 05:21:02 +08:00
|
|
|
* @param _ang_th Gradient angle tolerance in degrees.
|
|
|
|
* @param _log_eps Detection threshold: -log10(NFA) > _log_eps
|
|
|
|
* @param _density_th Minimal density of aligned region points in rectangle.
|
|
|
|
* @param _n_bins Number of bins in pseudo-ordering of gradient modulus.
|
|
|
|
*/
|
2013-07-14 17:56:22 +08:00
|
|
|
LSD(lsd_refine_lvl _refine = LSD_REFINE_STD, double _scale = 0.8,
|
|
|
|
double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5,
|
2013-07-13 05:21:02 +08:00
|
|
|
double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Detect lines in the input image with the specified ROI.
|
|
|
|
*
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param _image A grayscale(CV_8UC1) input image.
|
2013-07-13 05:21:02 +08:00
|
|
|
* @param _lines Return: A vector of Vec4i elements specifying the beginning and ending point of a line.
|
2013-07-14 17:56:22 +08:00
|
|
|
* Where Vec4i is (x1, y1, x2, y2), point 1 is the start, point 2 - end.
|
2013-07-13 05:21:02 +08:00
|
|
|
* Returned lines are strictly oriented depending on the gradient.
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param _roi Return: ROI of the image, where lines are to be found. If specified, the returning
|
2013-07-13 05:21:02 +08:00
|
|
|
* lines coordinates are image wise.
|
|
|
|
* @param width Return: Vector of widths of the regions, where the lines are found. E.g. Width of line.
|
|
|
|
* @param prec Return: Vector of precisions with which the lines are found.
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param nfa Return: Vector containing number of false alarms in the line region, with precision of 10%.
|
2013-07-13 05:21:02 +08:00
|
|
|
* The bigger the value, logarithmically better the detection.
|
|
|
|
* * -1 corresponds to 10 mean false alarms
|
|
|
|
* * 0 corresponds to 1 mean false alarm
|
|
|
|
* * 1 corresponds to 0.1 mean false alarms
|
|
|
|
*/
|
|
|
|
void detect(const cv::InputArray _image, cv::OutputArray _lines, cv::Rect _roi = cv::Rect(),
|
|
|
|
cv::OutputArray width = cv::noArray(), cv::OutputArray prec = cv::noArray(),
|
|
|
|
cv::OutputArray nfa = cv::noArray());
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw lines on the given canvas.
|
|
|
|
*
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param image The image, where lines will be drawn.
|
2013-07-13 05:21:02 +08:00
|
|
|
* Should have the size of the image, where the lines were found
|
|
|
|
* @param lines The lines that need to be drawn
|
2013-07-14 17:56:22 +08:00
|
|
|
*/
|
2013-07-13 05:21:02 +08:00
|
|
|
static void drawSegments(cv::Mat& image, const std::vector<cv::Vec4i>& lines);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw both vectors on the image canvas. Uses blue for lines 1 and red for lines 2.
|
|
|
|
*
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param image The image, where lines will be drawn.
|
2013-07-13 05:21:02 +08:00
|
|
|
* Should have the size of the image, where the lines were found
|
|
|
|
* @param lines1 The first lines that need to be drawn. Color - Blue.
|
|
|
|
* @param lines2 The second lines that need to be drawn. Color - Red.
|
|
|
|
* @return The number of mismatching pixels between lines1 and lines2.
|
|
|
|
*/
|
2013-07-13 09:09:14 +08:00
|
|
|
static int compareSegments(const cv::Size& size, const std::vector<cv::Vec4i>& lines1, const std::vector<cv::Vec4i> lines2, cv::Mat* image = 0);
|
2013-07-13 05:21:02 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
cv::Mat image;
|
|
|
|
cv::Mat_<double> scaled_image;
|
|
|
|
double *scaled_image_data;
|
2013-07-14 17:56:22 +08:00
|
|
|
cv::Mat_<double> angles; // in rads
|
2013-07-13 05:21:02 +08:00
|
|
|
double *angles_data;
|
|
|
|
cv::Mat_<double> modgrad;
|
|
|
|
double *modgrad_data;
|
|
|
|
cv::Mat_<uchar> used;
|
|
|
|
|
|
|
|
int img_width;
|
|
|
|
int img_height;
|
|
|
|
double LOG_NT;
|
|
|
|
|
|
|
|
cv::Rect roi;
|
|
|
|
int roix, roiy;
|
|
|
|
|
|
|
|
const double SCALE;
|
|
|
|
const lsd_refine_lvl doRefine;
|
|
|
|
const double SIGMA_SCALE;
|
|
|
|
const double QUANT;
|
|
|
|
const double ANG_TH;
|
|
|
|
const double LOG_EPS;
|
|
|
|
const double DENSITY_TH;
|
|
|
|
const int N_BINS;
|
|
|
|
|
|
|
|
struct RegionPoint {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
uchar* used;
|
|
|
|
double angle;
|
|
|
|
double modgrad;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct coorlist
|
|
|
|
{
|
|
|
|
cv::Point2i p;
|
|
|
|
struct coorlist* next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rect
|
|
|
|
{
|
|
|
|
double x1, y1, x2, y2; // first and second point of the line segment
|
|
|
|
double width; // rectangle width
|
|
|
|
double x, y; // center of the rectangle
|
|
|
|
double theta; // angle
|
|
|
|
double dx,dy; // (dx,dy) is vector oriented as the line segment
|
|
|
|
double prec; // tolerance angle
|
|
|
|
double p; // probability of a point with angle within 'prec'
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Detect lines in the whole input image.
|
|
|
|
*
|
|
|
|
* @param lines Return: A vector of Vec4i elements specifying the beginning and ending point of a line.
|
2013-07-14 17:56:22 +08:00
|
|
|
* Where Vec4i is (x1, y1, x2, y2), point 1 is the start, point 2 - end.
|
2013-07-13 05:21:02 +08:00
|
|
|
* Returned lines are strictly oriented depending on the gradient.
|
|
|
|
* @param widths Return: Vector of widths of the regions, where the lines are found. E.g. Width of line.
|
|
|
|
* @param precisions Return: Vector of precisions with which the lines are found.
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param nfas Return: Vector containing number of false alarms in the line region, with precision of 10%.
|
2013-07-13 05:21:02 +08:00
|
|
|
* The bigger the value, logarithmically better the detection.
|
|
|
|
* * -1 corresponds to 10 mean false alarms
|
|
|
|
* * 0 corresponds to 1 mean false alarm
|
|
|
|
* * 1 corresponds to 0.1 mean false alarms
|
|
|
|
*/
|
2013-07-14 17:56:22 +08:00
|
|
|
void flsd(std::vector<cv::Vec4i>& lines,
|
|
|
|
std::vector<double>* widths, std::vector<double>* precisions,
|
2013-07-13 05:21:02 +08:00
|
|
|
std::vector<double>* nfas);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finds the angles and the gradients of the image. Generates a list of pseudo ordered points.
|
|
|
|
*
|
|
|
|
* @param threshold The minimum value of the angle that is considered defined, otherwise NOTDEF
|
2013-07-14 19:29:56 +08:00
|
|
|
* @param n_bins The number of bins with which gradients are ordered by, using bucket sort.
|
2013-07-14 17:56:22 +08:00
|
|
|
* @param list Return: Vector of coordinate points that are pseudo ordered by magnitude.
|
2013-07-13 05:21:02 +08:00
|
|
|
* Pixels would be ordered by norm value, up to a precision given by max_grad/n_bins.
|
|
|
|
*/
|
|
|
|
void ll_angle(const double& threshold, const unsigned int& n_bins, std::vector<coorlist>& list);
|
|
|
|
|
|
|
|
/**
|
2013-07-14 17:56:22 +08:00
|
|
|
* Grow a region starting from point s with a defined precision,
|
2013-07-13 05:21:02 +08:00
|
|
|
* returning the containing points size and the angle of the gradients.
|
|
|
|
*
|
|
|
|
* @param s Starting point for the region.
|
|
|
|
* @param reg Return: Vector of points, that are part of the region
|
|
|
|
* @param reg_size Return: The size of the region.
|
|
|
|
* @param reg_angle Return: The mean angle of the region.
|
|
|
|
* @param prec The precision by which each region angle should be aligned to the mean.
|
|
|
|
*/
|
|
|
|
void region_grow(const cv::Point2i& s, std::vector<RegionPoint>& reg,
|
|
|
|
int& reg_size, double& reg_angle, const double& prec);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finds the bounding rotated rectangle of a region.
|
|
|
|
*
|
|
|
|
* @param reg The region of points, from which the rectangle to be constructed from.
|
|
|
|
* @param reg_size The number of points in the region.
|
|
|
|
* @param reg_angle The mean angle of the region.
|
|
|
|
* @param prec The precision by which points were found.
|
|
|
|
* @param p Probability of a point with angle within 'prec'.
|
|
|
|
* @param rec Return: The generated rectangle.
|
|
|
|
*/
|
|
|
|
void region2rect(const std::vector<RegionPoint>& reg, const int reg_size, const double reg_angle,
|
|
|
|
const double prec, const double p, rect& rec) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute region's angle as the principal inertia axis of the region.
|
|
|
|
* @return Regions angle.
|
|
|
|
*/
|
|
|
|
double get_theta(const std::vector<RegionPoint>& reg, const int& reg_size, const double& x,
|
|
|
|
const double& y, const double& reg_angle, const double& prec) const;
|
|
|
|
|
|
|
|
/**
|
2013-07-14 17:56:22 +08:00
|
|
|
* An estimation of the angle tolerance is performed by the standard deviation of the angle at points
|
|
|
|
* near the region's starting point. Then, a new region is grown starting from the same point, but using the
|
|
|
|
* estimated angle tolerance. If this fails to produce a rectangle with the right density of region points,
|
2013-07-13 05:21:02 +08:00
|
|
|
* 'reduce_region_radius' is called to try to satisfy this condition.
|
2013-07-14 17:56:22 +08:00
|
|
|
*/
|
2013-07-13 05:21:02 +08:00
|
|
|
bool refine(std::vector<RegionPoint>& reg, int& reg_size, double reg_angle,
|
|
|
|
const double prec, double p, rect& rec, const double& density_th);
|
|
|
|
|
|
|
|
/**
|
2013-07-14 17:56:22 +08:00
|
|
|
* Reduce the region size, by elimination the points far from the starting point, until that leads to
|
2013-07-13 05:21:02 +08:00
|
|
|
* rectangle with the right density of region points or to discard the region if too small.
|
|
|
|
*/
|
|
|
|
bool reduce_region_radius(std::vector<RegionPoint>& reg, int& reg_size, double reg_angle,
|
|
|
|
const double prec, double p, rect& rec, double density, const double& density_th);
|
|
|
|
|
2013-07-14 17:56:22 +08:00
|
|
|
/**
|
2013-07-13 05:21:02 +08:00
|
|
|
* Try some rectangles variations to improve NFA value. Only if the rectangle is not meaningful (i.e., log_nfa <= log_eps).
|
|
|
|
* @return The new NFA value.
|
|
|
|
*/
|
|
|
|
double rect_improve(rect& rec) const;
|
|
|
|
|
2013-07-14 17:56:22 +08:00
|
|
|
/**
|
2013-07-13 05:21:02 +08:00
|
|
|
* Calculates the number of correctly aligned points within the rectangle.
|
|
|
|
* @return The new NFA value.
|
|
|
|
*/
|
|
|
|
double rect_nfa(const rect& rec) const;
|
|
|
|
|
2013-07-14 17:56:22 +08:00
|
|
|
/**
|
2013-07-13 05:21:02 +08:00
|
|
|
* Computes the NFA values based on the total number of points, points that agree.
|
2013-07-14 17:56:22 +08:00
|
|
|
* n, k, p are the binomial parameters.
|
2013-07-13 05:21:02 +08:00
|
|
|
* @return The new NFA value.
|
|
|
|
*/
|
|
|
|
double nfa(const int& n, const int& k, const double& p) const;
|
|
|
|
|
2013-07-14 17:56:22 +08:00
|
|
|
/**
|
2013-07-13 05:21:02 +08:00
|
|
|
* Is the point at place 'address' aligned to angle theta, up to precision 'prec'?
|
|
|
|
* @return Whether the point is aligned.
|
|
|
|
*/
|
|
|
|
bool isAligned(const int& address, const double& theta, const double& prec) const;
|
|
|
|
};
|
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns type (one of KERNEL_*) of 1D or 2D kernel specified by its coefficients.
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS int getKernelType(InputArray kernel, Point anchor);
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the primitive row filter with the specified kernel
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType,
|
2011-06-06 22:51:27 +08:00
|
|
|
InputArray kernel, int anchor,
|
2010-05-12 01:44:00 +08:00
|
|
|
int symmetryType);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the primitive column filter with the specified kernel
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType,
|
2011-06-06 22:51:27 +08:00
|
|
|
InputArray kernel, int anchor,
|
2013-04-06 22:16:51 +08:00
|
|
|
int symmetryType, double delta = 0,
|
|
|
|
int bits = 0);
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2D filter with the specified kernel
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseFilter> getLinearFilter(int srcType, int dstType,
|
2011-06-06 22:51:27 +08:00
|
|
|
InputArray kernel,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1),
|
|
|
|
double delta = 0, int bits = 0);
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the separable linear filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType,
|
2011-06-06 22:51:27 +08:00
|
|
|
InputArray rowKernel, InputArray columnKernel,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1), double delta = 0,
|
|
|
|
int rowBorderType = BORDER_DEFAULT,
|
|
|
|
int columnBorderType = -1,
|
|
|
|
const Scalar& borderValue = Scalar());
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the non-separable linear filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createLinearFilter(int srcType, int dstType,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray kernel, Point _anchor = Point(-1,-1),
|
|
|
|
double delta = 0, int rowBorderType = BORDER_DEFAULT,
|
|
|
|
int columnBorderType = -1, const Scalar& borderValue = Scalar());
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the Gaussian kernel with the specified parameters
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype = CV_64F );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the Gaussian filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createGaussianFilter( int type, Size ksize,
|
2013-04-06 22:16:51 +08:00
|
|
|
double sigma1, double sigma2 = 0,
|
|
|
|
int borderType = BORDER_DEFAULT);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! initializes kernels of the generalized Sobel operator
|
2011-04-17 21:14:45 +08:00
|
|
|
CV_EXPORTS_W void getDerivKernels( OutputArray kx, OutputArray ky,
|
|
|
|
int dx, int dy, int ksize,
|
2013-04-06 22:16:51 +08:00
|
|
|
bool normalize = false, int ktype = CV_32F );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns filter engine for the generalized Sobel operator
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createDerivFilter( int srcType, int dstType,
|
|
|
|
int dx, int dy, int ksize,
|
2013-04-06 22:16:51 +08:00
|
|
|
int borderType = BORDER_DEFAULT );
|
|
|
|
|
2012-05-29 18:36:19 +08:00
|
|
|
//! returns horizontal 1D box filter
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType,
|
2013-04-06 22:16:51 +08:00
|
|
|
int ksize, int anchor = -1);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns vertical 1D box filter
|
2010-10-17 04:34:34 +08:00
|
|
|
CV_EXPORTS Ptr<BaseColumnFilter> getColumnSumFilter( int sumType, int dstType,
|
2013-04-06 22:16:51 +08:00
|
|
|
int ksize, int anchor = -1,
|
|
|
|
double scale = 1);
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns box filter engine
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createBoxFilter( int srcType, int dstType, Size ksize,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1),
|
|
|
|
bool normalize = true,
|
|
|
|
int borderType = BORDER_DEFAULT);
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2012-02-06 09:09:54 +08:00
|
|
|
//! returns the Gabor kernel with the specified parameters
|
|
|
|
CV_EXPORTS_W Mat getGaborKernel( Size ksize, double sigma, double theta, double lambd,
|
2013-04-06 22:16:51 +08:00
|
|
|
double gamma, double psi = CV_PI*0.5, int ktype = CV_64F );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns horizontal 1D morphological filter
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int anchor = -1);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns vertical 1D morphological filter
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor = -1);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2D morphological filter
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS Ptr<BaseFilter> getMorphologyFilter(int op, int type, InputArray kernel,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1));
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns "magic" border value for erosion and dilation. It is automatically transformed to Scalar::all(-DBL_MAX) for dilation.
|
2010-05-12 01:44:00 +08:00
|
|
|
static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns morphological filter engine. Only MORPH_ERODE and MORPH_DILATE are supported.
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, InputArray kernel,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1), int rowBorderType = BORDER_CONSTANT,
|
|
|
|
int columnBorderType = -1, const Scalar& borderValue = morphologyDefaultBorderValue());
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns structuring element of the specified shape and size
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor = Point(-1,-1));
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using median filter.
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void medianBlur( InputArray src, OutputArray dst, int ksize );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using Gaussian filter.
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W void GaussianBlur( InputArray src, OutputArray dst, Size ksize,
|
|
|
|
double sigmaX, double sigmaY = 0,
|
|
|
|
int borderType = BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using bilateral filter
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void bilateralFilter( InputArray src, OutputArray dst, int d,
|
2011-04-17 21:14:45 +08:00
|
|
|
double sigmaColor, double sigmaSpace,
|
2013-04-06 22:16:51 +08:00
|
|
|
int borderType = BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths the image using the box filter. Each pixel is processed in O(1) time
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth,
|
2013-04-06 22:16:51 +08:00
|
|
|
Size ksize, Point anchor = Point(-1,-1),
|
|
|
|
bool normalize = true,
|
|
|
|
int borderType = BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! a synonym for normalized box filter
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void blur( InputArray src, OutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
Size ksize, Point anchor = Point(-1,-1),
|
|
|
|
int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies non-separable 2D linear filter to the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray kernel, Point anchor = Point(-1,-1),
|
|
|
|
double delta = 0, int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies separable 2D linear filter to the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth,
|
|
|
|
InputArray kernelX, InputArray kernelY,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1),
|
|
|
|
double delta = 0, int borderType = BORDER_DEFAULT );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies generalized Sobel operator to the image
|
2011-06-18 18:03:01 +08:00
|
|
|
CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
|
2013-04-06 22:16:51 +08:00
|
|
|
int dx, int dy, int ksize = 3,
|
|
|
|
double scale = 1, double delta = 0,
|
|
|
|
int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies the vertical or horizontal Scharr operator to the image
|
2011-06-18 18:03:01 +08:00
|
|
|
CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth,
|
2013-04-06 22:16:51 +08:00
|
|
|
int dx, int dy, double scale = 1, double delta = 0,
|
|
|
|
int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies Laplacian operator to the image
|
2011-06-18 18:03:01 +08:00
|
|
|
CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth,
|
2013-04-06 22:16:51 +08:00
|
|
|
int ksize = 1, double scale = 1, double delta = 0,
|
|
|
|
int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies Canny edge detector and produces the edge map.
|
2011-06-18 18:03:01 +08:00
|
|
|
CV_EXPORTS_W void Canny( InputArray image, OutputArray edges,
|
|
|
|
double threshold1, double threshold2,
|
2013-04-06 22:16:51 +08:00
|
|
|
int apertureSize = 3, bool L2gradient = false );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
int blockSize, int ksize = 3,
|
|
|
|
int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes Harris cornerness criteria at each image pixel
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize,
|
2011-04-17 21:14:45 +08:00
|
|
|
int ksize, double k,
|
2013-04-06 22:16:51 +08:00
|
|
|
int borderType = BORDER_DEFAULT );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix.
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void cornerEigenValsAndVecs( InputArray src, OutputArray dst,
|
2011-04-17 21:14:45 +08:00
|
|
|
int blockSize, int ksize,
|
2013-04-06 22:16:51 +08:00
|
|
|
int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes another complex cornerness criteria at each pixel
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize,
|
2013-04-06 22:16:51 +08:00
|
|
|
int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria
|
2011-07-07 19:43:21 +08:00
|
|
|
CV_EXPORTS_W void cornerSubPix( InputArray image, InputOutputArray corners,
|
|
|
|
Size winSize, Size zeroZone,
|
|
|
|
TermCriteria criteria );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void goodFeaturesToTrack( InputArray image, OutputArray corners,
|
2010-05-12 01:44:00 +08:00
|
|
|
int maxCorners, double qualityLevel, double minDistance,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray mask = noArray(), int blockSize = 3,
|
|
|
|
bool useHarrisDetector = false, double k = 0.04 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! finds lines in the black-n-white image using the standard or pyramid Hough transform
|
2011-06-18 18:03:01 +08:00
|
|
|
CV_EXPORTS_W void HoughLines( InputArray image, OutputArray lines,
|
|
|
|
double rho, double theta, int threshold,
|
2013-04-06 22:16:51 +08:00
|
|
|
double srn = 0, double stn = 0 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! finds line segments in the black-n-white image using probabalistic Hough transform
|
2011-06-18 18:03:01 +08:00
|
|
|
CV_EXPORTS_W void HoughLinesP( InputArray image, OutputArray lines,
|
|
|
|
double rho, double theta, int threshold,
|
2013-04-06 22:16:51 +08:00
|
|
|
double minLineLength = 0, double maxLineGap = 0 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2012-05-29 18:36:19 +08:00
|
|
|
//! finds circles in the grayscale image using 2+1 gradient Hough transform
|
2011-06-18 18:03:01 +08:00
|
|
|
CV_EXPORTS_W void HoughCircles( InputArray image, OutputArray circles,
|
|
|
|
int method, double dp, double minDist,
|
2013-04-06 22:16:51 +08:00
|
|
|
double param1 = 100, double param2 = 100,
|
|
|
|
int minRadius = 0, int maxRadius = 0 );
|
2012-09-10 20:24:55 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! erodes the image (applies the local minimum operator)
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void erode( InputArray src, OutputArray dst, InputArray kernel,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1), int iterations = 1,
|
|
|
|
int borderType = BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue = morphologyDefaultBorderValue() );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! dilates the image (applies the local maximum operator)
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void dilate( InputArray src, OutputArray dst, InputArray kernel,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1), int iterations = 1,
|
|
|
|
int borderType = BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue = morphologyDefaultBorderValue() );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies an advanced morphological operation to the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void morphologyEx( InputArray src, OutputArray dst,
|
|
|
|
int op, InputArray kernel,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point anchor = Point(-1,-1), int iterations = 1,
|
|
|
|
int borderType = BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue = morphologyDefaultBorderValue() );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! resizes the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void resize( InputArray src, OutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
Size dsize, double fx = 0, double fy = 0,
|
|
|
|
int interpolation = INTER_LINEAR );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! warps the image using affine transformation
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void warpAffine( InputArray src, OutputArray dst,
|
|
|
|
InputArray M, Size dsize,
|
2013-04-06 22:16:51 +08:00
|
|
|
int flags = INTER_LINEAR,
|
|
|
|
int borderMode = BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue = Scalar());
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! warps the image using perspective transformation
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void warpPerspective( InputArray src, OutputArray dst,
|
|
|
|
InputArray M, Size dsize,
|
2013-04-06 22:16:51 +08:00
|
|
|
int flags = INTER_LINEAR,
|
|
|
|
int borderMode = BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue = Scalar());
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! warps the image using the precomputed maps. The maps are stored in either floating-point or integer fixed-point format
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void remap( InputArray src, OutputArray dst,
|
|
|
|
InputArray map1, InputArray map2,
|
2013-04-06 22:16:51 +08:00
|
|
|
int interpolation, int borderMode = BORDER_CONSTANT,
|
|
|
|
const Scalar& borderValue = Scalar());
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! converts maps for remap from floating-point to fixed-point format or backwards
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void convertMaps( InputArray map1, InputArray map2,
|
2011-04-17 21:14:45 +08:00
|
|
|
OutputArray dstmap1, OutputArray dstmap2,
|
2013-04-06 22:16:51 +08:00
|
|
|
int dstmap1type, bool nninterpolation = false );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2x3 affine transformation matrix for the planar rotation.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 3x3 perspective transformation for the corresponding 4 point pairs.
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns 2x3 affine transformation for the corresponding 3 point pairs.
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes 2x3 affine transformation matrix that is inverse to the specified 2x3 affine transformation.
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void invertAffineTransform( InputArray M, OutputArray iM );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2011-07-19 00:31:30 +08:00
|
|
|
CV_EXPORTS_W Mat getPerspectiveTransform( InputArray src, InputArray dst );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2011-07-19 00:31:30 +08:00
|
|
|
CV_EXPORTS_W Mat getAffineTransform( InputArray src, InputArray dst );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! extracts rectangle from the image at sub-pixel location
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void getRectSubPix( InputArray image, Size patchSize,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point2f center, OutputArray patch, int patchType = -1 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the integral image
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W void integral( InputArray src, OutputArray sum, int sdepth = -1 );
|
2011-06-18 18:03:01 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the integral image and integral for the squared image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_AS(integral2) void integral( InputArray src, OutputArray sum,
|
2013-04-06 22:16:51 +08:00
|
|
|
OutputArray sqsum, int sdepth = -1 );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the integral image, integral for the squared image and the tilted integral image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_AS(integral3) void integral( InputArray src, OutputArray sum,
|
2011-04-17 21:14:45 +08:00
|
|
|
OutputArray sqsum, OutputArray tilted,
|
2013-04-06 22:16:51 +08:00
|
|
|
int sdepth = -1 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adds image to the accumulator (dst += src). Unlike cv::add, dst and src can have different types.
|
2011-07-16 17:35:56 +08:00
|
|
|
CV_EXPORTS_W void accumulate( InputArray src, InputOutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray mask = noArray() );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adds squared src image to the accumulator (dst += src*src).
|
2011-07-16 17:35:56 +08:00
|
|
|
CV_EXPORTS_W void accumulateSquare( InputArray src, InputOutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray mask = noArray() );
|
2010-05-25 22:57:10 +08:00
|
|
|
//! adds product of the 2 images to the accumulator (dst += src1*src2).
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void accumulateProduct( InputArray src1, InputArray src2,
|
2011-07-16 17:35:56 +08:00
|
|
|
InputOutputArray dst, InputArray mask=noArray() );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! updates the running average (dst = dst*(1-alpha) + src*alpha)
|
2011-07-16 17:35:56 +08:00
|
|
|
CV_EXPORTS_W void accumulateWeighted( InputArray src, InputOutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
double alpha, InputArray mask = noArray() );
|
2011-09-27 23:17:00 +08:00
|
|
|
|
2012-06-22 21:34:03 +08:00
|
|
|
CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray window = noArray(), CV_OUT double* response = 0);
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W void createHanningWindow(OutputArray dst, Size winSize, int type);
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies fixed threshold to the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W double threshold( InputArray src, OutputArray dst,
|
2011-04-17 21:14:45 +08:00
|
|
|
double thresh, double maxval, int type );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! applies variable (adaptive) threshold to the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void adaptiveThreshold( InputArray src, OutputArray dst,
|
2011-04-17 21:14:45 +08:00
|
|
|
double maxValue, int adaptiveMethod,
|
|
|
|
int thresholdType, int blockSize, double C );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! smooths and downsamples the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void pyrDown( InputArray src, OutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
const Size& dstsize = Size(), int borderType = BORDER_DEFAULT );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! upsamples and smoothes the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void pyrUp( InputArray src, OutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
const Size& dstsize = Size(), int borderType = BORDER_DEFAULT );
|
2011-04-17 21:14:45 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! builds the gaussian pyramid using pyrDown() as a basic operation
|
2012-03-31 00:58:24 +08:00
|
|
|
CV_EXPORTS void buildPyramid( InputArray src, OutputArrayOfArrays dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
int maxlevel, int borderType = BORDER_DEFAULT );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! corrects lens distortion for the given camera matrix and distortion coefficients
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void undistort( InputArray src, OutputArray dst,
|
|
|
|
InputArray cameraMatrix,
|
|
|
|
InputArray distCoeffs,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray newCameraMatrix = noArray() );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! initializes maps for cv::remap() to correct lens distortion and optionally rectify the image
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void initUndistortRectifyMap( InputArray cameraMatrix, InputArray distCoeffs,
|
|
|
|
InputArray R, InputArray newCameraMatrix,
|
2011-04-17 21:14:45 +08:00
|
|
|
Size size, int m1type, OutputArray map1, OutputArray map2 );
|
2010-08-06 18:20:49 +08:00
|
|
|
|
|
|
|
//! initializes maps for cv::remap() for wide-angle
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W float initWideAngleProjMap( InputArray cameraMatrix, InputArray distCoeffs,
|
2011-04-17 21:14:45 +08:00
|
|
|
Size imageSize, int destImageWidth,
|
|
|
|
int m1type, OutputArray map1, OutputArray map2,
|
2013-04-06 22:16:51 +08:00
|
|
|
int projType = PROJ_SPHERICAL_EQRECT, double alpha = 0);
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true)
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W Mat getDefaultNewCameraMatrix( InputArray cameraMatrix, Size imgsize = Size(),
|
|
|
|
bool centerPrincipalPoint = false );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! returns points' coordinates after lens distortion correction
|
2012-03-14 15:37:48 +08:00
|
|
|
CV_EXPORTS_W void undistortPoints( InputArray src, OutputArray dst,
|
|
|
|
InputArray cameraMatrix, InputArray distCoeffs,
|
2013-04-06 22:16:51 +08:00
|
|
|
InputArray R = noArray(), InputArray P = noArray());
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the joint dense histogram for a set of images.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcHist( const Mat* images, int nimages,
|
2011-06-06 22:51:27 +08:00
|
|
|
const int* channels, InputArray mask,
|
2011-04-17 21:14:45 +08:00
|
|
|
OutputArray hist, int dims, const int* histSize,
|
2013-04-06 22:16:51 +08:00
|
|
|
const float** ranges, bool uniform = true, bool accumulate = false );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the joint sparse histogram for a set of images.
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcHist( const Mat* images, int nimages,
|
2011-06-06 22:51:27 +08:00
|
|
|
const int* channels, InputArray mask,
|
2010-10-28 02:26:39 +08:00
|
|
|
SparseMat& hist, int dims,
|
|
|
|
const int* histSize, const float** ranges,
|
2013-04-06 22:16:51 +08:00
|
|
|
bool uniform = true, bool accumulate = false );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2011-07-19 00:31:30 +08:00
|
|
|
CV_EXPORTS_W void calcHist( InputArrayOfArrays images,
|
2013-02-25 00:14:01 +08:00
|
|
|
const std::vector<int>& channels,
|
2011-07-19 00:31:30 +08:00
|
|
|
InputArray mask, OutputArray hist,
|
2013-02-25 00:14:01 +08:00
|
|
|
const std::vector<int>& histSize,
|
|
|
|
const std::vector<float>& ranges,
|
2013-04-06 22:16:51 +08:00
|
|
|
bool accumulate = false );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! computes back projection for the set of images
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
|
2011-06-06 22:51:27 +08:00
|
|
|
const int* channels, InputArray hist,
|
2011-04-17 21:14:45 +08:00
|
|
|
OutputArray backProject, const float** ranges,
|
2013-04-06 22:16:51 +08:00
|
|
|
double scale = 1, bool uniform = true );
|
2010-05-25 22:57:10 +08:00
|
|
|
|
|
|
|
//! computes back projection for the set of images
|
2010-10-28 02:26:39 +08:00
|
|
|
CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
|
2012-05-29 18:36:19 +08:00
|
|
|
const int* channels, const SparseMat& hist,
|
2011-06-09 09:16:45 +08:00
|
|
|
OutputArray backProject, const float** ranges,
|
2013-04-06 22:16:51 +08:00
|
|
|
double scale = 1, bool uniform = true );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_EXPORTS_W void calcBackProject( InputArrayOfArrays images, const std::vector<int>& channels,
|
2011-07-19 00:31:30 +08:00
|
|
|
InputArray hist, OutputArray dst,
|
2013-02-25 00:14:01 +08:00
|
|
|
const std::vector<float>& ranges,
|
2011-07-19 00:31:30 +08:00
|
|
|
double scale );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! compares two histograms stored in dense arrays
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W double compareHist( InputArray H1, InputArray H2, int method );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! compares two histograms stored in sparse arrays
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! normalizes the grayscale image brightness and contrast by normalizing its histogram
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void equalizeHist( InputArray src, OutputArray dst );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS float EMD( InputArray signature1, InputArray signature2,
|
2011-06-08 14:55:04 +08:00
|
|
|
int distType, InputArray cost=noArray(),
|
2013-04-06 22:16:51 +08:00
|
|
|
float* lowerBound = 0, OutputArray flow = noArray() );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! segments the image using watershed algorithm
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void watershed( InputArray image, InputOutputArray markers );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-07-29 00:41:12 +08:00
|
|
|
//! filters image using meanshift algorithm
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void pyrMeanShiftFiltering( InputArray src, OutputArray dst,
|
2013-04-06 22:16:51 +08:00
|
|
|
double sp, double sr, int maxLevel = 1,
|
|
|
|
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! segments the image using GrabCut algorithm
|
2012-05-29 18:36:19 +08:00
|
|
|
CV_EXPORTS_W void grabCut( InputArray img, InputOutputArray mask, Rect rect,
|
2011-04-17 21:14:45 +08:00
|
|
|
InputOutputArray bgdModel, InputOutputArray fgdModel,
|
|
|
|
int iterCount, int mode = GC_EVAL );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! builds the discrete Voronoi diagram
|
2012-01-25 20:17:59 +08:00
|
|
|
CV_EXPORTS_AS(distanceTransformWithLabels) void distanceTransform( InputArray src, OutputArray dst,
|
2012-03-27 17:06:21 +08:00
|
|
|
OutputArray labels, int distanceType, int maskSize,
|
2013-04-06 22:16:51 +08:00
|
|
|
int labelType = DIST_LABEL_CCOMP );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the distance transform map
|
2012-01-25 20:17:59 +08:00
|
|
|
CV_EXPORTS_W void distanceTransform( InputArray src, OutputArray dst,
|
|
|
|
int distanceType, int maskSize );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fills the semi-uniform image region starting from the specified seed point
|
2011-04-17 21:14:45 +08:00
|
|
|
CV_EXPORTS int floodFill( InputOutputArray image,
|
2013-04-06 22:16:51 +08:00
|
|
|
Point seedPoint, Scalar newVal, CV_OUT Rect* rect = 0,
|
|
|
|
Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
|
|
|
|
int flags = 4 );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fills the semi-uniform image region and/or the mask starting from the specified seed point
|
2011-04-17 21:14:45 +08:00
|
|
|
CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask,
|
|
|
|
Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
|
2013-04-06 22:16:51 +08:00
|
|
|
Scalar loDiff = Scalar(), Scalar upDiff = Scalar(),
|
|
|
|
int flags = 4 );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! converts image from one color space to another
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W void cvtColor( InputArray src, OutputArray dst, int code, int dstCn = 0 );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
// main function for all demosaicing procceses
|
|
|
|
CV_EXPORTS_W void demosaicing(InputArray _src, OutputArray _dst, int code, int dcn = 0);
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes moments of the rasterized shape or a vector of points
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage = false );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes 7 Hu invariants from the moments
|
2010-05-12 01:44:00 +08:00
|
|
|
CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
|
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W void HuMoments( const Moments& m, OutputArray hu );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the proximity map for the raster template and the image where the template is searched for
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void matchTemplate( InputArray image, InputArray templ,
|
2011-04-17 21:14:45 +08:00
|
|
|
OutputArray result, int method );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2012-11-06 04:02:53 +08:00
|
|
|
|
2012-12-20 06:55:46 +08:00
|
|
|
// computes the connected components labeled image of boolean image ``image``
|
2012-12-16 03:14:50 +08:00
|
|
|
// with 4 or 8 way connectivity - returns N, the total
|
|
|
|
// number of labels [0, N-1] where 0 represents the background label.
|
2012-12-20 06:55:46 +08:00
|
|
|
// ltype specifies the output label image type, an important
|
2012-12-16 03:14:50 +08:00
|
|
|
// consideration based on the total number of labels or
|
2012-12-20 06:55:46 +08:00
|
|
|
// alternatively the total number of pixels in the source image.
|
2012-12-16 03:14:50 +08:00
|
|
|
CV_EXPORTS_W int connectedComponents(InputArray image, OutputArray labels,
|
2013-04-06 22:16:51 +08:00
|
|
|
int connectivity = 8, int ltype = CV_32S);
|
|
|
|
|
2012-12-16 03:14:50 +08:00
|
|
|
CV_EXPORTS_W int connectedComponentsWithStats(InputArray image, OutputArray labels,
|
|
|
|
OutputArray stats, OutputArray centroids,
|
2013-04-06 22:16:51 +08:00
|
|
|
int connectivity = 8, int ltype = CV_32S);
|
2012-08-25 14:57:17 +08:00
|
|
|
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! retrieves contours and the hierarchical information from black-n-white image.
|
2011-07-07 19:43:21 +08:00
|
|
|
CV_EXPORTS_W void findContours( InputOutputArray image, OutputArrayOfArrays contours,
|
2011-04-17 21:14:45 +08:00
|
|
|
OutputArray hierarchy, int mode,
|
2013-04-06 22:16:51 +08:00
|
|
|
int method, Point offset = Point());
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! retrieves contours from black-n-white image.
|
2011-04-17 21:14:45 +08:00
|
|
|
CV_EXPORTS void findContours( InputOutputArray image, OutputArrayOfArrays contours,
|
2013-04-06 22:16:51 +08:00
|
|
|
int mode, int method, Point offset = Point());
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! approximates contour or a curve using Douglas-Peucker algorithm
|
2011-07-07 19:43:21 +08:00
|
|
|
CV_EXPORTS_W void approxPolyDP( InputArray curve,
|
|
|
|
OutputArray approxCurve,
|
|
|
|
double epsilon, bool closed );
|
2011-04-17 21:14:45 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the contour perimeter (closed=true) or a curve length
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W double arcLength( InputArray curve, bool closed );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the bounding rectangle for a contour
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W Rect boundingRect( InputArray points );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the contour area
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS_W double contourArea( InputArray contour, bool oriented = false );
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the minimal rotated rectangle for a set of points
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W RotatedRect minAreaRect( InputArray points );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
Added cv2.boxPoints() functionality to Python bindings (Feature #2023)
http://www.code.opencv.org/issues/2023
eg:
In [3]: box = ((10,10),(5,5),0)
In [4]: cv2.boxPoints(box)
Out[4]:
array([[ 7.5, 12.5],
[ 7.5, 7.5],
[ 12.5, 7.5],
[ 12.5, 12.5]], dtype=float32)
2013-06-24 14:43:59 +08:00
|
|
|
//! computes boxpoints
|
|
|
|
CV_EXPORTS_W void boxPoints(RotatedRect box, OutputArray points);
|
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes the minimal enclosing circle for a set of points
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W void minEnclosingCircle( InputArray points,
|
2012-05-29 18:36:19 +08:00
|
|
|
CV_OUT Point2f& center, CV_OUT float& radius );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! matches two contours using one of the available algorithms
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
|
2011-04-17 21:14:45 +08:00
|
|
|
int method, double parameter );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! computes convex hull for a set of 2D points.
|
2011-07-07 19:43:21 +08:00
|
|
|
CV_EXPORTS_W void convexHull( InputArray points, OutputArray hull,
|
2013-04-06 22:16:51 +08:00
|
|
|
bool clockwise = false, bool returnPoints = true );
|
|
|
|
|
2012-03-30 03:42:47 +08:00
|
|
|
//! computes the contour convexity defects
|
2012-03-30 22:22:34 +08:00
|
|
|
CV_EXPORTS_W void convexityDefects( InputArray contour, InputArray convexhull, OutputArray convexityDefects );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2012-03-30 22:22:34 +08:00
|
|
|
//! returns true if the contour is convex. Does not support contours with self-intersection
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W bool isContourConvex( InputArray contour );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2011-11-08 20:01:49 +08:00
|
|
|
//! finds intersection of two convex polygons
|
|
|
|
CV_EXPORTS_W float intersectConvexConvex( InputArray _p1, InputArray _p2,
|
2013-04-06 22:16:51 +08:00
|
|
|
OutputArray _p12, bool handleNested = true );
|
2011-11-08 20:01:49 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fits ellipse to the set of 2D points
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
|
2010-05-12 01:44:00 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! fits line to the set of 2D points using M-estimator algorithm
|
2011-07-07 19:43:21 +08:00
|
|
|
CV_EXPORTS_W void fitLine( InputArray points, OutputArray line, int distType,
|
|
|
|
double param, double reps, double aeps );
|
2013-04-06 22:16:51 +08:00
|
|
|
|
2010-05-25 22:57:10 +08:00
|
|
|
//! checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary
|
2011-06-06 22:51:27 +08:00
|
|
|
CV_EXPORTS_W double pointPolygonTest( InputArray contour, Point2f pt, bool measureDist );
|
2012-05-29 18:36:19 +08:00
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
CV_EXPORTS Ptr<CLAHE> createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8));
|
2011-08-10 18:28:01 +08:00
|
|
|
|
2013-04-06 22:16:51 +08:00
|
|
|
} // cv
|
2010-05-12 01:44:00 +08:00
|
|
|
|
|
|
|
#endif
|