Commit 555fdf89 authored by Maksim Shabunin's avatar Maksim Shabunin

Documenting imgproc module

- disabled doxygen tree
- enabled doxygen enum listing
- added imgproc reference to main page
- enabled BiB support
- chenged doxygen root page format
parent 32348604
......@@ -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
......
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]
}
}
}
);
......@@ -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).
......
OpenCV modules {#mainpage}
==============
- @subpage intro
- @subpage core
@subpage intro
Module name | Folder
------------- | -------------
@ref core | core
@ref imgproc | imgproc
<!-- @CMAKE_DOXYGEN_MODULES_REFERENCE@ -->
......@@ -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,
......
......@@ -194,22 +194,27 @@ enum KmeansFlags {
KMEANS_USE_INITIAL_LABELS = 1
};
enum { FILLED = -1,
LINE_4 = 4,
LINE_8 = 8,
LINE_AA = 16
};
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
};
//! type of line
enum LineTypes {
FILLED = -1,
LINE_4 = 4, //!< 4-connected line
LINE_8 = 8, //!< 8-connected line
LINE_AA = 16 //!< antialiased line
};
//! 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;
......
......@@ -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()
{
......
......@@ -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
{
......
......@@ -168,7 +168,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;
......
......@@ -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));
......
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 diff is collapsed.
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