Merge pull request #3426 from mshabunin:doxygen-imgproc

This commit is contained in:
Vadim Pisarevsky 2014-12-01 10:43:13 +00:00
commit 02f4f2f96d
14 changed files with 4429 additions and 922 deletions

View File

@ -85,7 +85,7 @@ SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE = @CMAKE_DOXYGEN_LAYOUT@
CITE_BIB_FILES =
CITE_BIB_FILES = @CMAKE_CURRENT_SOURCE_DIR@/opencv.bib
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
@ -100,7 +100,7 @@ RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = cv::DataType<*>
EXCLUDE_SYMBOLS = cv::DataType<*> int
EXAMPLE_PATH = @CMAKE_DOXYGEN_EXAMPLE_PATH@
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = YES
@ -159,8 +159,8 @@ QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
ENUM_VALUES_PER_LINE = 0
GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 1
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = YES
FORMULA_FONTSIZE = 14

View File

@ -1,12 +1,15 @@
MathJax.Hub.Config({
TeX: {
Macros: {
matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9]
}
}
});
MathJax.Hub.Config(
{
TeX: {
Macros: {
matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
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]
}
}
}
);

View File

@ -291,6 +291,108 @@
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]])
# '''[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).

View File

@ -1,7 +1,11 @@
OpenCV modules {#mainpage}
==============
- @subpage intro
- @subpage core
@subpage intro
Module name | Folder
------------- | -------------
@ref core | core
@ref imgproc | imgproc
<!-- @CMAKE_DOXYGEN_MODULES_REFERENCE@ -->

View File

@ -11,7 +11,7 @@ libraries. The following modules are available:
- @ref core - a compact module defining basic data structures, including the dense
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
remapping), color space conversion, histograms, and so on.
- **video** - a video analysis module that includes motion estimation, background subtraction,

View File

@ -194,22 +194,27 @@ enum KmeansFlags {
KMEANS_USE_INITIAL_LABELS = 1
};
enum { FILLED = -1,
LINE_4 = 4,
LINE_8 = 8,
LINE_AA = 16
};
//! type of line
enum LineTypes {
FILLED = -1,
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,
FONT_HERSHEY_COMPLEX = 3,
FONT_HERSHEY_TRIPLEX = 4,
FONT_HERSHEY_COMPLEX_SMALL = 5,
FONT_HERSHEY_SCRIPT_SIMPLEX = 6,
FONT_HERSHEY_SCRIPT_COMPLEX = 7,
FONT_ITALIC = 16
};
//! Only a subset of Hershey fonts
//! <http://sources.isc.org/utils/misc/hershey-font.txt> are supported
enum HersheyFonts {
FONT_HERSHEY_SIMPLEX = 0, //!< normal size sans-serif font
FONT_HERSHEY_PLAIN = 1, //!< small size sans-serif font
FONT_HERSHEY_DUPLEX = 2, //!< normal size sans-serif font (more complex than FONT_HERSHEY_SIMPLEX)
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.
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,
//! @} 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
//! @{
@ -2806,7 +2739,6 @@ public:
};
//////////////////////////////////////// Algorithm ////////////////////////////////////
class CV_EXPORTS Algorithm;

View File

