Commit 02f4f2f9 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #3426 from mshabunin:doxygen-imgproc

parents d368a7ce 555fdf89
...@@ -85,7 +85,7 @@ SHOW_FILES = YES ...@@ -85,7 +85,7 @@ SHOW_FILES = YES
SHOW_NAMESPACES = YES SHOW_NAMESPACES = YES
FILE_VERSION_FILTER = FILE_VERSION_FILTER =
LAYOUT_FILE = @CMAKE_DOXYGEN_LAYOUT@ LAYOUT_FILE = @CMAKE_DOXYGEN_LAYOUT@
CITE_BIB_FILES = CITE_BIB_FILES = @CMAKE_CURRENT_SOURCE_DIR@/opencv.bib
QUIET = YES QUIET = YES
WARNINGS = YES WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES WARN_IF_UNDOCUMENTED = YES
...@@ -100,7 +100,7 @@ RECURSIVE = YES ...@@ -100,7 +100,7 @@ RECURSIVE = YES
EXCLUDE = EXCLUDE =
EXCLUDE_SYMLINKS = NO EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = cv::DataType<*> EXCLUDE_SYMBOLS = cv::DataType<*> int
EXAMPLE_PATH = @CMAKE_DOXYGEN_EXAMPLE_PATH@ EXAMPLE_PATH = @CMAKE_DOXYGEN_EXAMPLE_PATH@
EXAMPLE_PATTERNS = * EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = YES EXAMPLE_RECURSIVE = YES
...@@ -159,8 +159,8 @@ QHG_LOCATION = ...@@ -159,8 +159,8 @@ QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 0 ENUM_VALUES_PER_LINE = 1
TREEVIEW_WIDTH = 250 TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = YES EXT_LINKS_IN_WINDOW = YES
FORMULA_FONTSIZE = 14 FORMULA_FONTSIZE = 14
......
MathJax.Hub.Config({ MathJax.Hub.Config(
TeX: { {
Macros: { TeX: {
matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9], Macros: {
fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4], matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6], fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3], forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9] vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
} vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
} hdotsfor: ["\\dots", 1]
}); }
}
}
);
...@@ -291,6 +291,108 @@ ...@@ -291,6 +291,108 @@
year = {2005} year = {2005}
} }
@inproceedings{Puzicha1997,
author = {Puzicha, Jan and Hofmann, Thomas and Buhmann, Joachim M.},
title = {Non-parametric Similarity Measures for Unsupervised Texture Segmentation and Image Retrieval},
booktitle = {Proceedings of the 1997 Conference on Computer Vision and Pattern Recognition (CVPR '97)},
series = {CVPR '97},
year = {1997},
isbn = {0-8186-7822-4},
pages = {267--},
url = {http://dl.acm.org/citation.cfm?id=794189.794386},
acmid = {794386},
publisher = {IEEE Computer Society},
address = {Washington, DC, USA},
}
@techreport{RubnerSept98,
author = {Rubner, Yossi and Tomasi, Carlo and Guibas, Leonidas J.},
title = {The Earth Mover's Distance As a Metric for Image Retrieval},
year = {1998},
source = {http://www.ncstrl.org:8900/ncstrl/servlet/search?formname=detail\&id=oai%3Ancstrlh%3Astan%3ASTAN%2F%2FCS-TN-98-86},
publisher = {Stanford University},
address = {Stanford, CA, USA},
}
@article{Rubner2000,
author = {Rubner, Yossi and Tomasi, Carlo and Guibas, Leonidas J.},
title = {The Earth Mover's Distance As a Metric for Image Retrieval},
journal = {Int. J. Comput. Vision},
issue_date = {Nov. 2000},
volume = {40},
number = {2},
month = nov,
year = {2000},
issn = {0920-5691},
pages = {99--121},
numpages = {23},
url = {http://dx.doi.org/10.1023/A:1026543900054},
doi = {10.1023/A:1026543900054},
acmid = {365881},
publisher = {Kluwer Academic Publishers},
address = {Hingham, MA, USA},
}
@article{Hu62,
author={Ming-Kuei Hu},
journal={Information Theory, IRE Transactions on},
title={Visual pattern recognition by moment invariants},
year={1962},
month={February},
volume={8},
number={2},
pages={179-187},
doi={10.1109/TIT.1962.1057692},
ISSN={0096-1000},
}
@inproceedings{Fitzgibbon95,
author = {Fitzgibbon, Andrew W. and Fisher, Robert B.},
title = {A Buyer's Guide to Conic Fitting},
booktitle = {Proceedings of the 6th British Conference on Machine Vision (Vol. 2)},
series = {BMVC '95},
year = {1995},
isbn = {0-9521898-2-8},
location = {Birmingham, United Kingdom},
pages = {513--522},
numpages = {10},
url = {http://dl.acm.org/citation.cfm?id=243124.243148},
acmid = {243148},
publisher = {BMVA Press},
address = {Surrey, UK, UK},
}
@article{KleeLaskowski85,
author = {Klee, Victor and Laskowski, Michael C.},
ee = {http://dx.doi.org/10.1016/0196-6774(85)90005-7},
journal = {J. Algorithms},
number = 3,
pages = {359-375},
title = {Finding the Smallest Triangles Containing a Given Convex Polygon.},
url = {http://dblp.uni-trier.de/db/journals/jal/jal6.html#KleeL85},
volume = 6,
year = 1985
}
@article{Canny86,
author = {Canny, J},
title = {A Computational Approach to Edge Detection},
journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
issue_date = {June 1986},
volume = {8},
number = {6},
month = jun,
year = {1986},
issn = {0162-8828},
pages = {679--698},
numpages = {20},
url = {http://dx.doi.org/10.1109/TPAMI.1986.4767851},
doi = {10.1109/TPAMI.1986.4767851},
acmid = {11275},
publisher = {IEEE Computer Society},
address = {Washington, DC, USA}
}
# '''[Bradski98]''' G.R. Bradski. Computer vision face tracking as a component of a perceptual user interface. In Workshop on Applications of Computer Vision, pages 214?219, Princeton, NJ, Oct. 1998.<<BR>> Updated version can be found at http://www.intel.com/technology/itj/q21998/articles/art\_2.htm.<<BR>> Also, it is included into OpenCV distribution ([[attachment:camshift.pdf]]) # '''[Bradski98]''' G.R. Bradski. Computer vision face tracking as a component of a perceptual user interface. In Workshop on Applications of Computer Vision, pages 214?219, Princeton, NJ, Oct. 1998.<<BR>> Updated version can be found at http://www.intel.com/technology/itj/q21998/articles/art\_2.htm.<<BR>> Also, it is included into OpenCV distribution ([[attachment:camshift.pdf]])
# '''[Burt81]''' P. J. Burt, T. H. Hong, A. Rosenfeld. Segmentation and Estimation of Image Region Properties Through Cooperative Hierarchical Computation. IEEE Tran. On SMC, Vol. 11, N.12, 1981, pp. 802-809. # '''[Burt81]''' P. J. Burt, T. H. Hong, A. Rosenfeld. Segmentation and Estimation of Image Region Properties Through Cooperative Hierarchical Computation. IEEE Tran. On SMC, Vol. 11, N.12, 1981, pp. 802-809.
# '''[Canny86]''' J. Canny. A Computational Approach to Edge Detection, IEEE Trans. on Pattern Analysis and Machine Intelligence, 8(6), pp. 679-698 (1986). # '''[Canny86]''' J. Canny. A Computational Approach to Edge Detection, IEEE Trans. on Pattern Analysis and Machine Intelligence, 8(6), pp. 679-698 (1986).
......
OpenCV modules {#mainpage} OpenCV modules {#mainpage}
============== ==============
- @subpage intro @subpage intro
- @subpage core
Module name | Folder
------------- | -------------
@ref core | core
@ref imgproc | imgproc
<!-- @CMAKE_DOXYGEN_MODULES_REFERENCE@ --> <!-- @CMAKE_DOXYGEN_MODULES_REFERENCE@ -->
...@@ -11,7 +11,7 @@ libraries. The following modules are available: ...@@ -11,7 +11,7 @@ libraries. The following modules are available:
- @ref core - a compact module defining basic data structures, including the dense - @ref core - a compact module defining basic data structures, including the dense
multi-dimensional array Mat and basic functions used by all other modules. multi-dimensional array Mat and basic functions used by all other modules.
- **imgproc** - an image processing module that includes linear and non-linear image filtering, - @ref imgproc - an image processing module that includes linear and non-linear image filtering,
geometrical image transformations (resize, affine and perspective warping, generic table-based geometrical image transformations (resize, affine and perspective warping, generic table-based
remapping), color space conversion, histograms, and so on. remapping), color space conversion, histograms, and so on.
- **video** - a video analysis module that includes motion estimation, background subtraction, - **video** - a video analysis module that includes motion estimation, background subtraction,
......
...@@ -194,22 +194,27 @@ enum KmeansFlags { ...@@ -194,22 +194,27 @@ enum KmeansFlags {
KMEANS_USE_INITIAL_LABELS = 1 KMEANS_USE_INITIAL_LABELS = 1
}; };
enum { FILLED = -1, //! type of line
LINE_4 = 4, enum LineTypes {
LINE_8 = 8, FILLED = -1,
LINE_AA = 16 LINE_4 = 4, //!< 4-connected line
}; LINE_8 = 8, //!< 8-connected line
LINE_AA = 16 //!< antialiased line
enum { FONT_HERSHEY_SIMPLEX = 0, };
FONT_HERSHEY_PLAIN = 1,
FONT_HERSHEY_DUPLEX = 2, //! Only a subset of Hershey fonts
FONT_HERSHEY_COMPLEX = 3, //! <http://sources.isc.org/utils/misc/hershey-font.txt> are supported
FONT_HERSHEY_TRIPLEX = 4, enum HersheyFonts {
FONT_HERSHEY_COMPLEX_SMALL = 5, FONT_HERSHEY_SIMPLEX = 0, //!< normal size sans-serif font
FONT_HERSHEY_SCRIPT_SIMPLEX = 6, FONT_HERSHEY_PLAIN = 1, //!< small size sans-serif font
FONT_HERSHEY_SCRIPT_COMPLEX = 7, FONT_HERSHEY_DUPLEX = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
FONT_ITALIC = 16 FONT_HERSHEY_COMPLEX = 3, //!< normal size serif font
}; FONT_HERSHEY_TRIPLEX = 4, //!< normal size serif font (more complex than FONT_HERSHEY_COMPLEX)
FONT_HERSHEY_COMPLEX_SMALL = 5, //!< smaller version of FONT_HERSHEY_COMPLEX
FONT_HERSHEY_SCRIPT_SIMPLEX = 6, //!< hand-writing style font
FONT_HERSHEY_SCRIPT_COMPLEX = 7, //!< more complex variant of FONT_HERSHEY_SCRIPT_SIMPLEX
FONT_ITALIC = 16 //!< flag for italic font
};
enum ReduceTypes { REDUCE_SUM = 0, //!< the output is the sum of all rows/columns of the matrix. enum ReduceTypes { REDUCE_SUM = 0, //!< the output is the sum of all rows/columns of the matrix.
REDUCE_AVG = 1, //!< the output is the mean vector of all rows/columns of the matrix. REDUCE_AVG = 1, //!< the output is the mean vector of all rows/columns of the matrix.
...@@ -2696,78 +2701,6 @@ CV_EXPORTS_W double kmeans( InputArray data, int K, InputOutputArray bestLabels, ...@@ -2696,78 +2701,6 @@ CV_EXPORTS_W double kmeans( InputArray data, int K, InputOutputArray bestLabels,
//! @} core_cluster //! @} core_cluster
//! @addtogroup imgproc_drawing
//! @{
/*! @brief Line iterator
The class is used to iterate over all the pixels on the raster line
segment connecting two specified points.
The class LineIterator is used to get each pixel of a raster line. It
can be treated as versatile implementation of the Bresenham algorithm
where you can stop at each pixel and do some extra processing, for
example, grab pixel values along the line or draw a line with an effect
(for example, with XOR operation).
The number of pixels along the line is stored in LineIterator::count.
The method LineIterator::pos returns the current position in the image:
@code{.cpp}
// grabs pixels along the line (pt1, pt2)
// from 8-bit 3-channel image to the buffer
LineIterator it(img, pt1, pt2, 8);
LineIterator it2 = it;
vector<Vec3b> buf(it.count);
for(int i = 0; i < it.count; i++, ++it)
buf[i] = *(const Vec3b)*it;
// alternative way of iterating through the line
for(int i = 0; i < it2.count; i++, ++it2)
{
Vec3b val = img.at<Vec3b>(it2.pos());
CV_Assert(buf[i] == val);
}
@endcode
*/
class CV_EXPORTS LineIterator
{
public:
/** @brief intializes the iterator
creates iterators for the line connecting pt1 and pt2
the line will be clipped on the image boundaries
the line is 8-connected or 4-connected
If leftToRight=true, then the iteration is always done
from the left-most point to the right most,
not to depend on the ordering of pt1 and pt2 parameters
*/
LineIterator( const Mat& img, Point pt1, Point pt2,
int connectivity = 8, bool leftToRight = false );
/** @brief returns pointer to the current pixel
*/
uchar* operator *();
/** @brief prefix increment operator (++it). shifts iterator to the next pixel
*/
LineIterator& operator ++();
/** @brief postfix increment operator (it++). shifts iterator to the next pixel
*/
LineIterator operator ++(int);
/** @brief returns coordinates of the current pixel
*/
Point pos() const;
uchar* ptr;
const uchar* ptr0;
int step, elemSize;
int err, count;
int minusDelta, plusDelta;
int minusStep, plusStep;
};
//! @} imgproc_drawing
//! @addtogroup core_basic //! @addtogroup core_basic
//! @{ //! @{
...@@ -2806,7 +2739,6 @@ public: ...@@ -2806,7 +2739,6 @@ public:
}; };
//////////////////////////////////////// Algorithm //////////////////////////////////// //////////////////////////////////////// Algorithm ////////////////////////////////////
class CV_EXPORTS Algorithm; class CV_EXPORTS Algorithm;
......
...@@ -353,43 +353,6 @@ inline unsigned RNG::next() ...@@ -353,43 +353,6 @@ inline unsigned RNG::next()
return (unsigned)state; return (unsigned)state;
} }
///////////////////////////////////////// LineIterator ////////////////////////////////////////
inline
uchar* LineIterator::operator *()
{
return ptr;
}
inline
LineIterator& LineIterator::operator ++()
{
int mask = err < 0 ? -1 : 0;
err += minusDelta + (plusDelta & mask);
ptr += minusStep + (plusStep & mask);
return *this;
}
inline
LineIterator LineIterator::operator ++(int)
{
LineIterator it = *this;
++(*this);
return it;
}
inline
Point LineIterator::pos() const
{
Point p;
p.y = (int)((ptr - ptr0)/step);
p.x = (int)(((ptr - ptr0) - p.y*step)/elemSize);
return p;
}
//! returns the next unifomly-distributed random number of the specified type //! returns the next unifomly-distributed random number of the specified type
template<typename _Tp> static inline _Tp randu() template<typename _Tp> static inline _Tp randu()
{ {
......
...@@ -804,6 +804,36 @@ public: ...@@ -804,6 +804,36 @@ public:
//! @{ //! @{
/** @brief struct returned by cv::moments /** @brief struct returned by cv::moments
The spatial moments \f$\texttt{Moments::m}_{ji}\f$ are computed as:
\f[\texttt{m} _{ji}= \sum _{x,y} \left ( \texttt{array} (x,y) \cdot x^j \cdot y^i \right )\f]
The central moments \f$\texttt{Moments::mu}_{ji}\f$ are computed as:
\f[\texttt{mu} _{ji}= \sum _{x,y} \left ( \texttt{array} (x,y) \cdot (x - \bar{x} )^j \cdot (y - \bar{y} )^i \right )\f]
where \f$(\bar{x}, \bar{y})\f$ is the mass center:
\f[\bar{x} = \frac{\texttt{m}_{10}}{\texttt{m}_{00}} , \; \bar{y} = \frac{\texttt{m}_{01}}{\texttt{m}_{00}}\f]
The normalized central moments \f$\texttt{Moments::nu}_{ij}\f$ are computed as:
\f[\texttt{nu} _{ji}= \frac{\texttt{mu}_{ji}}{\texttt{m}_{00}^{(i+j)/2+1}} .\f]
@note
\f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$
\f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$ , hence the values are not
stored.
The moments of a contour are defined in the same way but computed using the Green's formula (see
<http://en.wikipedia.org/wiki/Green_theorem>). So, due to a limited raster resolution, the moments
computed for a contour are slightly different from the moments computed for the same rasterized
contour.
@note
Since the contour moments are computed using Green formula, you may get seemingly odd results for
contours with self-intersections, e.g. a zero area (m00) for butterfly-shaped contours.
*/ */
class CV_EXPORTS_W_MAP Moments class CV_EXPORTS_W_MAP Moments
{ {
......
...@@ -170,7 +170,7 @@ CV_EXPORTS void updateWindow(const String& winname); ...@@ -170,7 +170,7 @@ CV_EXPORTS void updateWindow(const String& winname);
struct QtFont struct QtFont
{ {
const char* nameFont; // Qt: nameFont const char* nameFont; // Qt: nameFont
Scalar color; // Qt: ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component]) Scalar color; // Qt: ColorFont -> cvScalar(blue_component, green_component, red_component[, alpha_component])
int font_face; // Qt: bool italic int font_face; // Qt: bool italic
const int* ascii; // font data and metrics const int* ascii; // font data and metrics
const int* greek; const int* greek;
......
...@@ -70,7 +70,7 @@ enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal, ...@@ -70,7 +70,7 @@ enum { CV_STYLE_NORMAL = 0,//QFont::StyleNormal,
}; };
/* ---------*/ /* ---------*/
//for color cvScalar(blue_component, green_component, red\_component[, alpha_component]) //for color cvScalar(blue_component, green_component, red_component[, alpha_component])
//and alpha= 0 <-> 0xFF (not transparent <-> transparent) //and alpha= 0 <-> 0xFF (not transparent <-> transparent)
CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvScalar color CV_DEFAULT(cvScalarAll(0)), int weight CV_DEFAULT(CV_FONT_NORMAL), int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0)); CVAPI(CvFont) cvFontQt(const char* nameFont, int pointSize CV_DEFAULT(-1), CvScalar color CV_DEFAULT(cvScalarAll(0)), int weight CV_DEFAULT(CV_FONT_NORMAL), int style CV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0));
......
Color conversions {#imgproc_color_conversions}
=================
See cv::cvtColor and cv::ColorConversionCodes
@todo document other conversion modes
@anchor color_convert_rgb_gray
RGB \f$\leftrightarrow\f$ GRAY
------------------------------
Transformations within RGB space like adding/removing the alpha channel, reversing the channel
order, conversion to/from 16-bit RGB color (R5:G6:B5 or R5:G5:B5), as well as conversion
to/from grayscale using:
\f[\text{RGB[A] to Gray:} \quad Y \leftarrow 0.299 \cdot R + 0.587 \cdot G + 0.114 \cdot B\f]
and
\f[\text{Gray to RGB[A]:} \quad R \leftarrow Y, G \leftarrow Y, B \leftarrow Y, A \leftarrow \max (ChannelRange)\f]
The conversion from a RGB image to gray is done with:
@code
cvtColor(src, bwsrc, cv::COLOR_RGB2GRAY);
@endcode
More advanced channel reordering can also be done with cv::mixChannels.
@see cv::COLOR_BGR2GRAY, cv::COLOR_RGB2GRAY, cv::COLOR_GRAY2BGR, cv::COLOR_GRAY2RGB
@anchor color_convert_rgb_xyz
RGB \f$\leftrightarrow\f$ CIE XYZ.Rec 709 with D65 white point
--------------------------------------------------------------
\f[\begin{bmatrix} X \\ Y \\ Z
\end{bmatrix} \leftarrow \begin{bmatrix} 0.412453 & 0.357580 & 0.180423 \\ 0.212671 & 0.715160 & 0.072169 \\ 0.019334 & 0.119193 & 0.950227
\end{bmatrix} \cdot \begin{bmatrix} R \\ G \\ B
\end{bmatrix}\f]
\f[\begin{bmatrix} R \\ G \\ B
\end{bmatrix} \leftarrow \begin{bmatrix} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 & 1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311
\end{bmatrix} \cdot \begin{bmatrix} X \\ Y \\ Z
\end{bmatrix}\f]
\f$X\f$, \f$Y\f$ and \f$Z\f$ cover the whole value range (in case of floating-point images, \f$Z\f$ may exceed 1).
@see cv::COLOR_BGR2XYZ, cv::COLOR_RGB2XYZ, cv::COLOR_XYZ2BGR, cv::COLOR_XYZ2RGB
@anchor color_convert_rgb_ycrcb
RGB \f$\leftrightarrow\f$ YCrCb JPEG (or YCC)
---------------------------------------------
\f[Y \leftarrow 0.299 \cdot R + 0.587 \cdot G + 0.114 \cdot B\f]
\f[Cr \leftarrow (R-Y) \cdot 0.713 + delta\f]
\f[Cb \leftarrow (B-Y) \cdot 0.564 + delta\f]
\f[R \leftarrow Y + 1.403 \cdot (Cr - delta)\f]
\f[G \leftarrow Y - 0.714 \cdot (Cr - delta) - 0.344 \cdot (Cb - delta)\f]
\f[B \leftarrow Y + 1.773 \cdot (Cb - delta)\f]
where
\f[delta = \left \{ \begin{array}{l l} 128 & \mbox{for 8-bit images} \\ 32768 & \mbox{for 16-bit images} \\ 0.5 & \mbox{for floating-point images} \end{array} \right .\f]
Y, Cr, and Cb cover the whole value range.
@see cv::COLOR_BGR2YCrCb, cv::COLOR_RGB2YCrCb, cv::COLOR_YCrCb2BGR, cv::COLOR_YCrCb2RGB
@anchor color_convert_rgb_hsv
RGB \f$\leftrightarrow\f$ HSV
-----------------------------
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
scaled to fit the 0 to 1 range.
\f[V \leftarrow max(R,G,B)\f]
\f[S \leftarrow \fork{\frac{V-min(R,G,B)}{V}}{if \(V \neq 0\)}{0}{otherwise}\f]
\f[H \leftarrow \forkthree{{60(G - B)}/{(V-min(R,G,B))}}{if \(V=R\)}{{120+60(B - R)}/{(V-min(R,G,B))}}{if \(V=G\)}{{240+60(R - G)}/{(V-min(R,G,B))}}{if \(V=B\)}\f]
If \f$H<0\f$ then \f$H \leftarrow H+360\f$ . On output \f$0 \leq V \leq 1\f$, \f$0 \leq S \leq 1\f$,
\f$0 \leq H \leq 360\f$ .
The values are then converted to the destination data type:
- 8-bit images: \f$V \leftarrow 255 V, S \leftarrow 255 S, H \leftarrow H/2 \text{(to fit to 0 to 255)}\f$
- 16-bit images: (currently not supported) \f$V <- 65535 V, S <- 65535 S, H <- H\f$
- 32-bit images: H, S, and V are left as is
@see cv::COLOR_BGR2HSV, cv::COLOR_RGB2HSV, cv::COLOR_HSV2BGR, cv::COLOR_HSV2RGB
@anchor color_convert_rgb_hls
RGB \f$\leftrightarrow\f$ HLS
-----------------------------
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
scaled to fit the 0 to 1 range.
\f[V_{max} \leftarrow {max}(R,G,B)\f]
\f[V_{min} \leftarrow {min}(R,G,B)\f]
\f[L \leftarrow \frac{V_{max} + V_{min}}{2}\f]
\f[S \leftarrow \fork { \frac{V_{max} - V_{min}}{V_{max} + V_{min}} }{if \(L < 0.5\) }
{ \frac{V_{max} - V_{min}}{2 - (V_{max} + V_{min})} }{if \(L \ge 0.5\) }\f]
\f[H \leftarrow \forkthree {{60(G - B)}/{S}}{if \(V_{max}=R\) }
{{120+60(B - R)}/{S}}{if \(V_{max}=G\) }
{{240+60(R - G)}/{S}}{if \(V_{max}=B\) }\f]
If \f$H<0\f$ then \f$H \leftarrow H+360\f$ . On output \f$0 \leq L \leq 1\f$, \f$0 \leq S \leq
1\f$, \f$0 \leq H \leq 360\f$ .
The values are then converted to the destination data type:
- 8-bit images: \f$V \leftarrow 255 \cdot V, S \leftarrow 255 \cdot S, H \leftarrow H/2 \; \text{(to fit to 0 to 255)}\f$
- 16-bit images: (currently not supported) \f$V <- 65535 \cdot V, S <- 65535 \cdot S, H <- H\f$
- 32-bit images: H, S, V are left as is
@see cv::COLOR_BGR2HLS, cv::COLOR_RGB2HLS, cv::COLOR_HLS2BGR, cv::COLOR_HLS2RGB
@anchor color_convert_rgb_lab
RGB \f$\leftrightarrow\f$ CIE L\*a\*b\*
---------------------------------------
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
scaled to fit the 0 to 1 range.
\f[\vecthree{X}{Y}{Z} \leftarrow \vecthreethree{0.412453}{0.357580}{0.180423}{0.212671}{0.715160}{0.072169}{0.019334}{0.119193}{0.950227} \cdot \vecthree{R}{G}{B}\f]
\f[X \leftarrow X/X_n, \text{where} X_n = 0.950456\f]
\f[Z \leftarrow Z/Z_n, \text{where} Z_n = 1.088754\f]
\f[L \leftarrow \fork{116*Y^{1/3}-16}{for \(Y>0.008856\)}{903.3*Y}{for \(Y \le 0.008856\)}\f]
\f[a \leftarrow 500 (f(X)-f(Y)) + delta\f]
\f[b \leftarrow 200 (f(Y)-f(Z)) + delta\f]
where
\f[f(t)= \fork{t^{1/3}}{for \(t>0.008856\)}{7.787 t+16/116}{for \(t\leq 0.008856\)}\f]
and
\f[delta = \fork{128}{for 8-bit images}{0}{for floating-point images}\f]
This outputs \f$0 \leq L \leq 100\f$, \f$-127 \leq a \leq 127\f$, \f$-127 \leq b \leq 127\f$ . The values
are then converted to the destination data type:
- 8-bit images: \f$L \leftarrow L*255/100, \; a \leftarrow a + 128, \; b \leftarrow b + 128\f$
- 16-bit images: (currently not supported)
- 32-bit images: L, a, and b are left as is
@see cv::COLOR_BGR2Lab, cv::COLOR_RGB2Lab, cv::COLOR_Lab2BGR, cv::COLOR_Lab2RGB
@anchor color_convert_rgb_luv
RGB \f$\leftrightarrow\f$ CIE L\*u\*v\*
---------------------------------------
In case of 8-bit and 16-bit images, R, G, and B are converted to the floating-point format and
scaled to fit 0 to 1 range.
\f[\vecthree{X}{Y}{Z} \leftarrow \vecthreethree{0.412453}{0.357580}{0.180423}{0.212671}{0.715160}{0.072169}{0.019334}{0.119193}{0.950227} \cdot \vecthree{R}{G}{B}\f]
\f[L \leftarrow \fork{116 Y^{1/3}}{for \(Y>0.008856\)}{903.3 Y}{for \(Y\leq 0.008856\)}\f]
\f[u' \leftarrow 4*X/(X + 15*Y + 3 Z)\f]
\f[v' \leftarrow 9*Y/(X + 15*Y + 3 Z)\f]
\f[u \leftarrow 13*L*(u' - u_n) \quad \text{where} \quad u_n=0.19793943\f]
\f[v \leftarrow 13*L*(v' - v_n) \quad \text{where} \quad v_n=0.46831096\f]
This outputs \f$0 \leq L \leq 100\f$, \f$-134 \leq u \leq 220\f$, \f$-140 \leq v \leq 122\f$ .
The values are then converted to the destination data type:
- 8-bit images: \f$L \leftarrow 255/100 L, \; u \leftarrow 255/354 (u + 134), \; v \leftarrow 255/262 (v + 140)\f$
- 16-bit images: (currently not supported)
- 32-bit images: L, u, and v are left as is
The above formulae for converting RGB to/from various color spaces have been taken from multiple
sources on the web, primarily from the Charles Poynton site <http://www.poynton.com/ColorFAQ.html>
@see cv::COLOR_BGR2Luv, cv::COLOR_RGB2Luv, cv::COLOR_Luv2BGR, cv::COLOR_Luv2RGB
@anchor color_convert_bayer
Bayer \f$\rightarrow\f$ RGB
---------------------------
The Bayer pattern is widely used in CCD and CMOS cameras. It enables you to get color pictures
from a single plane where R,G, and B pixels (sensors of a particular component) are interleaved
as follows:
![Bayer pattern](pics/bayer.png)
The output RGB components of a pixel are interpolated from 1, 2, or 4 neighbors of the pixel
having the same color. There are several modifications of the above pattern that can be achieved
by shifting the pattern one pixel left and/or one pixel up. The two letters \f$C_1\f$ and \f$C_2\f$ in
the conversion constants CV_Bayer \f$C_1 C_2\f$ 2BGR and CV_Bayer \f$C_1 C_2\f$ 2RGB indicate the
particular pattern type. These are components from the second row, second and third columns,
respectively. For example, the above pattern has a very popular "BG" type.
@see cv::COLOR_BayerBG2BGR, cv::COLOR_BayerGB2BGR, cv::COLOR_BayerRG2BGR, cv::COLOR_BayerGR2BGR, cv::COLOR_BayerBG2RGB, cv::COLOR_BayerGB2RGB, cv::COLOR_BayerRG2RGB, cv::COLOR_BayerGR2RGB
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -49,21 +49,33 @@ ...@@ -49,21 +49,33 @@
extern "C" { extern "C" {
#endif #endif
/** @addtogroup imgproc_c
@{
*/
/*********************** Background statistics accumulation *****************************/ /*********************** Background statistics accumulation *****************************/
/* Adds image to accumulator */ /** @brief Adds image to accumulator
@see cv::accumulate
*/
CVAPI(void) cvAcc( const CvArr* image, CvArr* sum, CVAPI(void) cvAcc( const CvArr* image, CvArr* sum,
const CvArr* mask CV_DEFAULT(NULL) ); const CvArr* mask CV_DEFAULT(NULL) );
/* Adds squared image to accumulator */ /** @brief Adds squared image to accumulator
@see cv::accumulateSquare
*/
CVAPI(void) cvSquareAcc( const CvArr* image, CvArr* sqsum, CVAPI(void) cvSquareAcc( const CvArr* image, CvArr* sqsum,
const CvArr* mask CV_DEFAULT(NULL) ); const CvArr* mask CV_DEFAULT(NULL) );
/* Adds a product of two images to accumulator */ /** @brief Adds a product of two images to accumulator
@see cv::accumulateProduct
*/
CVAPI(void) cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc, CVAPI(void) cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc,
const CvArr* mask CV_DEFAULT(NULL) ); const CvArr* mask CV_DEFAULT(NULL) );
/* Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha */ /** @brief Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha
@see cv::accumulateWeighted
*/
CVAPI(void) cvRunningAvg( const CvArr* image, CvArr* acc, double alpha, CVAPI(void) cvRunningAvg( const CvArr* image, CvArr* acc, double alpha,
const CvArr* mask CV_DEFAULT(NULL) ); const CvArr* mask CV_DEFAULT(NULL) );
...@@ -71,12 +83,31 @@ CVAPI(void) cvRunningAvg( const CvArr* image, CvArr* acc, double alpha, ...@@ -71,12 +83,31 @@ CVAPI(void) cvRunningAvg( const CvArr* image, CvArr* acc, double alpha,
* Image Processing * * Image Processing *
\****************************************************************************************/ \****************************************************************************************/
/* Copies source 2D array inside of the larger destination array and /** Copies source 2D array inside of the larger destination array and
makes a border of the specified type (IPL_BORDER_*) around the copied area. */ makes a border of the specified type (IPL_BORDER_*) around the copied area. */
CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset,
int bordertype, CvScalar value CV_DEFAULT(cvScalarAll(0))); int bordertype, CvScalar value CV_DEFAULT(cvScalarAll(0)));
/* Smoothes array (removes noise) */ /** @brief Smooths the image in one of several ways.
@param src The source image
@param dst The destination image
@param smoothtype Type of the smoothing, see SmoothMethod_c
@param size1 The first parameter of the smoothing operation, the aperture width. Must be a
positive odd number (1, 3, 5, ...)
@param size2 The second parameter of the smoothing operation, the aperture height. Ignored by
CV_MEDIAN and CV_BILATERAL methods. In the case of simple scaled/non-scaled and Gaussian blur if
size2 is zero, it is set to size1. Otherwise it must be a positive odd number.
@param sigma1 In the case of a Gaussian parameter this parameter may specify Gaussian \f$\sigma\f$
(standard deviation). If it is zero, it is calculated from the kernel size:
\f[\sigma = 0.3 (n/2 - 1) + 0.8 \quad \text{where} \quad n= \begin{array}{l l} \mbox{\texttt{size1} for horizontal kernel} \\ \mbox{\texttt{size2} for vertical kernel} \end{array}\f]
Using standard sigma for small kernels ( \f$3\times 3\f$ to \f$7\times 7\f$ ) gives better speed. If
sigma1 is not zero, while size1 and size2 are zeros, the kernel size is calculated from the
sigma (to provide accurate enough operation).
@param sigma2 additional parameter for bilateral filtering
@see cv::GaussianBlur, cv::blur, cv::medianBlur, cv::bilateralFilter.
*/
CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst, CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
int smoothtype CV_DEFAULT(CV_GAUSSIAN), int smoothtype CV_DEFAULT(CV_GAUSSIAN),
int size1 CV_DEFAULT(3), int size1 CV_DEFAULT(3),
...@@ -84,204 +115,303 @@ CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst, ...@@ -84,204 +115,303 @@ CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
double sigma1 CV_DEFAULT(0), double sigma1 CV_DEFAULT(0),
double sigma2 CV_DEFAULT(0)); double sigma2 CV_DEFAULT(0));
/* Convolves the image with the kernel */ /** @brief Convolves an image with the kernel.
@param src input image.
@param dst output image of the same size and the same number of channels as src.
@param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
matrix; if you want to apply different kernels to different channels, split the image into
separate color planes using split and process them individually.
@param anchor anchor of the kernel that indicates the relative position of a filtered point within
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.
@see cv::filter2D
*/
CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel,
CvPoint anchor CV_DEFAULT(cvPoint(-1,-1))); CvPoint anchor CV_DEFAULT(cvPoint(-1,-1)));
/* Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y) */ /** @brief Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y)
@see cv::integral
*/
CVAPI(void) cvIntegral( const CvArr* image, CvArr* sum, CVAPI(void) cvIntegral( const CvArr* image, CvArr* sum,
CvArr* sqsum CV_DEFAULT(NULL), CvArr* sqsum CV_DEFAULT(NULL),
CvArr* tilted_sum CV_DEFAULT(NULL)); CvArr* tilted_sum CV_DEFAULT(NULL));
/* /** @brief Smoothes the input image with gaussian kernel and then down-samples it.
Smoothes the input image with gaussian kernel and then down-samples it.
dst_width = floor(src_width/2)[+1], dst_width = floor(src_width/2)[+1],
dst_height = floor(src_height/2)[+1] dst_height = floor(src_height/2)[+1]
@see cv::pyrDown
*/ */
CVAPI(void) cvPyrDown( const CvArr* src, CvArr* dst, CVAPI(void) cvPyrDown( const CvArr* src, CvArr* dst,
int filter CV_DEFAULT(CV_GAUSSIAN_5x5) ); int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
/* /** @brief Up-samples image and smoothes the result with gaussian kernel.
Up-samples image and smoothes the result with gaussian kernel.
dst_width = src_width*2, dst_width = src_width*2,
dst_height = src_height*2 dst_height = src_height*2
@see cv::pyrUp
*/ */
CVAPI(void) cvPyrUp( const CvArr* src, CvArr* dst, CVAPI(void) cvPyrUp( const CvArr* src, CvArr* dst,
int filter CV_DEFAULT(CV_GAUSSIAN_5x5) ); int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
/* Builds pyramid for an image */ /** @brief Builds pyramid for an image
@see buildPyramid
*/
CVAPI(CvMat**) cvCreatePyramid( const CvArr* img, int extra_layers, double rate, CVAPI(CvMat**) cvCreatePyramid( const CvArr* img, int extra_layers, double rate,
const CvSize* layer_sizes CV_DEFAULT(0), const CvSize* layer_sizes CV_DEFAULT(0),
CvArr* bufarr CV_DEFAULT(0), CvArr* bufarr CV_DEFAULT(0),
int calc CV_DEFAULT(1), int calc CV_DEFAULT(1),
int filter CV_DEFAULT(CV_GAUSSIAN_5x5) ); int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
/* Releases pyramid */ /** @brief Releases pyramid */
CVAPI(void) cvReleasePyramid( CvMat*** pyramid, int extra_layers ); CVAPI(void) cvReleasePyramid( CvMat*** pyramid, int extra_layers );
/* Filters image using meanshift algorithm */ /** @brief Filters image using meanshift algorithm
@see cv::pyrMeanShiftFiltering
*/
CVAPI(void) cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst, CVAPI(void) cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst,
double sp, double sr, int max_level CV_DEFAULT(1), double sp, double sr, int max_level CV_DEFAULT(1),
CvTermCriteria termcrit CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1))); CvTermCriteria termcrit CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1)));
/* Segments image using seed "markers" */ /** @brief Segments image using seed "markers"
@see cv::watershed
*/
CVAPI(void) cvWatershed( const CvArr* image, CvArr* markers ); CVAPI(void) cvWatershed( const CvArr* image, CvArr* markers );
/* Calculates an image derivative using generalized Sobel /** @brief Calculates an image derivative using generalized Sobel
(aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator. (aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator.
Scharr can be used only for the first dx or dy derivative */ Scharr can be used only for the first dx or dy derivative
@see cv::Sobel
*/
CVAPI(void) cvSobel( const CvArr* src, CvArr* dst, CVAPI(void) cvSobel( const CvArr* src, CvArr* dst,
int xorder, int yorder, int xorder, int yorder,
int aperture_size CV_DEFAULT(3)); int aperture_size CV_DEFAULT(3));
/* Calculates the image Laplacian: (d2/dx + d2/dy)I */ /** @brief Calculates the image Laplacian: (d2/dx + d2/dy)I
@see cv::Laplacian
*/
CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst, CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst,
int aperture_size CV_DEFAULT(3) ); int aperture_size CV_DEFAULT(3) );
/* Converts input array pixels from one color space to another */ /** @brief Converts input array pixels from one color space to another
@see cv::cvtColor
*/
CVAPI(void) cvCvtColor( const CvArr* src, CvArr* dst, int code ); CVAPI(void) cvCvtColor( const CvArr* src, CvArr* dst, int code );
/* Resizes image (input array is resized to fit the destination array) */ /** @brief Resizes image (input array is resized to fit the destination array)
@see cv::resize
*/
CVAPI(void) cvResize( const CvArr* src, CvArr* dst, CVAPI(void) cvResize( const CvArr* src, CvArr* dst,
int interpolation CV_DEFAULT( CV_INTER_LINEAR )); int interpolation CV_DEFAULT( CV_INTER_LINEAR ));
/* Warps image with affine transform */ /** @brief Warps image with affine transform
@note ::cvGetQuadrangleSubPix is similar to ::cvWarpAffine, but the outliers are extrapolated using
replication border mode.
@see cv::warpAffine
*/
CVAPI(void) cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix, CVAPI(void) cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS), int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
CvScalar fillval CV_DEFAULT(cvScalarAll(0)) ); CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
/* Computes affine transform matrix for mapping src[i] to dst[i] (i=0,1,2) */ /** @brief Computes affine transform matrix for mapping src[i] to dst[i] (i=0,1,2)
@see cv::getAffineTransform
*/
CVAPI(CvMat*) cvGetAffineTransform( const CvPoint2D32f * src, CVAPI(CvMat*) cvGetAffineTransform( const CvPoint2D32f * src,
const CvPoint2D32f * dst, const CvPoint2D32f * dst,
CvMat * map_matrix ); CvMat * map_matrix );
/* Computes rotation_matrix matrix */ /** @brief Computes rotation_matrix matrix
@see cv::getRotationMatrix2D
*/
CVAPI(CvMat*) cv2DRotationMatrix( CvPoint2D32f center, double angle, CVAPI(CvMat*) cv2DRotationMatrix( CvPoint2D32f center, double angle,
double scale, CvMat* map_matrix ); double scale, CvMat* map_matrix );
/* Warps image with perspective (projective) transform */ /** @brief Warps image with perspective (projective) transform
@see cv::warpPerspective
*/
CVAPI(void) cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix, CVAPI(void) cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS), int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
CvScalar fillval CV_DEFAULT(cvScalarAll(0)) ); CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
/* Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3) */ /** @brief Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3)
@see cv::getPerspectiveTransform
*/
CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src, CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src,
const CvPoint2D32f* dst, const CvPoint2D32f* dst,
CvMat* map_matrix ); CvMat* map_matrix );
/* Performs generic geometric transformation using the specified coordinate maps */ /** @brief Performs generic geometric transformation using the specified coordinate maps
@see cv::remap
*/
CVAPI(void) cvRemap( const CvArr* src, CvArr* dst, CVAPI(void) cvRemap( const CvArr* src, CvArr* dst,
const CvArr* mapx, const CvArr* mapy, const CvArr* mapx, const CvArr* mapy,
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS), int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
CvScalar fillval CV_DEFAULT(cvScalarAll(0)) ); CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
/* Converts mapx & mapy from floating-point to integer formats for cvRemap */ /** @brief Converts mapx & mapy from floating-point to integer formats for cvRemap
@see cv::convertMaps
*/
CVAPI(void) cvConvertMaps( const CvArr* mapx, const CvArr* mapy, CVAPI(void) cvConvertMaps( const CvArr* mapx, const CvArr* mapy,
CvArr* mapxy, CvArr* mapalpha ); CvArr* mapxy, CvArr* mapalpha );
/* Performs forward or inverse log-polar image transform */ /** @brief Performs forward or inverse log-polar image transform
@see cv::logPolar
*/
CVAPI(void) cvLogPolar( const CvArr* src, CvArr* dst, CVAPI(void) cvLogPolar( const CvArr* src, CvArr* dst,
CvPoint2D32f center, double M, CvPoint2D32f center, double M,
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS)); int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
/* Performs forward or inverse linear-polar image transform */ /** Performs forward or inverse linear-polar image transform
@see cv::linearPolar
*/
CVAPI(void) cvLinearPolar( const CvArr* src, CvArr* dst, CVAPI(void) cvLinearPolar( const CvArr* src, CvArr* dst,
CvPoint2D32f center, double maxRadius, CvPoint2D32f center, double maxRadius,
int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS)); int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
/* Transforms the input image to compensate lens distortion */ /** @brief Transforms the input image to compensate lens distortion
@see cv::undistort
*/
CVAPI(void) cvUndistort2( const CvArr* src, CvArr* dst, CVAPI(void) cvUndistort2( const CvArr* src, CvArr* dst,
const CvMat* camera_matrix, const CvMat* camera_matrix,
const CvMat* distortion_coeffs, const CvMat* distortion_coeffs,
const CvMat* new_camera_matrix CV_DEFAULT(0) ); const CvMat* new_camera_matrix CV_DEFAULT(0) );
/* Computes transformation map from intrinsic camera parameters /** @brief Computes transformation map from intrinsic camera parameters
that can used by cvRemap */ that can used by cvRemap
*/
CVAPI(void) cvInitUndistortMap( const CvMat* camera_matrix, CVAPI(void) cvInitUndistortMap( const CvMat* camera_matrix,
const CvMat* distortion_coeffs, const CvMat* distortion_coeffs,
CvArr* mapx, CvArr* mapy ); CvArr* mapx, CvArr* mapy );
/* Computes undistortion+rectification map for a head of stereo camera */ /** @brief Computes undistortion+rectification map for a head of stereo camera
@see cv::initUndistortRectifyMap
*/
CVAPI(void) cvInitUndistortRectifyMap( const CvMat* camera_matrix, CVAPI(void) cvInitUndistortRectifyMap( const CvMat* camera_matrix,
const CvMat* dist_coeffs, const CvMat* dist_coeffs,
const CvMat *R, const CvMat* new_camera_matrix, const CvMat *R, const CvMat* new_camera_matrix,
CvArr* mapx, CvArr* mapy ); CvArr* mapx, CvArr* mapy );
/* Computes the original (undistorted) feature coordinates /** @brief Computes the original (undistorted) feature coordinates
from the observed (distorted) coordinates */ from the observed (distorted) coordinates
@see cv::undistortPoints
*/
CVAPI(void) cvUndistortPoints( const CvMat* src, CvMat* dst, CVAPI(void) cvUndistortPoints( const CvMat* src, CvMat* dst,
const CvMat* camera_matrix, const CvMat* camera_matrix,
const CvMat* dist_coeffs, const CvMat* dist_coeffs,
const CvMat* R CV_DEFAULT(0), const CvMat* R CV_DEFAULT(0),
const CvMat* P CV_DEFAULT(0)); const CvMat* P CV_DEFAULT(0));
/* creates structuring element used for morphological operations */ /** @brief Returns a structuring element of the specified size and shape for morphological operations.
CVAPI(IplConvKernel*) cvCreateStructuringElementEx(
@note the created structuring element IplConvKernel\* element must be released in the end using
`cvReleaseStructuringElement(&element)`.
@param cols Width of the structuring element
@param rows Height of the structuring element
@param anchor_x x-coordinate of the anchor
@param anchor_y y-coordinate of the anchor
@param shape element shape that could be one of the cv::MorphShapes_c
@param values integer array of cols*rows elements that specifies the custom shape of the
structuring element, when shape=CV_SHAPE_CUSTOM.
@see cv::getStructuringElement
*/
CVAPI(IplConvKernel*) cvCreateStructuringElementEx(
int cols, int rows, int anchor_x, int anchor_y, int cols, int rows, int anchor_x, int anchor_y,
int shape, int* values CV_DEFAULT(NULL) ); int shape, int* values CV_DEFAULT(NULL) );
/* releases structuring element */ /** @brief releases structuring element
@see cvCreateStructuringElementEx
*/
CVAPI(void) cvReleaseStructuringElement( IplConvKernel** element ); CVAPI(void) cvReleaseStructuringElement( IplConvKernel** element );
/* erodes input image (applies minimum filter) one or more times. /** @brief erodes input image (applies minimum filter) one or more times.
If element pointer is NULL, 3x3 rectangular element is used */ If element pointer is NULL, 3x3 rectangular element is used
@see cv::erode
*/
CVAPI(void) cvErode( const CvArr* src, CvArr* dst, CVAPI(void) cvErode( const CvArr* src, CvArr* dst,
IplConvKernel* element CV_DEFAULT(NULL), IplConvKernel* element CV_DEFAULT(NULL),
int iterations CV_DEFAULT(1) ); int iterations CV_DEFAULT(1) );
/* dilates input image (applies maximum filter) one or more times. /** @brief dilates input image (applies maximum filter) one or more times.
If element pointer is NULL, 3x3 rectangular element is used */
If element pointer is NULL, 3x3 rectangular element is used
@see cv::dilate
*/
CVAPI(void) cvDilate( const CvArr* src, CvArr* dst, CVAPI(void) cvDilate( const CvArr* src, CvArr* dst,
IplConvKernel* element CV_DEFAULT(NULL), IplConvKernel* element CV_DEFAULT(NULL),
int iterations CV_DEFAULT(1) ); int iterations CV_DEFAULT(1) );
/* Performs complex morphological transformation */ /** @brief Performs complex morphological transformation
@see cv::morphologyEx
*/
CVAPI(void) cvMorphologyEx( const CvArr* src, CvArr* dst, CVAPI(void) cvMorphologyEx( const CvArr* src, CvArr* dst,
CvArr* temp, IplConvKernel* element, CvArr* temp, IplConvKernel* element,
int operation, int iterations CV_DEFAULT(1) ); int operation, int iterations CV_DEFAULT(1) );
/* Calculates all spatial and central moments up to the 3rd order */ /** @brief Calculates all spatial and central moments up to the 3rd order
@see cv::moments
*/
CVAPI(void) cvMoments( const CvArr* arr, CvMoments* moments, int binary CV_DEFAULT(0)); CVAPI(void) cvMoments( const CvArr* arr, CvMoments* moments, int binary CV_DEFAULT(0));
/* Retrieve particular spatial, central or normalized central moments */ /** @brief Retrieve spatial moments */
CVAPI(double) cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order ); CVAPI(double) cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );
/** @brief Retrieve central moments */
CVAPI(double) cvGetCentralMoment( CvMoments* moments, int x_order, int y_order ); CVAPI(double) cvGetCentralMoment( CvMoments* moments, int x_order, int y_order );
/** @brief Retrieve normalized central moments */
CVAPI(double) cvGetNormalizedCentralMoment( CvMoments* moments, CVAPI(double) cvGetNormalizedCentralMoment( CvMoments* moments,
int x_order, int y_order ); int x_order, int y_order );
/* Calculates 7 Hu's invariants from precalculated spatial and central moments */ /** @brief Calculates 7 Hu's invariants from precalculated spatial and central moments
@see cv::HuMoments
*/
CVAPI(void) cvGetHuMoments( CvMoments* moments, CvHuMoments* hu_moments ); CVAPI(void) cvGetHuMoments( CvMoments* moments, CvHuMoments* hu_moments );
/*********************************** data sampling **************************************/ /*********************************** data sampling **************************************/
/* Fetches pixels that belong to the specified line segment and stores them to the buffer. /** @brief Fetches pixels that belong to the specified line segment and stores them to the buffer.
Returns the number of retrieved points. */
Returns the number of retrieved points.
@see cv::LineSegmentDetector
*/
CVAPI(int) cvSampleLine( const CvArr* image, CvPoint pt1, CvPoint pt2, void* buffer, CVAPI(int) cvSampleLine( const CvArr* image, CvPoint pt1, CvPoint pt2, void* buffer,
int connectivity CV_DEFAULT(8)); int connectivity CV_DEFAULT(8));
/* Retrieves the rectangular image region with specified center from the input array. /** @brief Retrieves the rectangular image region with specified center from the input array.
dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2). dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2).
Values of pixels with fractional coordinates are retrieved using bilinear interpolation*/ Values of pixels with fractional coordinates are retrieved using bilinear interpolation
@see cv::getRectSubPix
*/
CVAPI(void) cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center ); CVAPI(void) cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center );
/* Retrieves quadrangle from the input array. /** @brief Retrieves quadrangle from the input array.
matrixarr = ( a11 a12 | b1 ) dst(x,y) <- src(A[x y]' + b) matrixarr = ( a11 a12 | b1 ) dst(x,y) <- src(A[x y]' + b)
( a21 a22 | b2 ) (bilinear interpolation is used to retrieve pixels ( a21 a22 | b2 ) (bilinear interpolation is used to retrieve pixels
with fractional coordinates) with fractional coordinates)
@see cvWarpAffine
*/ */
CVAPI(void) cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst, CVAPI(void) cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst,
const CvMat* map_matrix ); const CvMat* map_matrix );
/* Measures similarity between template and overlapped windows in the source image /** @brief Measures similarity between template and overlapped windows in the source image
and fills the resultant image with the measurements */ and fills the resultant image with the measurements
@see cv::matchTemplate
*/
CVAPI(void) cvMatchTemplate( const CvArr* image, const CvArr* templ, CVAPI(void) cvMatchTemplate( const CvArr* image, const CvArr* templ,
CvArr* result, int method ); CvArr* result, int method );
/* Computes earth mover distance between /** @brief Computes earth mover distance between
two weighted point sets (called signatures) */ two weighted point sets (called signatures)
@see cv::EMD
*/
CVAPI(float) cvCalcEMD2( const CvArr* signature1, CVAPI(float) cvCalcEMD2( const CvArr* signature1,
const CvArr* signature2, const CvArr* signature2,
int distance_type, int distance_type,
...@@ -295,50 +425,83 @@ CVAPI(float) cvCalcEMD2( const CvArr* signature1, ...@@ -295,50 +425,83 @@ CVAPI(float) cvCalcEMD2( const CvArr* signature1,
* Contours retrieving * * Contours retrieving *
\****************************************************************************************/ \****************************************************************************************/
/* Retrieves outer and optionally inner boundaries of white (non-zero) connected /** @brief Retrieves outer and optionally inner boundaries of white (non-zero) connected
components in the black (zero) background */ components in the black (zero) background
@see cv::findContours, cvStartFindContours, cvFindNextContour, cvSubstituteContour, cvEndFindContours
*/
CVAPI(int) cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour, CVAPI(int) cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour,
int header_size CV_DEFAULT(sizeof(CvContour)), int header_size CV_DEFAULT(sizeof(CvContour)),
int mode CV_DEFAULT(CV_RETR_LIST), int mode CV_DEFAULT(CV_RETR_LIST),
int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE), int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
CvPoint offset CV_DEFAULT(cvPoint(0,0))); CvPoint offset CV_DEFAULT(cvPoint(0,0)));
/* Initializes contour retrieving process. /** @brief Initializes contour retrieving process.
Calls cvStartFindContours. Calls cvStartFindContours.
Calls cvFindNextContour until null pointer is returned Calls cvFindNextContour until null pointer is returned
or some other condition becomes true. or some other condition becomes true.
Calls cvEndFindContours at the end. */ Calls cvEndFindContours at the end.
@see cvFindContours
*/
CVAPI(CvContourScanner) cvStartFindContours( CvArr* image, CvMemStorage* storage, CVAPI(CvContourScanner) cvStartFindContours( CvArr* image, CvMemStorage* storage,
int header_size CV_DEFAULT(sizeof(CvContour)), int header_size CV_DEFAULT(sizeof(CvContour)),
int mode CV_DEFAULT(CV_RETR_LIST), int mode CV_DEFAULT(CV_RETR_LIST),
int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE), int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
CvPoint offset CV_DEFAULT(cvPoint(0,0))); CvPoint offset CV_DEFAULT(cvPoint(0,0)));
/* Retrieves next contour */ /** @brief Retrieves next contour
@see cvFindContours
*/
CVAPI(CvSeq*) cvFindNextContour( CvContourScanner scanner ); CVAPI(CvSeq*) cvFindNextContour( CvContourScanner scanner );
/* Substitutes the last retrieved contour with the new one /** @brief Substitutes the last retrieved contour with the new one
(if the substitutor is null, the last retrieved contour is removed from the tree) */
(if the substitutor is null, the last retrieved contour is removed from the tree)
@see cvFindContours
*/
CVAPI(void) cvSubstituteContour( CvContourScanner scanner, CvSeq* new_contour ); CVAPI(void) cvSubstituteContour( CvContourScanner scanner, CvSeq* new_contour );
/* Releases contour scanner and returns pointer to the first outer contour */ /** @brief Releases contour scanner and returns pointer to the first outer contour
@see cvFindContours
*/
CVAPI(CvSeq*) cvEndFindContours( CvContourScanner* scanner ); CVAPI(CvSeq*) cvEndFindContours( CvContourScanner* scanner );
/* Approximates a single Freeman chain or a tree of chains to polygonal curves */ /** @brief Approximates Freeman chain(s) with a polygonal curve.
This is a standalone contour approximation routine, not represented in the new interface. When
cvFindContours retrieves contours as Freeman chains, it calls the function to get approximated
contours, represented as polygons.
@param src_seq Pointer to the approximated Freeman chain that can refer to other chains.
@param storage Storage location for the resulting polylines.
@param method Approximation method (see the description of the function :ocvFindContours ).
@param parameter Method parameter (not used now).
@param minimal_perimeter Approximates only those contours whose perimeters are not less than
minimal_perimeter . Other chains are removed from the resulting structure.
@param recursive Recursion flag. If it is non-zero, the function approximates all chains that can
be obtained from chain by using the h_next or v_next links. Otherwise, the single input chain is
approximated.
@see cvStartReadChainPoints, cvReadChainPoint
*/
CVAPI(CvSeq*) cvApproxChains( CvSeq* src_seq, CvMemStorage* storage, CVAPI(CvSeq*) cvApproxChains( CvSeq* src_seq, CvMemStorage* storage,
int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE), int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
double parameter CV_DEFAULT(0), double parameter CV_DEFAULT(0),
int minimal_perimeter CV_DEFAULT(0), int minimal_perimeter CV_DEFAULT(0),
int recursive CV_DEFAULT(0)); int recursive CV_DEFAULT(0));
/* Initializes Freeman chain reader. /** @brief Initializes Freeman chain reader.
The reader is used to iteratively get coordinates of all the chain points. The reader is used to iteratively get coordinates of all the chain points.
If the Freeman codes should be read as is, a simple sequence reader should be used */ If the Freeman codes should be read as is, a simple sequence reader should be used
@see cvApproxChains
*/
CVAPI(void) cvStartReadChainPoints( CvChain* chain, CvChainPtReader* reader ); CVAPI(void) cvStartReadChainPoints( CvChain* chain, CvChainPtReader* reader );
/* Retrieves the next chain point */ /** @brief Retrieves the next chain point
@see cvApproxChains
*/
CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader ); CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader );
...@@ -346,78 +509,106 @@ CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader ); ...@@ -346,78 +509,106 @@ CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader );
* Contour Processing and Shape Analysis * * Contour Processing and Shape Analysis *
\****************************************************************************************/ \****************************************************************************************/
/* Approximates a single polygonal curve (contour) or /** @brief Approximates a single polygonal curve (contour) or
a tree of polygonal curves (contours) */ a tree of polygonal curves (contours)
@see cv::approxPolyDP
*/
CVAPI(CvSeq*) cvApproxPoly( const void* src_seq, CVAPI(CvSeq*) cvApproxPoly( const void* src_seq,
int header_size, CvMemStorage* storage, int header_size, CvMemStorage* storage,
int method, double eps, int method, double eps,
int recursive CV_DEFAULT(0)); int recursive CV_DEFAULT(0));
/* Calculates perimeter of a contour or length of a part of contour */ /** @brief Calculates perimeter of a contour or length of a part of contour
@see cv::arcLength
*/
CVAPI(double) cvArcLength( const void* curve, CVAPI(double) cvArcLength( const void* curve,
CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ), CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
int is_closed CV_DEFAULT(-1)); int is_closed CV_DEFAULT(-1));
/** same as cvArcLength for closed contour
*/
CV_INLINE double cvContourPerimeter( const void* contour ) CV_INLINE double cvContourPerimeter( const void* contour )
{ {
return cvArcLength( contour, CV_WHOLE_SEQ, 1 ); return cvArcLength( contour, CV_WHOLE_SEQ, 1 );
} }
/* Calculates contour bounding rectangle (update=1) or /** @brief Calculates contour bounding rectangle (update=1) or
just retrieves pre-calculated rectangle (update=0) */ just retrieves pre-calculated rectangle (update=0)
@see cv::boundingRect
*/
CVAPI(CvRect) cvBoundingRect( CvArr* points, int update CV_DEFAULT(0) ); CVAPI(CvRect) cvBoundingRect( CvArr* points, int update CV_DEFAULT(0) );
/* Calculates area of a contour or contour segment */ /** @brief Calculates area of a contour or contour segment
@see cv::contourArea
*/
CVAPI(double) cvContourArea( const CvArr* contour, CVAPI(double) cvContourArea( const CvArr* contour,
CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ), CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
int oriented CV_DEFAULT(0)); int oriented CV_DEFAULT(0));
/* Finds minimum area rotated rectangle bounding a set of points */ /** @brief Finds minimum area rotated rectangle bounding a set of points
@see cv::minAreaRect
*/
CVAPI(CvBox2D) cvMinAreaRect2( const CvArr* points, CVAPI(CvBox2D) cvMinAreaRect2( const CvArr* points,
CvMemStorage* storage CV_DEFAULT(NULL)); CvMemStorage* storage CV_DEFAULT(NULL));
/* Finds minimum enclosing circle for a set of points */ /** @brief Finds minimum enclosing circle for a set of points
@see cv::minEnclosingCircle
*/
CVAPI(int) cvMinEnclosingCircle( const CvArr* points, CVAPI(int) cvMinEnclosingCircle( const CvArr* points,
CvPoint2D32f* center, float* radius ); CvPoint2D32f* center, float* radius );
/* Compares two contours by matching their moments */ /** @brief Compares two contours by matching their moments
@see cv::matchShapes
*/
CVAPI(double) cvMatchShapes( const void* object1, const void* object2, CVAPI(double) cvMatchShapes( const void* object1, const void* object2,
int method, double parameter CV_DEFAULT(0)); int method, double parameter CV_DEFAULT(0));
/* Calculates exact convex hull of 2d point set */ /** @brief Calculates exact convex hull of 2d point set
@see cv::convexHull
*/
CVAPI(CvSeq*) cvConvexHull2( const CvArr* input, CVAPI(CvSeq*) cvConvexHull2( const CvArr* input,
void* hull_storage CV_DEFAULT(NULL), void* hull_storage CV_DEFAULT(NULL),
int orientation CV_DEFAULT(CV_CLOCKWISE), int orientation CV_DEFAULT(CV_CLOCKWISE),
int return_points CV_DEFAULT(0)); int return_points CV_DEFAULT(0));
/* Checks whether the contour is convex or not (returns 1 if convex, 0 if not) */ /** @brief Checks whether the contour is convex or not (returns 1 if convex, 0 if not)
@see cv::isContourConvex
*/
CVAPI(int) cvCheckContourConvexity( const CvArr* contour ); CVAPI(int) cvCheckContourConvexity( const CvArr* contour );
/* Finds convexity defects for the contour */ /** @brief Finds convexity defects for the contour
@see cv::convexityDefects
*/
CVAPI(CvSeq*) cvConvexityDefects( const CvArr* contour, const CvArr* convexhull, CVAPI(CvSeq*) cvConvexityDefects( const CvArr* contour, const CvArr* convexhull,
CvMemStorage* storage CV_DEFAULT(NULL)); CvMemStorage* storage CV_DEFAULT(NULL));
/* Fits ellipse into a set of 2d points */ /** @brief Fits ellipse into a set of 2d points
@see cv::fitEllipse
*/
CVAPI(CvBox2D) cvFitEllipse2( const CvArr* points ); CVAPI(CvBox2D) cvFitEllipse2( const CvArr* points );
/* Finds minimum rectangle containing two given rectangles */ /** @brief Finds minimum rectangle containing two given rectangles */
CVAPI(CvRect) cvMaxRect( const CvRect* rect1, const CvRect* rect2 ); CVAPI(CvRect) cvMaxRect( const CvRect* rect1, const CvRect* rect2 );
/* Finds coordinates of the box vertices */ /** @brief Finds coordinates of the box vertices */
CVAPI(void) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] ); CVAPI(void) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] );
/* Initializes sequence header for a matrix (column or row vector) of points - /** @brief Initializes sequence header for a matrix (column or row vector) of points
a wrapper for cvMakeSeqHeaderForArray (it does not initialize bounding rectangle!!!) */ a wrapper for cvMakeSeqHeaderForArray (it does not initialize bounding rectangle!!!) */
CVAPI(CvSeq*) cvPointSeqFromMat( int seq_kind, const CvArr* mat, CVAPI(CvSeq*) cvPointSeqFromMat( int seq_kind, const CvArr* mat,
CvContour* contour_header, CvContour* contour_header,
CvSeqBlock* block ); CvSeqBlock* block );
/* Checks whether the point is inside polygon, outside, on an edge (at a vertex). /** @brief Checks whether the point is inside polygon, outside, on an edge (at a vertex).
Returns positive, negative or zero value, correspondingly. Returns positive, negative or zero value, correspondingly.
Optionally, measures a signed distance between Optionally, measures a signed distance between
the point and the nearest polygon edge (measure_dist=1) */ the point and the nearest polygon edge (measure_dist=1)
@see cv::pointPolygonTest
*/
CVAPI(double) cvPointPolygonTest( const CvArr* contour, CVAPI(double) cvPointPolygonTest( const CvArr* contour,
CvPoint2D32f pt, int measure_dist ); CvPoint2D32f pt, int measure_dist );
...@@ -425,63 +616,158 @@ CVAPI(double) cvPointPolygonTest( const CvArr* contour, ...@@ -425,63 +616,158 @@ CVAPI(double) cvPointPolygonTest( const CvArr* contour,
* Histogram functions * * Histogram functions *
\****************************************************************************************/ \****************************************************************************************/
/* Creates new histogram */ /** @brief Creates a histogram.
The function creates a histogram of the specified size and returns a pointer to the created
histogram. If the array ranges is 0, the histogram bin ranges must be specified later via the
function cvSetHistBinRanges. Though cvCalcHist and cvCalcBackProject may process 8-bit images
without setting bin ranges, they assume they are equally spaced in 0 to 255 bins.
@param dims Number of histogram dimensions.
@param sizes Array of the histogram dimension sizes.
@param type Histogram representation format. CV_HIST_ARRAY means that the histogram data is
represented as a multi-dimensional dense array CvMatND. CV_HIST_SPARSE means that histogram data
is represented as a multi-dimensional sparse array CvSparseMat.
@param ranges Array of ranges for the histogram bins. Its meaning depends on the uniform parameter
value. The ranges are used when the histogram is calculated or backprojected to determine which
histogram bin corresponds to which value/tuple of values from the input image(s).
@param uniform Uniformity flag. If not zero, the histogram has evenly spaced bins and for every
\f$0<=i<cDims\f$ ranges[i] is an array of two numbers: lower and upper boundaries for the i-th
histogram dimension. The whole range [lower,upper] is then split into dims[i] equal parts to
determine the i-th input tuple value ranges for every histogram bin. And if uniform=0 , then the
i-th element of the ranges array contains dims[i]+1 elements: \f$\texttt{lower}_0,
\texttt{upper}_0, \texttt{lower}_1, \texttt{upper}_1 = \texttt{lower}_2,
...
\texttt{upper}_{dims[i]-1}\f$ where \f$\texttt{lower}_j\f$ and \f$\texttt{upper}_j\f$ are lower
and upper boundaries of the i-th input tuple value for the j-th bin, respectively. In either
case, the input values that are beyond the specified range for a histogram bin are not counted
by cvCalcHist and filled with 0 by cvCalcBackProject.
*/
CVAPI(CvHistogram*) cvCreateHist( int dims, int* sizes, int type, CVAPI(CvHistogram*) cvCreateHist( int dims, int* sizes, int type,
float** ranges CV_DEFAULT(NULL), float** ranges CV_DEFAULT(NULL),
int uniform CV_DEFAULT(1)); int uniform CV_DEFAULT(1));
/* Assignes histogram bin ranges */ /** @brief Sets the bounds of the histogram bins.
This is a standalone function for setting bin ranges in the histogram. For a more detailed
description of the parameters ranges and uniform, see the :ocvCalcHist function that can initialize
the ranges as well. Ranges for the histogram bins must be set before the histogram is calculated or
the backproject of the histogram is calculated.
@param hist Histogram.
@param ranges Array of bin ranges arrays. See :ocvCreateHist for details.
@param uniform Uniformity flag. See :ocvCreateHist for details.
*/
CVAPI(void) cvSetHistBinRanges( CvHistogram* hist, float** ranges, CVAPI(void) cvSetHistBinRanges( CvHistogram* hist, float** ranges,
int uniform CV_DEFAULT(1)); int uniform CV_DEFAULT(1));
/* Creates histogram header for array */ /** @brief Makes a histogram out of an array.
The function initializes the histogram, whose header and bins are allocated by the user.
cvReleaseHist does not need to be called afterwards. Only dense histograms can be initialized this
way. The function returns hist.
@param dims Number of the histogram dimensions.
@param sizes Array of the histogram dimension sizes.
@param hist Histogram header initialized by the function.
@param data Array used to store histogram bins.
@param ranges Histogram bin ranges. See cvCreateHist for details.
@param uniform Uniformity flag. See cvCreateHist for details.
*/
CVAPI(CvHistogram*) cvMakeHistHeaderForArray( CVAPI(CvHistogram*) cvMakeHistHeaderForArray(
int dims, int* sizes, CvHistogram* hist, int dims, int* sizes, CvHistogram* hist,
float* data, float** ranges CV_DEFAULT(NULL), float* data, float** ranges CV_DEFAULT(NULL),
int uniform CV_DEFAULT(1)); int uniform CV_DEFAULT(1));
/* Releases histogram */ /** @brief Releases the histogram.
The function releases the histogram (header and the data). The pointer to the histogram is cleared
by the function. If \*hist pointer is already NULL, the function does nothing.
@param hist Double pointer to the released histogram.
*/
CVAPI(void) cvReleaseHist( CvHistogram** hist ); CVAPI(void) cvReleaseHist( CvHistogram** hist );
/* Clears all the histogram bins */ /** @brief Clears the histogram.
The function sets all of the histogram bins to 0 in case of a dense histogram and removes all
histogram bins in case of a sparse array.
@param hist Histogram.
*/
CVAPI(void) cvClearHist( CvHistogram* hist ); CVAPI(void) cvClearHist( CvHistogram* hist );
/* Finds indices and values of minimum and maximum histogram bins */ /** @brief Finds the minimum and maximum histogram bins.
The function finds the minimum and maximum histogram bins and their positions. All of output
arguments are optional. Among several extremas with the same value the ones with the minimum index
(in the lexicographical order) are returned. In case of several maximums or minimums, the earliest
in the lexicographical order (extrema locations) is returned.
@param hist Histogram.
@param min_value Pointer to the minimum value of the histogram.
@param max_value Pointer to the maximum value of the histogram.
@param min_idx Pointer to the array of coordinates for the minimum.
@param max_idx Pointer to the array of coordinates for the maximum.
*/
CVAPI(void) cvGetMinMaxHistValue( const CvHistogram* hist, CVAPI(void) cvGetMinMaxHistValue( const CvHistogram* hist,
float* min_value, float* max_value, float* min_value, float* max_value,
int* min_idx CV_DEFAULT(NULL), int* min_idx CV_DEFAULT(NULL),
int* max_idx CV_DEFAULT(NULL)); int* max_idx CV_DEFAULT(NULL));
/* Normalizes histogram by dividing all bins by sum of the bins, multiplied by <factor>. /** @brief Normalizes the histogram.
After that sum of histogram bins is equal to <factor> */
The function normalizes the histogram bins by scaling them so that the sum of the bins becomes equal
to factor.
@param hist Pointer to the histogram.
@param factor Normalization factor.
*/
CVAPI(void) cvNormalizeHist( CvHistogram* hist, double factor ); CVAPI(void) cvNormalizeHist( CvHistogram* hist, double factor );
/* Clear all histogram bins that are below the threshold */ /** @brief Thresholds the histogram.
The function clears histogram bins that are below the specified threshold.
@param hist Pointer to the histogram.
@param threshold Threshold level.
*/
CVAPI(void) cvThreshHist( CvHistogram* hist, double threshold ); CVAPI(void) cvThreshHist( CvHistogram* hist, double threshold );
/* Compares two histogram */ /** Compares two histogram */
CVAPI(double) cvCompareHist( const CvHistogram* hist1, CVAPI(double) cvCompareHist( const CvHistogram* hist1,
const CvHistogram* hist2, const CvHistogram* hist2,
int method); int method);
/* Copies one histogram to another. Destination histogram is created if /** @brief Copies a histogram.
the destination pointer is NULL */
The function makes a copy of the histogram. If the second histogram pointer \*dst is NULL, a new
histogram of the same size as src is created. Otherwise, both histograms must have equal types and
sizes. Then the function copies the bin values of the source histogram to the destination histogram
and sets the same bin value ranges as in src.
@param src Source histogram.
@param dst Pointer to the destination histogram.
*/
CVAPI(void) cvCopyHist( const CvHistogram* src, CvHistogram** dst ); CVAPI(void) cvCopyHist( const CvHistogram* src, CvHistogram** dst );
/* Calculates bayesian probabilistic histograms /** @brief Calculates bayesian probabilistic histograms
(each or src and dst is an array of <number> histograms */ (each or src and dst is an array of _number_ histograms */
CVAPI(void) cvCalcBayesianProb( CvHistogram** src, int number, CVAPI(void) cvCalcBayesianProb( CvHistogram** src, int number,
CvHistogram** dst); CvHistogram** dst);
/* Calculates array histogram */ /** @brief Calculates array histogram
@see cv::calcHist
*/
CVAPI(void) cvCalcArrHist( CvArr** arr, CvHistogram* hist, CVAPI(void) cvCalcArrHist( CvArr** arr, CvHistogram* hist,
int accumulate CV_DEFAULT(0), int accumulate CV_DEFAULT(0),
const CvArr* mask CV_DEFAULT(NULL) ); const CvArr* mask CV_DEFAULT(NULL) );
/** @overload */
CV_INLINE void cvCalcHist( IplImage** image, CvHistogram* hist, CV_INLINE void cvCalcHist( IplImage** image, CvHistogram* hist,
int accumulate CV_DEFAULT(0), int accumulate CV_DEFAULT(0),
const CvArr* mask CV_DEFAULT(NULL) ) const CvArr* mask CV_DEFAULT(NULL) )
...@@ -489,30 +775,65 @@ CV_INLINE void cvCalcHist( IplImage** image, CvHistogram* hist, ...@@ -489,30 +775,65 @@ CV_INLINE void cvCalcHist( IplImage** image, CvHistogram* hist,
cvCalcArrHist( (CvArr**)image, hist, accumulate, mask ); cvCalcArrHist( (CvArr**)image, hist, accumulate, mask );
} }
/* Calculates back project */ /** @brief Calculates back project
@see cvCalcBackProject, cv::calcBackProject
*/
CVAPI(void) cvCalcArrBackProject( CvArr** image, CvArr* dst, CVAPI(void) cvCalcArrBackProject( CvArr** image, CvArr* dst,
const CvHistogram* hist ); const CvHistogram* hist );
#define cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist) #define cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist)
/* Does some sort of template matching but compares histograms of /** @brief Locates a template within an image by using a histogram comparison.
template and each window location */
The function calculates the back projection by comparing histograms of the source image patches with
the given histogram. The function is similar to matchTemplate, but instead of comparing the raster
patch with all its possible positions within the search window, the function CalcBackProjectPatch
compares histograms. See the algorithm diagram below:
![image](pics/backprojectpatch.png)
@param image Source images (though, you may pass CvMat\*\* as well).
@param dst Destination image.
@param range
@param hist Histogram.
@param method Comparison method passed to cvCompareHist (see the function description).
@param factor Normalization factor for histograms that affects the normalization scale of the
destination image. Pass 1 if not sure.
@see cvCalcBackProjectPatch
*/
CVAPI(void) cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range, CVAPI(void) cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range,
CvHistogram* hist, int method, CvHistogram* hist, int method,
double factor ); double factor );
#define cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \ #define cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \
cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor ) cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor )
/* calculates probabilistic density (divides one histogram by another) */ /** @brief Divides one histogram by another.
The function calculates the object probability density from two histograms as:
\f[\texttt{disthist} (I)= \forkthree{0}{if \(\texttt{hist1}(I)=0\)}{\texttt{scale}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) > \texttt{hist1}(I)\)}{\frac{\texttt{hist2}(I) \cdot \texttt{scale}}{\texttt{hist1}(I)}}{if \(\texttt{hist1}(I) \ne 0\) and \(\texttt{hist2}(I) \le \texttt{hist1}(I)\)}\f]
@param hist1 First histogram (the divisor).
@param hist2 Second histogram.
@param dst_hist Destination histogram.
@param scale Scale factor for the destination histogram.
*/
CVAPI(void) cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2, CVAPI(void) cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2,
CvHistogram* dst_hist, double scale CV_DEFAULT(255) ); CvHistogram* dst_hist, double scale CV_DEFAULT(255) );
/* equalizes histogram of 8-bit single-channel image */ /** @brief equalizes histogram of 8-bit single-channel image
@see cv::equalizeHist
*/
CVAPI(void) cvEqualizeHist( const CvArr* src, CvArr* dst ); CVAPI(void) cvEqualizeHist( const CvArr* src, CvArr* dst );
/* Applies distance transform to binary image */ /** @brief Applies distance transform to binary image
@see cv::distanceTransform
*/
CVAPI(void) cvDistTransform( const CvArr* src, CvArr* dst, CVAPI(void) cvDistTransform( const CvArr* src, CvArr* dst,
int distance_type CV_DEFAULT(CV_DIST_L2), int distance_type CV_DEFAULT(CV_DIST_L2),
int mask_size CV_DEFAULT(3), int mask_size CV_DEFAULT(3),
...@@ -521,24 +842,32 @@ CVAPI(void) cvDistTransform( const CvArr* src, CvArr* dst, ...@@ -521,24 +842,32 @@ CVAPI(void) cvDistTransform( const CvArr* src, CvArr* dst,
int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP)); int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP));
/* Applies fixed-level threshold to grayscale image. /** @brief Applies fixed-level threshold to grayscale image.
This is a basic operation applied before retrieving contours */
This is a basic operation applied before retrieving contours
@see cv::threshold
*/
CVAPI(double) cvThreshold( const CvArr* src, CvArr* dst, CVAPI(double) cvThreshold( const CvArr* src, CvArr* dst,
double threshold, double max_value, double threshold, double max_value,
int threshold_type ); int threshold_type );
/* Applies adaptive threshold to grayscale image. /** @brief Applies adaptive threshold to grayscale image.
The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and
CV_ADAPTIVE_THRESH_GAUSSIAN_C are: CV_ADAPTIVE_THRESH_GAUSSIAN_C are:
neighborhood size (3, 5, 7 etc.), neighborhood size (3, 5, 7 etc.),
and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...) */ and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...)
@see cv::adaptiveThreshold
*/
CVAPI(void) cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value, CVAPI(void) cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value,
int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C), int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C),
int threshold_type CV_DEFAULT(CV_THRESH_BINARY), int threshold_type CV_DEFAULT(CV_THRESH_BINARY),
int block_size CV_DEFAULT(3), int block_size CV_DEFAULT(3),
double param1 CV_DEFAULT(5)); double param1 CV_DEFAULT(5));
/* Fills the connected component until the color difference gets large enough */ /** @brief Fills the connected component until the color difference gets large enough
@see cv::floodFill
*/
CVAPI(void) cvFloodFill( CvArr* image, CvPoint seed_point, CVAPI(void) cvFloodFill( CvArr* image, CvPoint seed_point,
CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)), CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)),
CvScalar up_diff CV_DEFAULT(cvScalarAll(0)), CvScalar up_diff CV_DEFAULT(cvScalarAll(0)),
...@@ -550,39 +879,55 @@ CVAPI(void) cvFloodFill( CvArr* image, CvPoint seed_point, ...@@ -550,39 +879,55 @@ CVAPI(void) cvFloodFill( CvArr* image, CvPoint seed_point,
* Feature detection * * Feature detection *
\****************************************************************************************/ \****************************************************************************************/
/* Runs canny edge detector */ /** @brief Runs canny edge detector
@see cv::Canny
*/
CVAPI(void) cvCanny( const CvArr* image, CvArr* edges, double threshold1, CVAPI(void) cvCanny( const CvArr* image, CvArr* edges, double threshold1,
double threshold2, int aperture_size CV_DEFAULT(3) ); double threshold2, int aperture_size CV_DEFAULT(3) );
/* Calculates constraint image for corner detection /** @brief Calculates constraint image for corner detection
Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy. Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy.
Applying threshold to the result gives coordinates of corners */ Applying threshold to the result gives coordinates of corners
@see cv::preCornerDetect
*/
CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners, CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners,
int aperture_size CV_DEFAULT(3) ); int aperture_size CV_DEFAULT(3) );
/* Calculates eigen values and vectors of 2x2 /** @brief Calculates eigen values and vectors of 2x2
gradient covariation matrix at every image pixel */ gradient covariation matrix at every image pixel
@see cv::cornerEigenValsAndVecs
*/
CVAPI(void) cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv, CVAPI(void) cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv,
int block_size, int aperture_size CV_DEFAULT(3) ); int block_size, int aperture_size CV_DEFAULT(3) );
/* Calculates minimal eigenvalue for 2x2 gradient covariation matrix at /** @brief Calculates minimal eigenvalue for 2x2 gradient covariation matrix at
every image pixel */ every image pixel
@see cv::cornerMinEigenVal
*/
CVAPI(void) cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval, CVAPI(void) cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval,
int block_size, int aperture_size CV_DEFAULT(3) ); int block_size, int aperture_size CV_DEFAULT(3) );
/* Harris corner detector: /** @brief Harris corner detector:
Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel */
Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel
@see cv::cornerHarris
*/
CVAPI(void) cvCornerHarris( const CvArr* image, CvArr* harris_response, CVAPI(void) cvCornerHarris( const CvArr* image, CvArr* harris_response,
int block_size, int aperture_size CV_DEFAULT(3), int block_size, int aperture_size CV_DEFAULT(3),
double k CV_DEFAULT(0.04) ); double k CV_DEFAULT(0.04) );
/* Adjust corner position using some sort of gradient search */ /** @brief Adjust corner position using some sort of gradient search
@see cv::cornerSubPix
*/
CVAPI(void) cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners, CVAPI(void) cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners,
int count, CvSize win, CvSize zero_zone, int count, CvSize win, CvSize zero_zone,
CvTermCriteria criteria ); CvTermCriteria criteria );
/* Finds a sparse set of points within the selected region /** @brief Finds a sparse set of points within the selected region
that seem to be easy to track */ that seem to be easy to track
@see cv::goodFeaturesToTrack
*/
CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image, CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image,
CvArr* temp_image, CvPoint2D32f* corners, CvArr* temp_image, CvPoint2D32f* corners,
int* corner_count, double quality_level, int* corner_count, double quality_level,
...@@ -592,19 +937,24 @@ CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image, ...@@ -592,19 +937,24 @@ CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image,
int use_harris CV_DEFAULT(0), int use_harris CV_DEFAULT(0),
double k CV_DEFAULT(0.04) ); double k CV_DEFAULT(0.04) );
/* Finds lines on binary image using one of several methods. /** @brief Finds lines on binary image using one of several methods.
line_storage is either memory storage or 1 x <max number of lines> CvMat, its
line_storage is either memory storage or 1 x _max number of lines_ CvMat, its
number of columns is changed by the function. number of columns is changed by the function.
method is one of CV_HOUGH_*; method is one of CV_HOUGH_*;
rho, theta and threshold are used for each of those methods; rho, theta and threshold are used for each of those methods;
param1 ~ line length, param2 ~ line gap - for probabilistic, param1 ~ line length, param2 ~ line gap - for probabilistic,
param1 ~ srn, param2 ~ stn - for multi-scale */ param1 ~ srn, param2 ~ stn - for multi-scale
@see cv::HoughLines
*/
CVAPI(CvSeq*) cvHoughLines2( CvArr* image, void* line_storage, int method, CVAPI(CvSeq*) cvHoughLines2( CvArr* image, void* line_storage, int method,
double rho, double theta, int threshold, double rho, double theta, int threshold,
double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0), double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0),
double min_theta CV_DEFAULT(0), double max_theta CV_DEFAULT(CV_PI)); double min_theta CV_DEFAULT(0), double max_theta CV_DEFAULT(CV_PI));
/* Finds circles in the image */ /** @brief Finds circles in the image
@see cv::HoughCircles
*/
CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage, CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
int method, double dp, double min_dist, int method, double dp, double min_dist,
double param1 CV_DEFAULT(100), double param1 CV_DEFAULT(100),
...@@ -612,7 +962,9 @@ CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage, ...@@ -612,7 +962,9 @@ CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
int min_radius CV_DEFAULT(0), int min_radius CV_DEFAULT(0),
int max_radius CV_DEFAULT(0)); int max_radius CV_DEFAULT(0));
/* Fits a line into set of 2d or 3d points in a robust way (M-estimator technique) */ /** @brief Fits a line into set of 2d or 3d points in a robust way (M-estimator technique)
@see cv::fitLine
*/
CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param, CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param,
double reps, double aeps, float* line ); double reps, double aeps, float* line );
...@@ -635,34 +987,47 @@ CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param, ...@@ -635,34 +987,47 @@ CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param,
#define CV_AA 16 #define CV_AA 16
/* Draws 4-connected, 8-connected or antialiased line segment connecting two points */ /** @brief Draws 4-connected, 8-connected or antialiased line segment connecting two points
@see cv::line
*/
CVAPI(void) cvLine( CvArr* img, CvPoint pt1, CvPoint pt2, CVAPI(void) cvLine( CvArr* img, CvPoint pt1, CvPoint pt2,
CvScalar color, int thickness CV_DEFAULT(1), CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ); int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
/* Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2), /** @brief Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2)
if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn */
if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn
@see cv::rectangle
*/
CVAPI(void) cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2, CVAPI(void) cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2,
CvScalar color, int thickness CV_DEFAULT(1), CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int line_type CV_DEFAULT(8),
int shift CV_DEFAULT(0)); int shift CV_DEFAULT(0));
/* Draws a rectangle specified by a CvRect structure */ /** @brief Draws a rectangle specified by a CvRect structure
@see cv::rectangle
*/
CVAPI(void) cvRectangleR( CvArr* img, CvRect r, CVAPI(void) cvRectangleR( CvArr* img, CvRect r,
CvScalar color, int thickness CV_DEFAULT(1), CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int line_type CV_DEFAULT(8),
int shift CV_DEFAULT(0)); int shift CV_DEFAULT(0));
/* Draws a circle with specified center and radius. /** @brief Draws a circle with specified center and radius.
Thickness works in the same way as with cvRectangle */
Thickness works in the same way as with cvRectangle
@see cv::circle
*/
CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius, CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius,
CvScalar color, int thickness CV_DEFAULT(1), CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0)); int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
/* Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector, /** @brief Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector
depending on <thickness>, <start_angle> and <end_angle> parameters. The resultant figure
is rotated by <angle>. All the angles are in degrees */ depending on _thickness_, _start_angle_ and _end_angle_ parameters. The resultant figure
is rotated by _angle_. All the angles are in degrees
@see cv::ellipse
*/
CVAPI(void) cvEllipse( CvArr* img, CvPoint center, CvSize axes, CVAPI(void) cvEllipse( CvArr* img, CvPoint center, CvSize axes,
double angle, double start_angle, double end_angle, double angle, double start_angle, double end_angle,
CvScalar color, int thickness CV_DEFAULT(1), CvScalar color, int thickness CV_DEFAULT(1),
...@@ -680,16 +1045,22 @@ CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color, ...@@ -680,16 +1045,22 @@ CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
0, 360, color, thickness, line_type, shift ); 0, 360, color, thickness, line_type, shift );
} }
/* Fills convex or monotonous polygon. */ /** @brief Fills convex or monotonous polygon.
@see cv::fillConvexPoly
*/
CVAPI(void) cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color, CVAPI(void) cvFillConvexPoly( CvArr* img, const CvPoint* pts, int npts, CvScalar color,
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0)); int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
/* Fills an area bounded by one or more arbitrary polygons */ /** @brief Fills an area bounded by one or more arbitrary polygons
@see cv::fillPoly
*/
CVAPI(void) cvFillPoly( CvArr* img, CvPoint** pts, const int* npts, CVAPI(void) cvFillPoly( CvArr* img, CvPoint** pts, const int* npts,
int contours, CvScalar color, int contours, CvScalar color,
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ); int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
/* Draws one or more polygonal curves */ /** @brief Draws one or more polygonal curves
@see cv::polylines
*/
CVAPI(void) cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours, CVAPI(void) cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contours,
int is_closed, CvScalar color, int thickness CV_DEFAULT(1), int is_closed, CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ); int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
...@@ -700,20 +1071,25 @@ CVAPI(void) cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contour ...@@ -700,20 +1071,25 @@ CVAPI(void) cvPolyLine( CvArr* img, CvPoint** pts, const int* npts, int contour
#define cvDrawEllipse cvEllipse #define cvDrawEllipse cvEllipse
#define cvDrawPolyLine cvPolyLine #define cvDrawPolyLine cvPolyLine
/* Clips the line segment connecting *pt1 and *pt2 /** @brief Clips the line segment connecting *pt1 and *pt2
by the rectangular window by the rectangular window
(0<=x<img_size.width, 0<=y<img_size.height). */
(0<=x<img_size.width, 0<=y<img_size.height).
@see cv::clipLine
*/
CVAPI(int) cvClipLine( CvSize img_size, CvPoint* pt1, CvPoint* pt2 ); CVAPI(int) cvClipLine( CvSize img_size, CvPoint* pt1, CvPoint* pt2 );
/* Initializes line iterator. Initially, line_iterator->ptr will point /** @brief Initializes line iterator.
to pt1 (or pt2, see left_to_right description) location in the image.
Returns the number of pixels on the line between the ending points. */ Initially, line_iterator->ptr will point to pt1 (or pt2, see left_to_right description) location in
the image. Returns the number of pixels on the line between the ending points.
@see cv::LineIterator
*/
CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2, CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
CvLineIterator* line_iterator, CvLineIterator* line_iterator,
int connectivity CV_DEFAULT(8), int connectivity CV_DEFAULT(8),
int left_to_right CV_DEFAULT(0)); int left_to_right CV_DEFAULT(0));
/* Moves iterator to the next line point */
#define CV_NEXT_LINE_POINT( line_iterator ) \ #define CV_NEXT_LINE_POINT( line_iterator ) \
{ \ { \
int _line_iterator_mask = (line_iterator).err < 0 ? -1 : 0; \ int _line_iterator_mask = (line_iterator).err < 0 ? -1 : 0; \
...@@ -724,7 +1100,6 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2, ...@@ -724,7 +1100,6 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
} }
/* basic font types */
#define CV_FONT_HERSHEY_SIMPLEX 0 #define CV_FONT_HERSHEY_SIMPLEX 0
#define CV_FONT_HERSHEY_PLAIN 1 #define CV_FONT_HERSHEY_PLAIN 1
#define CV_FONT_HERSHEY_DUPLEX 2 #define CV_FONT_HERSHEY_DUPLEX 2
...@@ -734,30 +1109,45 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2, ...@@ -734,30 +1109,45 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
#define CV_FONT_HERSHEY_SCRIPT_SIMPLEX 6 #define CV_FONT_HERSHEY_SCRIPT_SIMPLEX 6
#define CV_FONT_HERSHEY_SCRIPT_COMPLEX 7 #define CV_FONT_HERSHEY_SCRIPT_COMPLEX 7
/* font flags */
#define CV_FONT_ITALIC 16 #define CV_FONT_ITALIC 16
#define CV_FONT_VECTOR0 CV_FONT_HERSHEY_SIMPLEX #define CV_FONT_VECTOR0 CV_FONT_HERSHEY_SIMPLEX
/* Font structure */ /** Font structure */
typedef struct CvFont typedef struct CvFont
{ {
const char* nameFont; //Qt:nameFont const char* nameFont; //Qt:nameFont
CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component]) CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red_component[, alpha_component])
int font_face; //Qt: bool italic /* =CV_FONT_* */ int font_face; //Qt: bool italic /** =CV_FONT_* */
const int* ascii; /* font data and metrics */ const int* ascii; //!< font data and metrics
const int* greek; const int* greek;
const int* cyrillic; const int* cyrillic;
float hscale, vscale; float hscale, vscale;
float shear; /* slope coefficient: 0 - normal, >0 - italic */ float shear; //!< slope coefficient: 0 - normal, >0 - italic
int thickness; //Qt: weight /* letters thickness */ int thickness; //!< Qt: weight /** letters thickness */
float dx; /* horizontal interval between letters */ float dx; //!< horizontal interval between letters
int line_type; //Qt: PointSize int line_type; //!< Qt: PointSize
} }
CvFont; CvFont;
/* Initializes font structure used further in cvPutText */ /** @brief Initializes font structure (OpenCV 1.x API).
The function initializes the font structure that can be passed to text rendering functions.
@param font Pointer to the font structure initialized by the function
@param font_face Font name identifier. See cv::HersheyFonts and corresponding old CV_* identifiers.
@param hscale Horizontal scale. If equal to 1.0f , the characters have the original width
depending on the font type. If equal to 0.5f , the characters are of half the original width.
@param vscale Vertical scale. If equal to 1.0f , the characters have the original height depending
on the font type. If equal to 0.5f , the characters are of half the original height.
@param shear Approximate tangent of the character slope relative to the vertical line. A zero
value means a non-italic font, 1.0f means about a 45 degree slope, etc.
@param thickness Thickness of the text strokes
@param line_type Type of the strokes, see line description
@sa cvPutText
*/
CVAPI(void) cvInitFont( CvFont* font, int font_face, CVAPI(void) cvInitFont( CvFont* font, int font_face,
double hscale, double vscale, double hscale, double vscale,
double shear CV_DEFAULT(0), double shear CV_DEFAULT(0),
...@@ -771,36 +1161,48 @@ CV_INLINE CvFont cvFont( double scale, int thickness CV_DEFAULT(1) ) ...@@ -771,36 +1161,48 @@ CV_INLINE CvFont cvFont( double scale, int thickness CV_DEFAULT(1) )
return font; return font;
} }
/* Renders text stroke with specified font and color at specified location. /** @brief Renders text stroke with specified font and color at specified location.
CvFont should be initialized with cvInitFont */ CvFont should be initialized with cvInitFont
@see cvInitFont, cvGetTextSize, cvFont, cv::putText
*/
CVAPI(void) cvPutText( CvArr* img, const char* text, CvPoint org, CVAPI(void) cvPutText( CvArr* img, const char* text, CvPoint org,
const CvFont* font, CvScalar color ); const CvFont* font, CvScalar color );
/* Calculates bounding box of text stroke (useful for alignment) */ /** @brief Calculates bounding box of text stroke (useful for alignment)
@see cv::getTextSize
*/
CVAPI(void) cvGetTextSize( const char* text_string, const CvFont* font, CVAPI(void) cvGetTextSize( const char* text_string, const CvFont* font,
CvSize* text_size, int* baseline ); CvSize* text_size, int* baseline );
/* Unpacks color value, if arrtype is CV_8UC?, <color> is treated as /** @brief Unpacks color value
packed color value, otherwise the first channels (depending on arrtype)
of destination scalar are set to the same value = <color> */ if arrtype is CV_8UC?, _color_ is treated as packed color value, otherwise the first channels
(depending on arrtype) of destination scalar are set to the same value = _color_
*/
CVAPI(CvScalar) cvColorToScalar( double packed_color, int arrtype ); CVAPI(CvScalar) cvColorToScalar( double packed_color, int arrtype );
/* Returns the polygon points which make up the given ellipse. The ellipse is define by /** @brief Returns the polygon points which make up the given ellipse.
the box of size 'axes' rotated 'angle' around the 'center'. A partial sweep
of the ellipse arc can be done by spcifying arc_start and arc_end to be something The ellipse is define by the box of size 'axes' rotated 'angle' around the 'center'. A partial
other than 0 and 360, respectively. The input array 'pts' must be large enough to sweep of the ellipse arc can be done by spcifying arc_start and arc_end to be something other than
hold the result. The total number of points stored into 'pts' is returned by this 0 and 360, respectively. The input array 'pts' must be large enough to hold the result. The total
function. */ number of points stored into 'pts' is returned by this function.
@see cv::ellipse2Poly
*/
CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes, CVAPI(int) cvEllipse2Poly( CvPoint center, CvSize axes,
int angle, int arc_start, int arc_end, CvPoint * pts, int delta ); int angle, int arc_start, int arc_end, CvPoint * pts, int delta );
/* Draws contour outlines or filled interiors on the image */ /** @brief Draws contour outlines or filled interiors on the image
@see cv::drawContours
*/
CVAPI(void) cvDrawContours( CvArr *img, CvSeq* contour, CVAPI(void) cvDrawContours( CvArr *img, CvSeq* contour,
CvScalar external_color, CvScalar hole_color, CvScalar external_color, CvScalar hole_color,
int max_level, int thickness CV_DEFAULT(1), int max_level, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int line_type CV_DEFAULT(8),
CvPoint offset CV_DEFAULT(cvPoint(0,0))); CvPoint offset CV_DEFAULT(cvPoint(0,0)));
/** @} */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -49,41 +49,55 @@ ...@@ -49,41 +49,55 @@
extern "C" { extern "C" {
#endif #endif
/* Connected component structure */ /** @addtogroup imgproc_c
@{
*/
/** Connected component structure */
typedef struct CvConnectedComp typedef struct CvConnectedComp
{ {
double area; /* area of the connected component */ double area; /**<area of the connected component */
CvScalar value; /* average color of the connected component */ CvScalar value; /**<average color of the connected component */
CvRect rect; /* ROI of the component */ CvRect rect; /**<ROI of the component */
CvSeq* contour; /* optional component boundary CvSeq* contour; /**<optional component boundary
(the contour might have child contours corresponding to the holes)*/ (the contour might have child contours corresponding to the holes)*/
} }
CvConnectedComp; CvConnectedComp;
/* Image smooth methods */ /** Image smooth methods */
enum enum SmoothMethod_c
{ {
/** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all 1's). If
you want to smooth different pixels with different-size box kernels, you can use the integral
image that is computed using integral */
CV_BLUR_NO_SCALE =0, CV_BLUR_NO_SCALE =0,
/** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all
1's) with subsequent scaling by \f$1/(\texttt{size1}\cdot\texttt{size2})\f$ */
CV_BLUR =1, CV_BLUR =1,
/** linear convolution with a \f$\texttt{size1}\times\texttt{size2}\f$ Gaussian kernel */
CV_GAUSSIAN =2, CV_GAUSSIAN =2,
/** median filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture */
CV_MEDIAN =3, CV_MEDIAN =3,
/** bilateral filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture, color
sigma= sigma1 and spatial sigma= sigma2. If size1=0, the aperture square side is set to
cvRound(sigma2\*1.5)\*2+1. See cv::bilateralFilter */
CV_BILATERAL =4 CV_BILATERAL =4
}; };
/* Filters used in pyramid decomposition */ /** Filters used in pyramid decomposition */
enum enum
{ {
CV_GAUSSIAN_5x5 = 7 CV_GAUSSIAN_5x5 = 7
}; };
/* Special filters */ /** Special filters */
enum enum
{ {
CV_SCHARR =-1, CV_SCHARR =-1,
CV_MAX_SOBEL_KSIZE =7 CV_MAX_SOBEL_KSIZE =7
}; };
/* Constants for color conversion */ /** Constants for color conversion */
enum enum
{ {
CV_BGR2BGRA =0, CV_BGR2BGRA =0,
...@@ -339,7 +353,7 @@ enum ...@@ -339,7 +353,7 @@ enum
}; };
/* Sub-pixel interpolation methods */ /** Sub-pixel interpolation methods */
enum enum
{ {
CV_INTER_NN =0, CV_INTER_NN =0,
...@@ -349,23 +363,25 @@ enum ...@@ -349,23 +363,25 @@ enum
CV_INTER_LANCZOS4 =4 CV_INTER_LANCZOS4 =4
}; };
/* ... and other image warping flags */ /** ... and other image warping flags */
enum enum
{ {
CV_WARP_FILL_OUTLIERS =8, CV_WARP_FILL_OUTLIERS =8,
CV_WARP_INVERSE_MAP =16 CV_WARP_INVERSE_MAP =16
}; };
/* Shapes of a structuring element for morphological operations */ /** Shapes of a structuring element for morphological operations
enum @see cv::MorphShapes, cv::getStructuringElement
*/
enum MorphShapes_c
{ {
CV_SHAPE_RECT =0, CV_SHAPE_RECT =0,
CV_SHAPE_CROSS =1, CV_SHAPE_CROSS =1,
CV_SHAPE_ELLIPSE =2, CV_SHAPE_ELLIPSE =2,
CV_SHAPE_CUSTOM =100 CV_SHAPE_CUSTOM =100 //!< custom structuring element
}; };
/* Morphological operations */ /** Morphological operations */
enum enum
{ {
CV_MOP_ERODE =0, CV_MOP_ERODE =0,
...@@ -377,12 +393,12 @@ enum ...@@ -377,12 +393,12 @@ enum
CV_MOP_BLACKHAT =6 CV_MOP_BLACKHAT =6
}; };
/* Spatial and central moments */ /** Spatial and central moments */
typedef struct CvMoments typedef struct CvMoments
{ {
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /**< spatial moments */
double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */ double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /**< central moments */
double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */ double inv_sqrt_m00; /**< m00 != 0 ? 1/sqrt(m00) : 0 */
#ifdef __cplusplus #ifdef __cplusplus
CvMoments(){} CvMoments(){}
...@@ -404,14 +420,14 @@ typedef struct CvMoments ...@@ -404,14 +420,14 @@ typedef struct CvMoments
} }
CvMoments; CvMoments;
/* Hu invariants */ /** Hu invariants */
typedef struct CvHuMoments typedef struct CvHuMoments
{ {
double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */ double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /**< Hu invariants */
} }
CvHuMoments; CvHuMoments;
/* Template matching methods */ /** Template matching methods */
enum enum
{ {
CV_TM_SQDIFF =0, CV_TM_SQDIFF =0,
...@@ -424,7 +440,7 @@ enum ...@@ -424,7 +440,7 @@ enum
typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param ); typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param );
/* Contour retrieval modes */ /** Contour retrieval modes */
enum enum
{ {
CV_RETR_EXTERNAL=0, CV_RETR_EXTERNAL=0,
...@@ -434,7 +450,7 @@ enum ...@@ -434,7 +450,7 @@ enum
CV_RETR_FLOODFILL=4 CV_RETR_FLOODFILL=4
}; };
/* Contour approximation methods */ /** Contour approximation methods */
enum enum
{ {
CV_CHAIN_CODE=0, CV_CHAIN_CODE=0,
...@@ -451,7 +467,7 @@ It supports both hierarchical and plane variants of Suzuki algorithm. ...@@ -451,7 +467,7 @@ It supports both hierarchical and plane variants of Suzuki algorithm.
*/ */
typedef struct _CvContourScanner* CvContourScanner; typedef struct _CvContourScanner* CvContourScanner;
/* Freeman chain reader state */ /** Freeman chain reader state */
typedef struct CvChainPtReader typedef struct CvChainPtReader
{ {
CV_SEQ_READER_FIELDS() CV_SEQ_READER_FIELDS()
...@@ -461,7 +477,7 @@ typedef struct CvChainPtReader ...@@ -461,7 +477,7 @@ typedef struct CvChainPtReader
} }
CvChainPtReader; CvChainPtReader;
/* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */ /** initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
#define CV_INIT_3X3_DELTAS( deltas, step, nch ) \ #define CV_INIT_3X3_DELTAS( deltas, step, nch ) \
((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \ ((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
(deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \ (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \
...@@ -469,21 +485,28 @@ CvChainPtReader; ...@@ -469,21 +485,28 @@ CvChainPtReader;
(deltas)[6] = (step), (deltas)[7] = (step) + (nch)) (deltas)[6] = (step), (deltas)[7] = (step) + (nch))
/* Contour approximation algorithms */ /** Contour approximation algorithms */
enum enum
{ {
CV_POLY_APPROX_DP = 0 CV_POLY_APPROX_DP = 0
}; };
/* Shape matching methods */ /** @brief Shape matching methods
enum
\f$A\f$ denotes object1,\f$B\f$ denotes object2
\f$\begin{array}{l} m^A_i = \mathrm{sign} (h^A_i) \cdot \log{h^A_i} \\ m^B_i = \mathrm{sign} (h^B_i) \cdot \log{h^B_i} \end{array}\f$
and \f$h^A_i, h^B_i\f$ are the Hu moments of \f$A\f$ and \f$B\f$ , respectively.
*/
enum ShapeMatchModes
{ {
CV_CONTOURS_MATCH_I1 =1, CV_CONTOURS_MATCH_I1 =1, //!< \f[I_1(A,B) = \sum _{i=1...7} \left | \frac{1}{m^A_i} - \frac{1}{m^B_i} \right |\f]
CV_CONTOURS_MATCH_I2 =2, CV_CONTOURS_MATCH_I2 =2, //!< \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f]
CV_CONTOURS_MATCH_I3 =3 CV_CONTOURS_MATCH_I3 =3 //!< \f[I_3(A,B) = \max _{i=1...7} \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f]
}; };
/* Shape orientation */ /** Shape orientation */
enum enum
{ {
CV_CLOCKWISE =1, CV_CLOCKWISE =1,
...@@ -491,17 +514,17 @@ enum ...@@ -491,17 +514,17 @@ enum
}; };
/* Convexity defect */ /** Convexity defect */
typedef struct CvConvexityDefect typedef struct CvConvexityDefect
{ {
CvPoint* start; /* point of the contour where the defect begins */ CvPoint* start; /**< point of the contour where the defect begins */
CvPoint* end; /* point of the contour where the defect ends */ CvPoint* end; /**< point of the contour where the defect ends */
CvPoint* depth_point; /* the farthest from the convex hull point within the defect */ CvPoint* depth_point; /**< the farthest from the convex hull point within the defect */
float depth; /* distance between the farthest point and the convex hull */ float depth; /**< distance between the farthest point and the convex hull */
} CvConvexityDefect; } CvConvexityDefect;
/* Histogram comparison methods */ /** Histogram comparison methods */
enum enum
{ {
CV_COMP_CORREL =0, CV_COMP_CORREL =0,
...@@ -513,7 +536,7 @@ enum ...@@ -513,7 +536,7 @@ enum
CV_COMP_KL_DIV =5 CV_COMP_KL_DIV =5
}; };
/* Mask size for distance transform */ /** Mask size for distance transform */
enum enum
{ {
CV_DIST_MASK_3 =3, CV_DIST_MASK_3 =3,
...@@ -521,51 +544,51 @@ enum ...@@ -521,51 +544,51 @@ enum
CV_DIST_MASK_PRECISE =0 CV_DIST_MASK_PRECISE =0
}; };
/* Content of output label array: connected components or pixels */ /** Content of output label array: connected components or pixels */
enum enum
{ {
CV_DIST_LABEL_CCOMP = 0, CV_DIST_LABEL_CCOMP = 0,
CV_DIST_LABEL_PIXEL = 1 CV_DIST_LABEL_PIXEL = 1
}; };
/* Distance types for Distance Transform and M-estimators */ /** Distance types for Distance Transform and M-estimators */
enum enum
{ {
CV_DIST_USER =-1, /* User defined distance */ CV_DIST_USER =-1, /**< User defined distance */
CV_DIST_L1 =1, /* distance = |x1-x2| + |y1-y2| */ CV_DIST_L1 =1, /**< distance = |x1-x2| + |y1-y2| */
CV_DIST_L2 =2, /* the simple euclidean distance */ CV_DIST_L2 =2, /**< the simple euclidean distance */
CV_DIST_C =3, /* distance = max(|x1-x2|,|y1-y2|) */ CV_DIST_C =3, /**< distance = max(|x1-x2|,|y1-y2|) */
CV_DIST_L12 =4, /* L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */ CV_DIST_L12 =4, /**< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
CV_DIST_FAIR =5, /* distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */ CV_DIST_FAIR =5, /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
CV_DIST_WELSCH =6, /* distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */ CV_DIST_WELSCH =6, /**< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
CV_DIST_HUBER =7 /* distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */ CV_DIST_HUBER =7 /**< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
}; };
/* Threshold types */ /** Threshold types */
enum enum
{ {
CV_THRESH_BINARY =0, /* value = value > threshold ? max_value : 0 */ CV_THRESH_BINARY =0, /**< value = value > threshold ? max_value : 0 */
CV_THRESH_BINARY_INV =1, /* value = value > threshold ? 0 : max_value */ CV_THRESH_BINARY_INV =1, /**< value = value > threshold ? 0 : max_value */
CV_THRESH_TRUNC =2, /* value = value > threshold ? threshold : value */ CV_THRESH_TRUNC =2, /**< value = value > threshold ? threshold : value */
CV_THRESH_TOZERO =3, /* value = value > threshold ? value : 0 */ CV_THRESH_TOZERO =3, /**< value = value > threshold ? value : 0 */
CV_THRESH_TOZERO_INV =4, /* value = value > threshold ? 0 : value */ CV_THRESH_TOZERO_INV =4, /**< value = value > threshold ? 0 : value */
CV_THRESH_MASK =7, CV_THRESH_MASK =7,
CV_THRESH_OTSU =8, /* use Otsu algorithm to choose the optimal threshold value; CV_THRESH_OTSU =8, /**< use Otsu algorithm to choose the optimal threshold value;
combine the flag with one of the above CV_THRESH_* values */ combine the flag with one of the above CV_THRESH_* values */
CV_THRESH_TRIANGLE =16 /* use Triangle algorithm to choose the optimal threshold value; CV_THRESH_TRIANGLE =16 /**< use Triangle algorithm to choose the optimal threshold value;
combine the flag with one of the above CV_THRESH_* values, but not combine the flag with one of the above CV_THRESH_* values, but not
with CV_THRESH_OTSU */ with CV_THRESH_OTSU */
}; };
/* Adaptive threshold methods */ /** Adaptive threshold methods */
enum enum
{ {
CV_ADAPTIVE_THRESH_MEAN_C =0, CV_ADAPTIVE_THRESH_MEAN_C =0,
CV_ADAPTIVE_THRESH_GAUSSIAN_C =1 CV_ADAPTIVE_THRESH_GAUSSIAN_C =1
}; };
/* FloodFill flags */ /** FloodFill flags */
enum enum
{ {
CV_FLOODFILL_FIXED_RANGE =(1 << 16), CV_FLOODFILL_FIXED_RANGE =(1 << 16),
...@@ -573,13 +596,13 @@ enum ...@@ -573,13 +596,13 @@ enum
}; };
/* Canny edge detector flags */ /** Canny edge detector flags */
enum enum
{ {
CV_CANNY_L2_GRADIENT =(1 << 31) CV_CANNY_L2_GRADIENT =(1 << 31)
}; };
/* Variants of a Hough transform */ /** Variants of a Hough transform */
enum enum
{ {
CV_HOUGH_STANDARD =0, CV_HOUGH_STANDARD =0,
...@@ -594,6 +617,8 @@ struct CvFeatureTree; ...@@ -594,6 +617,8 @@ struct CvFeatureTree;
struct CvLSH; struct CvLSH;
struct CvLSHOperations; struct CvLSHOperations;
/** @} */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment