Updated documentation to new "COLOR_" format for color conversion enums.
This commit is contained in:
@@ -1475,7 +1475,7 @@ Such a scheme makes the memory management robust and efficient at the same time
|
||||
Mat color;
|
||||
...
|
||||
Mat gray(color.rows, color.cols, color.depth());
|
||||
cvtColor(color, gray, CV_BGR2GRAY);
|
||||
cvtColor(color, gray, COLOR_BGR2GRAY);
|
||||
|
||||
|
||||
you can simply write: ::
|
||||
@@ -1483,7 +1483,7 @@ you can simply write: ::
|
||||
Mat color;
|
||||
...
|
||||
Mat gray;
|
||||
cvtColor(color, gray, CV_BGR2GRAY);
|
||||
cvtColor(color, gray, COLOR_BGR2GRAY);
|
||||
|
||||
|
||||
because ``cvtColor`` , as well as the most of OpenCV functions, calls ``Mat::create()`` for the output array internally.
|
||||
|
||||
@@ -128,7 +128,7 @@ Example: ::
|
||||
return 0;
|
||||
}
|
||||
|
||||
The array ``frame`` is automatically allocated by the ``>>`` operator since the video frame resolution and the bit-depth is known to the video capturing module. The array ``edges`` is automatically allocated by the ``cvtColor`` function. It has the same size and the bit-depth as the input array. The number of channels is 1 because the color conversion code ``CV_BGR2GRAY`` is passed, which means a color to grayscale conversion. Note that ``frame`` and ``edges`` are allocated only once during the first execution of the loop body since all the next video frames have the same resolution. If you somehow change the video resolution, the arrays are automatically reallocated.
|
||||
The array ``frame`` is automatically allocated by the ``>>`` operator since the video frame resolution and the bit-depth is known to the video capturing module. The array ``edges`` is automatically allocated by the ``cvtColor`` function. It has the same size and the bit-depth as the input array. The number of channels is 1 because the color conversion code ``COLOR_BGR2GRAY`` is passed, which means a color to grayscale conversion. Note that ``frame`` and ``edges`` are allocated only once during the first execution of the loop body since all the next video frames have the same resolution. If you somehow change the video resolution, the arrays are automatically reallocated.
|
||||
|
||||
The key component of this technology is the ``Mat::create`` method. It takes the desired array size and type. If the array already has the specified size and type, the method does nothing. Otherwise, it releases the previously allocated data, if any (this part involves decrementing the reference counter and comparing it with zero), and then allocates a new buffer of the required size. Most functions call the ``Mat::create`` method for each output array, and so the automatic output data allocation is implemented.
|
||||
|
||||
|
||||
@@ -3447,7 +3447,7 @@ function does not copy ``src`` itself but simply constructs the border, for exam
|
||||
// select the middle part of it w/o copying data
|
||||
Mat gray(gray_canvas, Rect(border, border, rgb.cols, rgb.rows));
|
||||
// convert image from RGB to grayscale
|
||||
cvtColor(rgb, gray, CV_RGB2GRAY);
|
||||
cvtColor(rgb, gray, COLOR_RGB2GRAY);
|
||||
// form a border in-place
|
||||
copyMakeBorder(gray, gray_buf, border, border,
|
||||
border, border, BORDER_REPLICATE);
|
||||
|
||||
Reference in New Issue
Block a user