@ -353,43 +353,6 @@ inline unsigned RNG::next()
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
template<typename _Tp> static inline _Tp randu()
{

View File

@ -804,6 +804,36 @@ public:
//! @{
/** @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
{

View File

@ -170,7 +170,7 @@ CV_EXPORTS void updateWindow(const String& winname);
struct QtFont
{
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
const int* ascii; // font data and metrics
const int* greek;

View File

@ -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)
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));

View File

@ -0,0 +1,160 @@
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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -49,41 +49,55 @@
extern "C" {
#endif
/* Connected component structure */
/** @addtogroup imgproc_c
@{
*/
/** Connected component structure */
typedef struct CvConnectedComp
{
double area; /* area of the connected component */
CvScalar value; /* average color of the connected component */
CvRect rect; /* ROI of the component */
CvSeq* contour; /* optional component boundary
double area; /**<area of the connected component */
CvScalar value; /**<average color of the connected component */
CvRect rect; /**<ROI of the component */
CvSeq* contour; /**<optional component boundary
(the contour might have child contours corresponding to the holes)*/
}
CvConnectedComp;
/* Image smooth methods */
enum
/** Image smooth methods */
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,
/** 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,
/** linear convolution with a \f$\texttt{size1}\times\texttt{size2}\f$ Gaussian kernel */
CV_GAUSSIAN =2,
/** median filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture */
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
};
/* Filters used in pyramid decomposition */
/** Filters used in pyramid decomposition */
enum
{
CV_GAUSSIAN_5x5 = 7
};
/* Special filters */
/** Special filters */
enum
{
CV_SCHARR =-1,
CV_MAX_SOBEL_KSIZE =7
};
/* Constants for color conversion */
/** Constants for color conversion */
enum
{
CV_BGR2BGRA =0,
@ -339,7 +353,7 @@ enum
};
/* Sub-pixel interpolation methods */
/** Sub-pixel interpolation methods */
enum
{
CV_INTER_NN =0,
@ -349,23 +363,25 @@ enum
CV_INTER_LANCZOS4 =4
};
/* ... and other image warping flags */
/** ... and other image warping flags */
enum
{
CV_WARP_FILL_OUTLIERS =8,
CV_WARP_INVERSE_MAP =16
};
/* Shapes of a structuring element for morphological operations */
enum
/** Shapes of a structuring element for morphological operations
@see cv::MorphShapes, cv::getStructuringElement
*/
enum MorphShapes_c
{
CV_SHAPE_RECT =0,
CV_SHAPE_CROSS =1,
CV_SHAPE_ELLIPSE =2,
CV_SHAPE_CUSTOM =100
CV_SHAPE_CUSTOM =100 //!< custom structuring element
};
/* Morphological operations */
/** Morphological operations */
enum
{
CV_MOP_ERODE =0,
@ -377,12 +393,12 @@ enum
CV_MOP_BLACKHAT =6
};
/* Spatial and central moments */
/** Spatial and central moments */
typedef struct CvMoments
{
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */
double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */
double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */
double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /**< spatial moments */
double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /**< central moments */
double inv_sqrt_m00; /**< m00 != 0 ? 1/sqrt(m00) : 0 */
#ifdef __cplusplus
CvMoments(){}
@ -404,14 +420,14 @@ typedef struct CvMoments
}
CvMoments;
/* Hu invariants */
/** Hu invariants */
typedef struct CvHuMoments
{
double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */
double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /**< Hu invariants */
}
CvHuMoments;
/* Template matching methods */
/** Template matching methods */
enum
{
CV_TM_SQDIFF =0,
@ -424,7 +440,7 @@ enum
typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param );
/* Contour retrieval modes */
/** Contour retrieval modes */
enum
{
CV_RETR_EXTERNAL=0,
@ -434,7 +450,7 @@ enum
CV_RETR_FLOODFILL=4
};
/* Contour approximation methods */
/** Contour approximation methods */
enum
{
CV_CHAIN_CODE=0,
@ -451,7 +467,7 @@ It supports both hierarchical and plane variants of Suzuki algorithm.
*/
typedef struct _CvContourScanner* CvContourScanner;
/* Freeman chain reader state */
/** Freeman chain reader state */
typedef struct CvChainPtReader
{
CV_SEQ_READER_FIELDS()
@ -461,7 +477,7 @@ typedef struct 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 ) \
((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
(deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \
@ -469,21 +485,28 @@ CvChainPtReader;
(deltas)[6] = (step), (deltas)[7] = (step) + (nch))
/* Contour approximation algorithms */
/** Contour approximation algorithms */
enum
{
CV_POLY_APPROX_DP = 0
};
/* Shape matching methods */
enum
/** @brief Shape matching methods
\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_I2 =2,
CV_CONTOURS_MATCH_I3 =3
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, //!< \f[I_2(A,B) = \sum _{i=1...7} \left | m^A_i - m^B_i \right |\f]
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
{
CV_CLOCKWISE =1,
@ -491,17 +514,17 @@ enum
};
/* Convexity defect */
/** Convexity defect */
typedef struct CvConvexityDefect
{
CvPoint* start; /* point of the contour where the defect begins */
CvPoint* end; /* point of the contour where the defect ends */
CvPoint* depth_point; /* the farthest from the convex hull point within the defect */
float depth; /* distance between the farthest point and the convex hull */
CvPoint* start; /**< point of the contour where the defect begins */
CvPoint* end; /**< point of the contour where the defect ends */
CvPoint* depth_point; /**< the farthest from the convex hull point within the defect */
float depth; /**< distance between the farthest point and the convex hull */
} CvConvexityDefect;
/* Histogram comparison methods */
/** Histogram comparison methods */
enum
{
CV_COMP_CORREL =0,
@ -513,7 +536,7 @@ enum
CV_COMP_KL_DIV =5
};
/* Mask size for distance transform */
/** Mask size for distance transform */
enum
{
CV_DIST_MASK_3 =3,
@ -521,51 +544,51 @@ enum
CV_DIST_MASK_PRECISE =0
};
/* Content of output label array: connected components or pixels */
/** Content of output label array: connected components or pixels */
enum
{
CV_DIST_LABEL_CCOMP = 0,
CV_DIST_LABEL_PIXEL = 1
};
/* Distance types for Distance Transform and M-estimators */
/** Distance types for Distance Transform and M-estimators */
enum
{
CV_DIST_USER =-1, /* User defined distance */
CV_DIST_L1 =1, /* distance = |x1-x2| + |y1-y2| */
CV_DIST_L2 =2, /* the simple euclidean distance */
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_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_HUBER =7 /* distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
CV_DIST_USER =-1, /**< User defined distance */
CV_DIST_L1 =1, /**< distance = |x1-x2| + |y1-y2| */
CV_DIST_L2 =2, /**< the simple euclidean distance */
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_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_HUBER =7 /**< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
};
/* Threshold types */
/** Threshold types */
enum
{
CV_THRESH_BINARY =0, /* value = value > threshold ? max_value : 0 */
CV_THRESH_BINARY_INV =1, /* value = value > threshold ? 0 : max_value */
CV_THRESH_TRUNC =2, /* value = value > threshold ? threshold : value */
CV_THRESH_TOZERO =3, /* value = value > threshold ? value : 0 */
CV_THRESH_TOZERO_INV =4, /* value = value > threshold ? 0 : value */
CV_THRESH_BINARY =0, /**< value = value > threshold ? max_value : 0 */
CV_THRESH_BINARY_INV =1, /**< value = value > threshold ? 0 : max_value */
CV_THRESH_TRUNC =2, /**< value = value > threshold ? threshold : value */
CV_THRESH_TOZERO =3, /**< value = value > threshold ? value : 0 */
CV_THRESH_TOZERO_INV =4, /**< value = value > threshold ? 0 : value */
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 */
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
with CV_THRESH_OTSU */
};
/* Adaptive threshold methods */
/** Adaptive threshold methods */
enum
{
CV_ADAPTIVE_THRESH_MEAN_C =0,
CV_ADAPTIVE_THRESH_GAUSSIAN_C =1
};
/* FloodFill flags */
/** FloodFill flags */
enum
{
CV_FLOODFILL_FIXED_RANGE =(1 << 16),
@ -573,13 +596,13 @@ enum
};
/* Canny edge detector flags */
/** Canny edge detector flags */
enum
{
CV_CANNY_L2_GRADIENT =(1 << 31)
};
/* Variants of a Hough transform */
/** Variants of a Hough transform */
enum
{
CV_HOUGH_STANDARD =0,
@ -594,6 +617,8 @@ struct CvFeatureTree;
struct CvLSH;
struct CvLSHOperations;
/** @} */
#ifdef __cplusplus
}
#endif