Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4d0ed5c1
Commit
4d0ed5c1
authored
Oct 31, 2018
by
Suleyman TURKMEN
Committed by
Alexander Alekhin
Oct 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge pull request #12971 from sturkmen72:upd_imgproc_hpp
* Update imgproc.hpp * update color conversion codes
parent
fcb56a54
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
294 additions
and
232 deletions
+294
-232
grfmt_webp.cpp
modules/imgcodecs/src/grfmt_webp.cpp
+1
-1
test_png.cpp
modules/imgcodecs/test/test_png.cpp
+1
-1
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+109
-47
demosaicing.cpp
modules/imgproc/src/demosaicing.cpp
+19
-19
test_color.cpp
modules/imgproc/test/test_color.cpp
+52
-52
test_cvtyuv.cpp
modules/imgproc/test/test_cvtyuv.cpp
+111
-111
test_goodfeaturetotrack.cpp
modules/imgproc/test/test_goodfeaturetotrack.cpp
+1
-1
No files found.
modules/imgcodecs/src/grfmt_webp.cpp
View file @
4d0ed5c1
...
@@ -266,7 +266,7 @@ bool WebPEncoder::write(const Mat& img, const std::vector<int>& params)
...
@@ -266,7 +266,7 @@ bool WebPEncoder::write(const Mat& img, const std::vector<int>& params)
if
(
channels
==
1
)
if
(
channels
==
1
)
{
{
cvtColor
(
*
image
,
temp
,
C
V
_GRAY2BGR
);
cvtColor
(
*
image
,
temp
,
C
OLOR
_GRAY2BGR
);
image
=
&
temp
;
image
=
&
temp
;
channels
=
3
;
channels
=
3
;
}
}
...
...
modules/imgcodecs/test/test_png.cpp
View file @
4d0ed5c1
...
@@ -42,7 +42,7 @@ TEST(Imgcodecs_Png, regression_ImreadVSCvtColor)
...
@@ -42,7 +42,7 @@ TEST(Imgcodecs_Png, regression_ImreadVSCvtColor)
Mat
original_image
=
imread
(
imgName
);
Mat
original_image
=
imread
(
imgName
);
Mat
gray_by_codec
=
imread
(
imgName
,
IMREAD_GRAYSCALE
);
Mat
gray_by_codec
=
imread
(
imgName
,
IMREAD_GRAYSCALE
);
Mat
gray_by_cvt
;
Mat
gray_by_cvt
;
cvtColor
(
original_image
,
gray_by_cvt
,
C
V
_BGR2GRAY
);
cvtColor
(
original_image
,
gray_by_cvt
,
C
OLOR
_BGR2GRAY
);
Mat
diff
;
Mat
diff
;
absdiff
(
gray_by_codec
,
gray_by_cvt
,
diff
);
absdiff
(
gray_by_codec
,
gray_by_cvt
,
diff
);
...
...
modules/imgproc/include/opencv2/imgproc.hpp
View file @
4d0ed5c1
...
@@ -46,7 +46,10 @@
...
@@ -46,7 +46,10 @@
#include "opencv2/core.hpp"
#include "opencv2/core.hpp"
/**
/**
@defgroup imgproc Image processing
@defgroup imgproc Image Processing
This module includes image-processing functions.
@{
@{
@defgroup imgproc_filter Image Filtering
@defgroup imgproc_filter Image Filtering
...
@@ -148,6 +151,7 @@ case, the color[3] is simply copied to the repainted pixels. Thus, if you want t
...
@@ -148,6 +151,7 @@ case, the color[3] is simply copied to the repainted pixels. Thus, if you want t
semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main
semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main
image.
image.
@defgroup imgproc_color_conversions Color Space Conversions
@defgroup imgproc_colormap ColorMaps in OpenCV
@defgroup imgproc_colormap ColorMaps in OpenCV
The human perception isn't built for observing fine changes in grayscale images. Human eyes are more
The human perception isn't built for observing fine changes in grayscale images. Human eyes are more
...
@@ -450,6 +454,9 @@ enum ShapeMatchModes {
...
@@ -450,6 +454,9 @@ enum ShapeMatchModes {
//! @} imgproc_shape
//! @} imgproc_shape
//! @addtogroup imgproc_feature
//! @{
//! Variants of a Hough transform
//! Variants of a Hough transform
enum
HoughModes
{
enum
HoughModes
{
...
@@ -470,7 +477,6 @@ enum HoughModes {
...
@@ -470,7 +477,6 @@ enum HoughModes {
};
};
//! Variants of Line Segment %Detector
//! Variants of Line Segment %Detector
//! @ingroup imgproc_feature
enum
LineSegmentDetectorModes
{
enum
LineSegmentDetectorModes
{
LSD_REFINE_NONE
=
0
,
//!< No refinement applied
LSD_REFINE_NONE
=
0
,
//!< No refinement applied
LSD_REFINE_STD
=
1
,
//!< Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations.
LSD_REFINE_STD
=
1
,
//!< Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations.
...
@@ -478,6 +484,8 @@ enum LineSegmentDetectorModes {
...
@@ -478,6 +484,8 @@ enum LineSegmentDetectorModes {
//!< refined through increase of precision, decrement in size, etc.
//!< refined through increase of precision, decrement in size, etc.
};
};
//! @} imgproc_feature
/** Histogram comparison methods
/** Histogram comparison methods
@ingroup imgproc_hist
@ingroup imgproc_hist
*/
*/
...
@@ -508,9 +516,9 @@ enum HistCompMethods {
...
@@ -508,9 +516,9 @@ enum HistCompMethods {
HISTCMP_KL_DIV
=
5
HISTCMP_KL_DIV
=
5
};
};
/** the color conversion code
/** the color conversion code
s
@see @ref imgproc_color_conversions
@see @ref imgproc_color_conversions
@ingroup imgproc_
misc
@ingroup imgproc_
color_conversions
*/
*/
enum
ColorConversionCodes
{
enum
ColorConversionCodes
{
COLOR_BGR2BGRA
=
0
,
//!< add alpha channel to RGB or BGR image
COLOR_BGR2BGRA
=
0
,
//!< add alpha channel to RGB or BGR image
...
@@ -595,7 +603,7 @@ enum ColorConversionCodes {
...
@@ -595,7 +603,7 @@ enum ColorConversionCodes {
COLOR_HLS2BGR
=
60
,
COLOR_HLS2BGR
=
60
,
COLOR_HLS2RGB
=
61
,
COLOR_HLS2RGB
=
61
,
COLOR_BGR2HSV_FULL
=
66
,
//!<
COLOR_BGR2HSV_FULL
=
66
,
COLOR_RGB2HSV_FULL
=
67
,
COLOR_RGB2HSV_FULL
=
67
,
COLOR_BGR2HLS_FULL
=
68
,
COLOR_BGR2HLS_FULL
=
68
,
COLOR_RGB2HLS_FULL
=
69
,
COLOR_RGB2HLS_FULL
=
69
,
...
@@ -779,16 +787,18 @@ enum ColorConversionCodes {
...
@@ -779,16 +787,18 @@ enum ColorConversionCodes {
COLOR_COLORCVT_MAX
=
143
COLOR_COLORCVT_MAX
=
143
};
};
/** types of intersection between rectangles
//! @addtogroup imgproc_shape
@ingroup imgproc_shape
//! @{
*/
//! types of intersection between rectangles
enum
RectanglesIntersectTypes
{
enum
RectanglesIntersectTypes
{
INTERSECT_NONE
=
0
,
//!< No intersection
INTERSECT_NONE
=
0
,
//!< No intersection
INTERSECT_PARTIAL
=
1
,
//!< There is a partial intersection
INTERSECT_PARTIAL
=
1
,
//!< There is a partial intersection
INTERSECT_FULL
=
2
//!< One of the rectangle is fully enclosed in the other
INTERSECT_FULL
=
2
//!< One of the rectangle is fully enclosed in the other
};
};
//! finds arbitrary template in the grayscale image using Generalized Hough Transform
/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform
*/
class
CV_EXPORTS
GeneralizedHough
:
public
Algorithm
class
CV_EXPORTS
GeneralizedHough
:
public
Algorithm
{
{
public
:
public
:
...
@@ -821,8 +831,10 @@ public:
...
@@ -821,8 +831,10 @@ public:
virtual
int
getMaxBufferSize
()
const
=
0
;
virtual
int
getMaxBufferSize
()
const
=
0
;
};
};
//! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform
//! Detects position only without translation and rotation
Detects position only without translation and rotation @cite Ballard1981 .
*/
class
CV_EXPORTS
GeneralizedHoughBallard
:
public
GeneralizedHough
class
CV_EXPORTS
GeneralizedHoughBallard
:
public
GeneralizedHough
{
{
public
:
public
:
...
@@ -835,8 +847,10 @@ public:
...
@@ -835,8 +847,10 @@ public:
virtual
int
getVotesThreshold
()
const
=
0
;
virtual
int
getVotesThreshold
()
const
=
0
;
};
};
//! Guil, N., González-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038.
/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform
//! Detects position, translation and rotation
Detects position, translation and rotation @cite Guil1999 .
*/
class
CV_EXPORTS
GeneralizedHoughGuil
:
public
GeneralizedHough
class
CV_EXPORTS
GeneralizedHoughGuil
:
public
GeneralizedHough
{
{
public
:
public
:
...
@@ -889,14 +903,19 @@ public:
...
@@ -889,14 +903,19 @@ public:
virtual
int
getPosThresh
()
const
=
0
;
virtual
int
getPosThresh
()
const
=
0
;
};
};
/** @brief Base class for Contrast Limited Adaptive Histogram Equalization. :
//! @} imgproc_shape
*/
//! @addtogroup imgproc_hist
//! @{
/** @brief Base class for Contrast Limited Adaptive Histogram Equalization.
*/
class
CV_EXPORTS_W
CLAHE
:
public
Algorithm
class
CV_EXPORTS_W
CLAHE
:
public
Algorithm
{
{
public
:
public
:
/** @brief Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.
/** @brief Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.
@param src Source image
with CV_8UC1 type
.
@param src Source image
of type CV_8UC1 or CV_16UC1
.
@param dst Destination image.
@param dst Destination image.
*/
*/
CV_WRAP
virtual
void
apply
(
InputArray
src
,
OutputArray
dst
)
=
0
;
CV_WRAP
virtual
void
apply
(
InputArray
src
,
OutputArray
dst
)
=
0
;
...
@@ -923,6 +942,7 @@ public:
...
@@ -923,6 +942,7 @@ public:
CV_WRAP
virtual
void
collectGarbage
()
=
0
;
CV_WRAP
virtual
void
collectGarbage
()
=
0
;
};
};
//! @} imgproc_hist
//! @addtogroup imgproc_subdiv2d
//! @addtogroup imgproc_subdiv2d
//! @{
//! @{
...
@@ -1464,8 +1484,8 @@ pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$.
...
@@ -1464,8 +1484,8 @@ pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$.
The unnormalized square box filter can be useful in computing local image statistics such as the the local
The unnormalized square box filter can be useful in computing local image statistics such as the the local
variance and standard deviation around the neighborhood of a pixel.
variance and standard deviation around the neighborhood of a pixel.
@param
_
src input image
@param src input image
@param
_
dst output image of the same size and type as _src
@param dst output image of the same size and type as _src
@param ddepth the output image depth (-1 to use src.depth())
@param ddepth the output image depth (-1 to use src.depth())
@param ksize kernel size
@param ksize kernel size
@param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
@param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
...
@@ -1474,7 +1494,7 @@ center.
...
@@ -1474,7 +1494,7 @@ center.
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes
@sa boxFilter
@sa boxFilter
*/
*/
CV_EXPORTS_W
void
sqrBoxFilter
(
InputArray
_src
,
OutputArray
_
dst
,
int
ddepth
,
CV_EXPORTS_W
void
sqrBoxFilter
(
InputArray
src
,
OutputArray
dst
,
int
ddepth
,
Size
ksize
,
Point
anchor
=
Point
(
-
1
,
-
1
),
Size
ksize
,
Point
anchor
=
Point
(
-
1
,
-
1
),
bool
normalize
=
true
,
bool
normalize
=
true
,
int
borderType
=
BORDER_DEFAULT
);
int
borderType
=
BORDER_DEFAULT
);
...
@@ -3278,6 +3298,14 @@ The algorithm normalizes the brightness and increases the contrast of the image.
...
@@ -3278,6 +3298,14 @@ The algorithm normalizes the brightness and increases the contrast of the image.
*/
*/
CV_EXPORTS_W
void
equalizeHist
(
InputArray
src
,
OutputArray
dst
);
CV_EXPORTS_W
void
equalizeHist
(
InputArray
src
,
OutputArray
dst
);
/** @brief Creates a smart pointer to a cv::CLAHE class and initializes it.
@param clipLimit Threshold for contrast limiting.
@param tileGridSize Size of grid for histogram equalization. Input image will be divided into
equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
*/
CV_EXPORTS_W
Ptr
<
CLAHE
>
createCLAHE
(
double
clipLimit
=
40.0
,
Size
tileGridSize
=
Size
(
8
,
8
));
/** @brief Computes the "minimal work" distance between two weighted point configurations.
/** @brief Computes the "minimal work" distance between two weighted point configurations.
The function computes the earth mover distance and/or a lower boundary of the distance between the
The function computes the earth mover distance and/or a lower boundary of the distance between the
...
@@ -3593,6 +3621,20 @@ CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask,
...
@@ -3593,6 +3621,20 @@ CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask,
Scalar
loDiff
=
Scalar
(),
Scalar
upDiff
=
Scalar
(),
Scalar
loDiff
=
Scalar
(),
Scalar
upDiff
=
Scalar
(),
int
flags
=
4
);
int
flags
=
4
);
//! Performs linear blending of two images:
//! \f[ \texttt{dst}(i,j) = \texttt{weights1}(i,j)*\texttt{src1}(i,j) + \texttt{weights2}(i,j)*\texttt{src2}(i,j) \f]
//! @param src1 It has a type of CV_8UC(n) or CV_32FC(n), where n is a positive integer.
//! @param src2 It has the same type and size as src1.
//! @param weights1 It has a type of CV_32FC1 and the same size with src1.
//! @param weights2 It has a type of CV_32FC1 and the same size with src1.
//! @param dst It is created if it does not have the same size and type with src1.
CV_EXPORTS
void
blendLinear
(
InputArray
src1
,
InputArray
src2
,
InputArray
weights1
,
InputArray
weights2
,
OutputArray
dst
);
//! @} imgproc_misc
//! @addtogroup imgproc_color_conversions
//! @{
/** @brief Converts an image from one color space to another.
/** @brief Converts an image from one color space to another.
The function converts an input image from one color space to another. In case of a transformation
The function converts an input image from one color space to another. In case of a transformation
...
@@ -3656,10 +3698,39 @@ This function only supports YUV420 to RGB conversion as of now.
...
@@ -3656,10 +3698,39 @@ This function only supports YUV420 to RGB conversion as of now.
*/
*/
CV_EXPORTS_W
void
cvtColorTwoPlane
(
InputArray
src1
,
InputArray
src2
,
OutputArray
dst
,
int
code
);
CV_EXPORTS_W
void
cvtColorTwoPlane
(
InputArray
src1
,
InputArray
src2
,
OutputArray
dst
,
int
code
);
//! @} imgproc_misc
/** @brief main function for all demosaicing processes
@param src input image: 8-bit unsigned or 16-bit unsigned.
@param dst output image of the same size and depth as src.
@param code Color space conversion code (see the description below).
@param dstCn number of channels in the destination image; if the parameter is 0, the number of the
channels is derived automatically from src and code.
The function can do the following transformations:
- Demosaicing using bilinear interpolation
#COLOR_BayerBG2BGR , #COLOR_BayerGB2BGR , #COLOR_BayerRG2BGR , #COLOR_BayerGR2BGR
#COLOR_BayerBG2GRAY , #COLOR_BayerGB2GRAY , #COLOR_BayerRG2GRAY , #COLOR_BayerGR2GRAY
// main function for all demosaicing processes
- Demosaicing using Variable Number of Gradients.
CV_EXPORTS_W
void
demosaicing
(
InputArray
_src
,
OutputArray
_dst
,
int
code
,
int
dcn
=
0
);
#COLOR_BayerBG2BGR_VNG , #COLOR_BayerGB2BGR_VNG , #COLOR_BayerRG2BGR_VNG , #COLOR_BayerGR2BGR_VNG
- Edge-Aware Demosaicing.
#COLOR_BayerBG2BGR_EA , #COLOR_BayerGB2BGR_EA , #COLOR_BayerRG2BGR_EA , #COLOR_BayerGR2BGR_EA
- Demosaicing with alpha channel
#COLOR_BayerBG2BGRA , #COLOR_BayerGB2BGRA , #COLOR_BayerRG2BGRA , #COLOR_BayerGR2BGRA
@sa cvtColor
*/
CV_EXPORTS_W
void
demosaicing
(
InputArray
src
,
OutputArray
dst
,
int
code
,
int
dstCn
=
0
);
//! @} imgproc_color_conversions
//! @addtogroup imgproc_shape
//! @addtogroup imgproc_shape
//! @{
//! @{
...
@@ -3905,13 +3976,14 @@ The function computes a curve length or a closed contour perimeter.
...
@@ -3905,13 +3976,14 @@ The function computes a curve length or a closed contour perimeter.
*/
*/
CV_EXPORTS_W
double
arcLength
(
InputArray
curve
,
bool
closed
);
CV_EXPORTS_W
double
arcLength
(
InputArray
curve
,
bool
closed
);
/** @brief Calculates the up-right bounding rectangle of a point set.
/** @brief Calculates the up-right bounding rectangle of a point set
or non-zero pixels of gray-scale image
.
The function calculates and returns the minimal up-right bounding rectangle for the specified point set.
The function calculates and returns the minimal up-right bounding rectangle for the specified point set or
non-zero pixels of gray-scale image.
@param
points Input
2D point set, stored in std::vector or Mat.
@param
array Input gray-scale image or
2D point set, stored in std::vector or Mat.
*/
*/
CV_EXPORTS_W
Rect
boundingRect
(
InputArray
points
);
CV_EXPORTS_W
Rect
boundingRect
(
InputArray
array
);
/** @brief Calculates a contour area.
/** @brief Calculates a contour area.
...
@@ -4037,6 +4109,12 @@ vector: std::vector\<int\> implies returnPoints=false, std::vector\<Point\> impl
...
@@ -4037,6 +4109,12 @@ vector: std::vector\<int\> implies returnPoints=false, std::vector\<Point\> impl
returnPoints=true.
returnPoints=true.
@note `points` and `hull` should be different arrays, inplace processing isn't supported.
@note `points` and `hull` should be different arrays, inplace processing isn't supported.
Check @ref tutorial_hull "the corresponding tutorial" for more details.
useful links:
https://www.learnopencv.com/convex-hull-using-opencv-in-python-and-c/
*/
*/
CV_EXPORTS_W
void
convexHull
(
InputArray
points
,
OutputArray
hull
,
CV_EXPORTS_W
void
convexHull
(
InputArray
points
,
OutputArray
hull
,
bool
clockwise
=
false
,
bool
returnPoints
=
true
);
bool
clockwise
=
false
,
bool
returnPoints
=
true
);
...
@@ -4243,31 +4321,15 @@ at most 8 vertices. Stored as std::vector\<cv::Point2f\> or cv::Mat as Mx1 of ty
...
@@ -4243,31 +4321,15 @@ at most 8 vertices. Stored as std::vector\<cv::Point2f\> or cv::Mat as Mx1 of ty
*/
*/
CV_EXPORTS_W
int
rotatedRectangleIntersection
(
const
RotatedRect
&
rect1
,
const
RotatedRect
&
rect2
,
OutputArray
intersectingRegion
);
CV_EXPORTS_W
int
rotatedRectangleIntersection
(
const
RotatedRect
&
rect1
,
const
RotatedRect
&
rect2
,
OutputArray
intersectingRegion
);
//! @} imgproc_shape
/** @brief Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it.
/** @brief Creates implementation for cv::CLAHE .
*/
@param clipLimit Threshold for contrast limiting.
@param tileGridSize Size of grid for histogram equalization. Input image will be divided into
equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column.
*/
CV_EXPORTS_W
Ptr
<
CLAHE
>
createCLAHE
(
double
clipLimit
=
40.0
,
Size
tileGridSize
=
Size
(
8
,
8
));
//! Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
//! Detects position only without translation and rotation
CV_EXPORTS
Ptr
<
GeneralizedHoughBallard
>
createGeneralizedHoughBallard
();
CV_EXPORTS
Ptr
<
GeneralizedHoughBallard
>
createGeneralizedHoughBallard
();
/
/! Guil, N., González-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038
.
/
** @brief Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it
.
//! Detects position, translation and rotation
*/
CV_EXPORTS
Ptr
<
GeneralizedHoughGuil
>
createGeneralizedHoughGuil
();
CV_EXPORTS
Ptr
<
GeneralizedHoughGuil
>
createGeneralizedHoughGuil
();
//! Performs linear blending of two images:
//! @} imgproc_shape
//! \f[ \texttt{dst}(i,j) = \texttt{weights1}(i,j)*\texttt{src1}(i,j) + \texttt{weights2}(i,j)*\texttt{src2}(i,j) \f]
//! @param src1 It has a type of CV_8UC(n) or CV_32FC(n), where n is a positive integer.
//! @param src2 It has the same type and size as src1.
//! @param weights1 It has a type of CV_32FC1 and the same size with src1.
//! @param weights2 It has a type of CV_32FC1 and the same size with src1.
//! @param dst It is created if it does not have the same size and type with src1.
CV_EXPORTS
void
blendLinear
(
InputArray
src1
,
InputArray
src2
,
InputArray
weights1
,
InputArray
weights2
,
OutputArray
dst
);
//! @addtogroup imgproc_colormap
//! @addtogroup imgproc_colormap
//! @{
//! @{
...
...
modules/imgproc/src/demosaicing.cpp
View file @
4d0ed5c1
...
@@ -658,10 +658,10 @@ static void Bayer2Gray_( const Mat& srcmat, Mat& dstmat, int code )
...
@@ -658,10 +658,10 @@ static void Bayer2Gray_( const Mat& srcmat, Mat& dstmat, int code )
Size
size
=
srcmat
.
size
();
Size
size
=
srcmat
.
size
();
int
bcoeff
=
B2Y
,
rcoeff
=
R2Y
;
int
bcoeff
=
B2Y
,
rcoeff
=
R2Y
;
int
start_with_green
=
code
==
C
V_BayerGB2GRAY
||
code
==
CV
_BayerGR2GRAY
;
int
start_with_green
=
code
==
C
OLOR_BayerGB2GRAY
||
code
==
COLOR
_BayerGR2GRAY
;
bool
brow
=
true
;
bool
brow
=
true
;
if
(
code
!=
C
V_BayerBG2GRAY
&&
code
!=
CV
_BayerGB2GRAY
)
if
(
code
!=
C
OLOR_BayerBG2GRAY
&&
code
!=
COLOR
_BayerGB2GRAY
)
{
{
brow
=
false
;
brow
=
false
;
std
::
swap
(
bcoeff
,
rcoeff
);
std
::
swap
(
bcoeff
,
rcoeff
);
...
@@ -923,10 +923,10 @@ static void Bayer2RGB_( const Mat& srcmat, Mat& dstmat, int code )
...
@@ -923,10 +923,10 @@ static void Bayer2RGB_( const Mat& srcmat, Mat& dstmat, int code )
{
{
int
dst_step
=
(
int
)(
dstmat
.
step
/
sizeof
(
T
));
int
dst_step
=
(
int
)(
dstmat
.
step
/
sizeof
(
T
));
Size
size
=
srcmat
.
size
();
Size
size
=
srcmat
.
size
();
int
blue
=
(
code
==
C
V_BayerBG2BGR
||
code
==
CV
_BayerGB2BGR
||
int
blue
=
(
code
==
C
OLOR_BayerBG2BGR
||
code
==
COLOR
_BayerGB2BGR
||
code
==
C
V_BayerBG2BGRA
||
code
==
CV
_BayerGB2BGRA
)
?
-
1
:
1
;
code
==
C
OLOR_BayerBG2BGRA
||
code
==
COLOR
_BayerGB2BGRA
)
?
-
1
:
1
;
int
start_with_green
=
(
code
==
C
V_BayerGB2BGR
||
code
==
CV
_BayerGR2BGR
||
int
start_with_green
=
(
code
==
C
OLOR_BayerGB2BGR
||
code
==
COLOR
_BayerGR2BGR
||
code
==
C
V_BayerGB2BGRA
||
code
==
CV
_BayerGR2BGRA
);
code
==
C
OLOR_BayerGB2BGRA
||
code
==
COLOR
_BayerGR2BGRA
);
int
dcn
=
dstmat
.
channels
();
int
dcn
=
dstmat
.
channels
();
size
.
height
-=
2
;
size
.
height
-=
2
;
...
@@ -964,8 +964,8 @@ static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code )
...
@@ -964,8 +964,8 @@ static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code )
int
dststep
=
(
int
)
dstmat
.
step
;
int
dststep
=
(
int
)
dstmat
.
step
;
Size
size
=
srcmat
.
size
();
Size
size
=
srcmat
.
size
();
int
blueIdx
=
code
==
C
V_BayerBG2BGR_VNG
||
code
==
CV
_BayerGB2BGR_VNG
?
0
:
2
;
int
blueIdx
=
code
==
C
OLOR_BayerBG2BGR_VNG
||
code
==
COLOR
_BayerGB2BGR_VNG
?
0
:
2
;
bool
greenCell0
=
code
!=
C
V_BayerBG2BGR_VNG
&&
code
!=
CV
_BayerRG2BGR_VNG
;
bool
greenCell0
=
code
!=
C
OLOR_BayerBG2BGR_VNG
&&
code
!=
COLOR
_BayerRG2BGR_VNG
;
// for too small images use the simple interpolation algorithm
// for too small images use the simple interpolation algorithm
if
(
MIN
(
size
.
width
,
size
.
height
)
<
8
)
if
(
MIN
(
size
.
width
,
size
.
height
)
<
8
)
...
@@ -1625,8 +1625,8 @@ static void Bayer2RGB_EdgeAware_T(const Mat& src, Mat& dst, int code)
...
@@ -1625,8 +1625,8 @@ static void Bayer2RGB_EdgeAware_T(const Mat& src, Mat& dst, int code)
size
.
width
-=
2
;
size
.
width
-=
2
;
size
.
height
-=
2
;
size
.
height
-=
2
;
int
start_with_green
=
code
==
C
V_BayerGB2BGR_EA
||
code
==
CV
_BayerGR2BGR_EA
?
1
:
0
;
int
start_with_green
=
code
==
C
OLOR_BayerGB2BGR_EA
||
code
==
COLOR
_BayerGR2BGR_EA
?
1
:
0
;
int
blue
=
code
==
C
V_BayerGB2BGR_EA
||
code
==
CV
_BayerBG2BGR_EA
?
1
:
0
;
int
blue
=
code
==
C
OLOR_BayerGB2BGR_EA
||
code
==
COLOR
_BayerBG2BGR_EA
?
1
:
0
;
if
(
size
.
height
>
0
)
if
(
size
.
height
>
0
)
{
{
...
@@ -1672,7 +1672,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
...
@@ -1672,7 +1672,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
switch
(
code
)
switch
(
code
)
{
{
case
C
V_BayerBG2GRAY
:
case
CV_BayerGB2GRAY
:
case
CV_BayerRG2GRAY
:
case
CV
_BayerGR2GRAY
:
case
C
OLOR_BayerBG2GRAY
:
case
COLOR_BayerGB2GRAY
:
case
COLOR_BayerRG2GRAY
:
case
COLOR
_BayerGR2GRAY
:
if
(
dcn
<=
0
)
if
(
dcn
<=
0
)
dcn
=
1
;
dcn
=
1
;
CV_Assert
(
scn
==
1
&&
dcn
==
1
);
CV_Assert
(
scn
==
1
&&
dcn
==
1
);
...
@@ -1688,12 +1688,12 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
...
@@ -1688,12 +1688,12 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
CV_Error
(
CV_StsUnsupportedFormat
,
"Bayer->Gray demosaicing only supports 8u and 16u types"
);
CV_Error
(
CV_StsUnsupportedFormat
,
"Bayer->Gray demosaicing only supports 8u and 16u types"
);
break
;
break
;
case
C
V_BayerBG2BGRA
:
case
CV_BayerGB2BGRA
:
case
CV_BayerRG2BGRA
:
case
CV
_BayerGR2BGRA
:
case
C
OLOR_BayerBG2BGRA
:
case
COLOR_BayerGB2BGRA
:
case
COLOR_BayerRG2BGRA
:
case
COLOR
_BayerGR2BGRA
:
if
(
dcn
<=
0
)
if
(
dcn
<=
0
)
dcn
=
4
;
dcn
=
4
;
/* fallthrough */
/* fallthrough */
case
C
V_BayerBG2BGR
:
case
CV_BayerGB2BGR
:
case
CV_BayerRG2BGR
:
case
CV
_BayerGR2BGR
:
case
C
OLOR_BayerBG2BGR
:
case
COLOR_BayerGB2BGR
:
case
COLOR_BayerRG2BGR
:
case
COLOR
_BayerGR2BGR
:
case
C
V_BayerBG2BGR_VNG
:
case
CV_BayerGB2BGR_VNG
:
case
CV_BayerRG2BGR_VNG
:
case
CV
_BayerGR2BGR_VNG
:
case
C
OLOR_BayerBG2BGR_VNG
:
case
COLOR_BayerGB2BGR_VNG
:
case
COLOR_BayerRG2BGR_VNG
:
case
COLOR
_BayerGR2BGR_VNG
:
{
{
if
(
dcn
<=
0
)
if
(
dcn
<=
0
)
dcn
=
3
;
dcn
=
3
;
...
@@ -1702,10 +1702,10 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
...
@@ -1702,10 +1702,10 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
_dst
.
create
(
sz
,
CV_MAKE_TYPE
(
depth
,
dcn
));
_dst
.
create
(
sz
,
CV_MAKE_TYPE
(
depth
,
dcn
));
Mat
dst_
=
_dst
.
getMat
();
Mat
dst_
=
_dst
.
getMat
();
if
(
code
==
C
V_BayerBG2BGR
||
code
==
CV
_BayerBG2BGRA
||
if
(
code
==
C
OLOR_BayerBG2BGR
||
code
==
COLOR
_BayerBG2BGRA
||
code
==
C
V_BayerGB2BGR
||
code
==
CV
_BayerGB2BGRA
||
code
==
C
OLOR_BayerGB2BGR
||
code
==
COLOR
_BayerGB2BGRA
||
code
==
C
V_BayerRG2BGR
||
code
==
CV
_BayerRG2BGRA
||
code
==
C
OLOR_BayerRG2BGR
||
code
==
COLOR
_BayerRG2BGRA
||
code
==
C
V_BayerGR2BGR
||
code
==
CV
_BayerGR2BGRA
)
code
==
C
OLOR_BayerGR2BGR
||
code
==
COLOR
_BayerGR2BGRA
)
{
{
if
(
depth
==
CV_8U
)
if
(
depth
==
CV_8U
)
Bayer2RGB_
<
uchar
,
SIMDBayerInterpolator_8u
>
(
src
,
dst_
,
code
);
Bayer2RGB_
<
uchar
,
SIMDBayerInterpolator_8u
>
(
src
,
dst_
,
code
);
...
@@ -1722,7 +1722,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
...
@@ -1722,7 +1722,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
}
}
break
;
break
;
case
C
V_BayerBG2BGR_EA
:
case
CV_BayerGB2BGR_EA
:
case
CV_BayerRG2BGR_EA
:
case
CV
_BayerGR2BGR_EA
:
case
C
OLOR_BayerBG2BGR_EA
:
case
COLOR_BayerGB2BGR_EA
:
case
COLOR_BayerRG2BGR_EA
:
case
COLOR
_BayerGR2BGR_EA
:
if
(
dcn
<=
0
)
if
(
dcn
<=
0
)
dcn
=
3
;
dcn
=
3
;
...
...
modules/imgproc/test/test_color.cpp
View file @
4d0ed5c1
...
@@ -415,7 +415,7 @@ void CV_ColorCvtBaseTest::convert_backward( const Mat& src, const Mat& dst, Mat&
...
@@ -415,7 +415,7 @@ void CV_ColorCvtBaseTest::convert_backward( const Mat& src, const Mat& dst, Mat&
#undef INIT_FWD_INV_CODES
#undef INIT_FWD_INV_CODES
#define INIT_FWD_INV_CODES( fwd, inv ) \
#define INIT_FWD_INV_CODES( fwd, inv ) \
fwd_code = C
V_##fwd; inv_code = CV
_##inv; \
fwd_code = C
OLOR_##fwd; inv_code = COLOR
_##inv; \
fwd_code_str = #fwd; inv_code_str = #inv
fwd_code_str = #fwd; inv_code_str = #inv
//// rgb <=> gray
//// rgb <=> gray
...
@@ -447,16 +447,16 @@ void CV_ColorGrayTest::get_test_array_types_and_sizes( int test_case_idx, vector
...
@@ -447,16 +447,16 @@ void CV_ColorGrayTest::get_test_array_types_and_sizes( int test_case_idx, vector
if
(
cn
==
3
)
if
(
cn
==
3
)
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2GRAY
,
inv_code
=
CV
_GRAY2BGR
;
fwd_code
=
C
OLOR_BGR2GRAY
,
inv_code
=
COLOR
_GRAY2BGR
;
else
else
fwd_code
=
C
V_RGB2GRAY
,
inv_code
=
CV
_GRAY2RGB
;
fwd_code
=
C
OLOR_RGB2GRAY
,
inv_code
=
COLOR
_GRAY2RGB
;
}
}
else
else
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGRA2GRAY
,
inv_code
=
CV
_GRAY2BGRA
;
fwd_code
=
C
OLOR_BGRA2GRAY
,
inv_code
=
COLOR
_GRAY2BGRA
;
else
else
fwd_code
=
C
V_RGBA2GRAY
,
inv_code
=
CV
_GRAY2RGBA
;
fwd_code
=
C
OLOR_RGBA2GRAY
,
inv_code
=
COLOR
_GRAY2RGBA
;
}
}
}
}
...
@@ -515,9 +515,9 @@ void CV_ColorYCrCbTest::get_test_array_types_and_sizes( int test_case_idx, vecto
...
@@ -515,9 +515,9 @@ void CV_ColorYCrCbTest::get_test_array_types_and_sizes( int test_case_idx, vecto
CV_ColorCvtBaseTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
CV_ColorCvtBaseTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2YCrCb
,
inv_code
=
CV
_YCrCb2BGR
;
fwd_code
=
C
OLOR_BGR2YCrCb
,
inv_code
=
COLOR
_YCrCb2BGR
;
else
else
fwd_code
=
C
V_RGB2YCrCb
,
inv_code
=
CV
_YCrCb2RGB
;
fwd_code
=
C
OLOR_RGB2YCrCb
,
inv_code
=
COLOR
_YCrCb2RGB
;
}
}
...
@@ -612,17 +612,17 @@ void CV_ColorHSVTest::get_test_array_types_and_sizes( int test_case_idx, vector<
...
@@ -612,17 +612,17 @@ void CV_ColorHSVTest::get_test_array_types_and_sizes( int test_case_idx, vector<
if
(
full_hrange
)
if
(
full_hrange
)
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2HSV_FULL
,
inv_code
=
CV
_HSV2BGR_FULL
;
fwd_code
=
C
OLOR_BGR2HSV_FULL
,
inv_code
=
COLOR
_HSV2BGR_FULL
;
else
else
fwd_code
=
C
V_RGB2HSV_FULL
,
inv_code
=
CV
_HSV2RGB_FULL
;
fwd_code
=
C
OLOR_RGB2HSV_FULL
,
inv_code
=
COLOR
_HSV2RGB_FULL
;
hue_range
=
256
;
hue_range
=
256
;
}
}
else
else
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2HSV
,
inv_code
=
CV
_HSV2BGR
;
fwd_code
=
C
OLOR_BGR2HSV
,
inv_code
=
COLOR
_HSV2BGR
;
else
else
fwd_code
=
C
V_RGB2HSV
,
inv_code
=
CV
_HSV2RGB
;
fwd_code
=
C
OLOR_RGB2HSV
,
inv_code
=
COLOR
_HSV2RGB
;
hue_range
=
180
;
hue_range
=
180
;
}
}
}
}
...
@@ -747,9 +747,9 @@ void CV_ColorHLSTest::get_test_array_types_and_sizes( int test_case_idx, vector<
...
@@ -747,9 +747,9 @@ void CV_ColorHLSTest::get_test_array_types_and_sizes( int test_case_idx, vector<
CV_ColorCvtBaseTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
CV_ColorCvtBaseTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2HLS
,
inv_code
=
CV
_HLS2BGR
;
fwd_code
=
C
OLOR_BGR2HLS
,
inv_code
=
COLOR
_HLS2BGR
;
else
else
fwd_code
=
C
V_RGB2HLS
,
inv_code
=
CV
_HLS2RGB
;
fwd_code
=
C
OLOR_RGB2HLS
,
inv_code
=
COLOR
_HLS2RGB
;
}
}
...
@@ -930,9 +930,9 @@ void CV_ColorXYZTest::get_test_array_types_and_sizes( int test_case_idx, vector<
...
@@ -930,9 +930,9 @@ void CV_ColorXYZTest::get_test_array_types_and_sizes( int test_case_idx, vector<
CV_ColorCvtBaseTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
CV_ColorCvtBaseTest
::
get_test_array_types_and_sizes
(
test_case_idx
,
sizes
,
types
);
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2XYZ
,
inv_code
=
CV
_XYZ2BGR
;
fwd_code
=
C
OLOR_BGR2XYZ
,
inv_code
=
COLOR
_XYZ2BGR
;
else
else
fwd_code
=
C
V_RGB2XYZ
,
inv_code
=
CV
_XYZ2RGB
;
fwd_code
=
C
OLOR_RGB2XYZ
,
inv_code
=
COLOR
_XYZ2RGB
;
}
}
...
@@ -1059,16 +1059,16 @@ void CV_ColorLabTest::get_test_array_types_and_sizes( int test_case_idx, vector<
...
@@ -1059,16 +1059,16 @@ void CV_ColorLabTest::get_test_array_types_and_sizes( int test_case_idx, vector<
if
(
srgb
)
if
(
srgb
)
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2Lab
,
inv_code
=
CV
_Lab2BGR
;
fwd_code
=
C
OLOR_BGR2Lab
,
inv_code
=
COLOR
_Lab2BGR
;
else
else
fwd_code
=
C
V_RGB2Lab
,
inv_code
=
CV
_Lab2RGB
;
fwd_code
=
C
OLOR_RGB2Lab
,
inv_code
=
COLOR
_Lab2RGB
;
}
}
else
else
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_LBGR2Lab
,
inv_code
=
CV
_Lab2LBGR
;
fwd_code
=
C
OLOR_LBGR2Lab
,
inv_code
=
COLOR
_Lab2LBGR
;
else
else
fwd_code
=
C
V_LRGB2Lab
,
inv_code
=
CV
_Lab2LRGB
;
fwd_code
=
C
OLOR_LRGB2Lab
,
inv_code
=
COLOR
_Lab2LRGB
;
}
}
}
}
...
@@ -1238,16 +1238,16 @@ void CV_ColorLuvTest::get_test_array_types_and_sizes( int test_case_idx, vector<
...
@@ -1238,16 +1238,16 @@ void CV_ColorLuvTest::get_test_array_types_and_sizes( int test_case_idx, vector<
if
(
srgb
)
if
(
srgb
)
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2Luv
,
inv_code
=
CV
_Luv2BGR
;
fwd_code
=
C
OLOR_BGR2Luv
,
inv_code
=
COLOR
_Luv2BGR
;
else
else
fwd_code
=
C
V_RGB2Luv
,
inv_code
=
CV
_Luv2RGB
;
fwd_code
=
C
OLOR_RGB2Luv
,
inv_code
=
COLOR
_Luv2RGB
;
}
}
else
else
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_LBGR2Luv
,
inv_code
=
CV
_Luv2LBGR
;
fwd_code
=
C
OLOR_LBGR2Luv
,
inv_code
=
COLOR
_Luv2LBGR
;
else
else
fwd_code
=
C
V_LRGB2Luv
,
inv_code
=
CV
_Luv2LRGB
;
fwd_code
=
C
OLOR_LRGB2Luv
,
inv_code
=
COLOR
_Luv2LRGB
;
}
}
}
}
...
@@ -1453,17 +1453,17 @@ void CV_ColorRGBTest::get_test_array_types_and_sizes( int test_case_idx, vector<
...
@@ -1453,17 +1453,17 @@ void CV_ColorRGBTest::get_test_array_types_and_sizes( int test_case_idx, vector<
if
(
cvtest
::
randInt
(
rng
)
&
1
)
if
(
cvtest
::
randInt
(
rng
)
&
1
)
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2BGR565
,
inv_code
=
CV
_BGR5652BGR
;
fwd_code
=
C
OLOR_BGR2BGR565
,
inv_code
=
COLOR
_BGR5652BGR
;
else
else
fwd_code
=
C
V_RGB2BGR565
,
inv_code
=
CV
_BGR5652RGB
;
fwd_code
=
C
OLOR_RGB2BGR565
,
inv_code
=
COLOR
_BGR5652RGB
;
dst_bits
=
16
;
dst_bits
=
16
;
}
}
else
else
{
{
if
(
blue_idx
==
0
)
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGR2BGR555
,
inv_code
=
CV
_BGR5552BGR
;
fwd_code
=
C
OLOR_BGR2BGR555
,
inv_code
=
COLOR
_BGR5552BGR
;
else
else
fwd_code
=
C
V_RGB2BGR555
,
inv_code
=
CV
_BGR5552RGB
;
fwd_code
=
C
OLOR_RGB2BGR555
,
inv_code
=
COLOR
_BGR5552RGB
;
dst_bits
=
15
;
dst_bits
=
15
;
}
}
}
}
...
@@ -1471,13 +1471,13 @@ void CV_ColorRGBTest::get_test_array_types_and_sizes( int test_case_idx, vector<
...
@@ -1471,13 +1471,13 @@ void CV_ColorRGBTest::get_test_array_types_and_sizes( int test_case_idx, vector<
{
{
if
(
cn
==
3
)
if
(
cn
==
3
)
{
{
fwd_code
=
C
V_RGB2BGR
,
inv_code
=
CV
_BGR2RGB
;
fwd_code
=
C
OLOR_RGB2BGR
,
inv_code
=
COLOR
_BGR2RGB
;
blue_idx
=
2
;
blue_idx
=
2
;
}
}
else
if
(
blue_idx
==
0
)
else
if
(
blue_idx
==
0
)
fwd_code
=
C
V_BGRA2BGR
,
inv_code
=
CV
_BGR2BGRA
;
fwd_code
=
C
OLOR_BGRA2BGR
,
inv_code
=
COLOR
_BGR2BGRA
;
else
else
fwd_code
=
C
V_RGBA2BGR
,
inv_code
=
CV
_BGR2RGBA
;
fwd_code
=
C
OLOR_RGBA2BGR
,
inv_code
=
COLOR
_BGR2RGBA
;
}
}
if
(
CV_MAT_CN
(
types
[
INPUT
][
0
])
!=
CV_MAT_CN
(
types
[
OUTPUT
][
0
])
)
if
(
CV_MAT_CN
(
types
[
INPUT
][
0
])
!=
CV_MAT_CN
(
types
[
OUTPUT
][
0
])
)
...
@@ -1704,7 +1704,7 @@ CV_ColorBayerTest::CV_ColorBayerTest() : CV_ColorCvtBaseTest( false, false, true
...
@@ -1704,7 +1704,7 @@ CV_ColorBayerTest::CV_ColorBayerTest() : CV_ColorCvtBaseTest( false, false, true
fwd_code_str
=
"BayerBG2BGR"
;
fwd_code_str
=
"BayerBG2BGR"
;
inv_code_str
=
""
;
inv_code_str
=
""
;
fwd_code
=
C
V
_BayerBG2BGR
;
fwd_code
=
C
OLOR
_BayerBG2BGR
;
inv_code
=
-
1
;
inv_code
=
-
1
;
}
}
...
@@ -1718,7 +1718,7 @@ void CV_ColorBayerTest::get_test_array_types_and_sizes( int test_case_idx, vecto
...
@@ -1718,7 +1718,7 @@ void CV_ColorBayerTest::get_test_array_types_and_sizes( int test_case_idx, vecto
types
[
OUTPUT
][
0
]
=
types
[
REF_OUTPUT
][
0
]
=
CV_MAKETYPE
(
CV_MAT_DEPTH
(
types
[
INPUT
][
0
]),
3
);
types
[
OUTPUT
][
0
]
=
types
[
REF_OUTPUT
][
0
]
=
CV_MAKETYPE
(
CV_MAT_DEPTH
(
types
[
INPUT
][
0
]),
3
);
inplace
=
false
;
inplace
=
false
;
fwd_code
=
cvtest
::
randInt
(
rng
)
%
4
+
C
V
_BayerBG2BGR
;
fwd_code
=
cvtest
::
randInt
(
rng
)
%
4
+
C
OLOR
_BayerBG2BGR
;
}
}
...
@@ -1747,7 +1747,7 @@ static void bayer2BGR_(const Mat& src, Mat& dst, int code)
...
@@ -1747,7 +1747,7 @@ static void bayer2BGR_(const Mat& src, Mat& dst, int code)
int
bi
=
0
;
int
bi
=
0
;
int
step
=
(
int
)(
src
.
step
/
sizeof
(
T
));
int
step
=
(
int
)(
src
.
step
/
sizeof
(
T
));
if
(
code
==
C
V_BayerRG2BGR
||
code
==
CV
_BayerGR2BGR
)
if
(
code
==
C
OLOR_BayerRG2BGR
||
code
==
COLOR
_BayerGR2BGR
)
bi
^=
2
;
bi
^=
2
;
for
(
i
=
1
;
i
<
src
.
rows
-
1
;
i
++
)
for
(
i
=
1
;
i
<
src
.
rows
-
1
;
i
++
)
...
@@ -1850,7 +1850,7 @@ TEST(Imgproc_ColorBayer, regression)
...
@@ -1850,7 +1850,7 @@ TEST(Imgproc_ColorBayer, regression)
CV_Assert
(
!
given
.
empty
()
&&
!
gold
.
empty
()
);
CV_Assert
(
!
given
.
empty
()
&&
!
gold
.
empty
()
);
cvtColor
(
given
,
result
,
C
V
_BayerBG2GRAY
);
cvtColor
(
given
,
result
,
C
OLOR
_BayerBG2GRAY
);
EXPECT_EQ
(
gold
.
type
(),
result
.
type
());
EXPECT_EQ
(
gold
.
type
(),
result
.
type
());
EXPECT_EQ
(
gold
.
cols
,
result
.
cols
);
EXPECT_EQ
(
gold
.
cols
,
result
.
cols
);
...
@@ -1873,7 +1873,7 @@ TEST(Imgproc_ColorBayerVNG, regression)
...
@@ -1873,7 +1873,7 @@ TEST(Imgproc_ColorBayerVNG, regression)
CV_Assert
(
!
given
.
empty
()
);
CV_Assert
(
!
given
.
empty
()
);
cvtColor
(
given
,
result
,
C
V
_BayerBG2BGR_VNG
,
3
);
cvtColor
(
given
,
result
,
C
OLOR
_BayerBG2BGR_VNG
,
3
);
if
(
gold
.
empty
())
if
(
gold
.
empty
())
imwrite
(
goldfname
,
result
);
imwrite
(
goldfname
,
result
);
...
@@ -1977,7 +1977,7 @@ TEST(Imgproc_ColorBayerVNG_Strict, regression)
...
@@ -1977,7 +1977,7 @@ TEST(Imgproc_ColorBayerVNG_Strict, regression)
CV_Assert
(
!
bayer
.
empty
()
&&
bayer
.
type
()
==
CV_8UC1
);
CV_Assert
(
!
bayer
.
empty
()
&&
bayer
.
type
()
==
CV_8UC1
);
// calculating a dst image
// calculating a dst image
cvtColor
(
bayer
,
dst
,
C
V
_BayerBG2BGR_VNG
+
i
);
cvtColor
(
bayer
,
dst
,
C
OLOR
_BayerBG2BGR_VNG
+
i
);
// reading a reference image
// reading a reference image
full_path
=
parent_path
+
pattern
[
i
]
+
image_name
;
full_path
=
parent_path
+
pattern
[
i
]
+
image_name
;
...
@@ -2099,8 +2099,8 @@ TEST(Imgproc_ColorLab_Full, accuracy)
...
@@ -2099,8 +2099,8 @@ TEST(Imgproc_ColorLab_Full, accuracy)
// Convert test image to LAB
// Convert test image to LAB
cv
::
Mat
lab
;
cv
::
Mat
lab
;
int
forward_code
=
blueInd
?
srgb
?
C
V_BGR2Lab
:
CV_LBGR2Lab
:
srgb
?
CV_RGB2Lab
:
CV
_LRGB2Lab
;
int
forward_code
=
blueInd
?
srgb
?
C
OLOR_BGR2Lab
:
COLOR_LBGR2Lab
:
srgb
?
COLOR_RGB2Lab
:
COLOR
_LRGB2Lab
;
int
inverse_code
=
blueInd
?
srgb
?
C
V_Lab2BGR
:
CV_Lab2LBGR
:
srgb
?
CV_Lab2RGB
:
CV
_Lab2LRGB
;
int
inverse_code
=
blueInd
?
srgb
?
C
OLOR_Lab2BGR
:
COLOR_Lab2LBGR
:
srgb
?
COLOR_Lab2RGB
:
COLOR
_Lab2LRGB
;
cv
::
cvtColor
(
src
,
lab
,
forward_code
);
cv
::
cvtColor
(
src
,
lab
,
forward_code
);
// Convert LAB image back to BGR(RGB)
// Convert LAB image back to BGR(RGB)
cv
::
Mat
recons
;
cv
::
Mat
recons
;
...
@@ -2623,10 +2623,10 @@ int row8uLuvChoose(const uchar* src_row, uchar *dst_row, int n, bool forward, in
...
@@ -2623,10 +2623,10 @@ int row8uLuvChoose(const uchar* src_row, uchar *dst_row, int n, bool forward, in
TEST
(
Imgproc_ColorLab_Full
,
bitExactness
)
TEST
(
Imgproc_ColorLab_Full
,
bitExactness
)
{
{
int
codes
[]
=
{
C
V_BGR2Lab
,
CV_RGB2Lab
,
CV_LBGR2Lab
,
CV
_LRGB2Lab
,
int
codes
[]
=
{
C
OLOR_BGR2Lab
,
COLOR_RGB2Lab
,
COLOR_LBGR2Lab
,
COLOR
_LRGB2Lab
,
C
V_Lab2BGR
,
CV_Lab2RGB
,
CV_Lab2LBGR
,
CV
_Lab2LRGB
};
C
OLOR_Lab2BGR
,
COLOR_Lab2RGB
,
COLOR_Lab2LBGR
,
COLOR
_Lab2LRGB
};
string
names
[]
=
{
"C
V_BGR2Lab"
,
"CV_RGB2Lab"
,
"CV_LBGR2Lab"
,
"CV
_LRGB2Lab"
,
string
names
[]
=
{
"C
OLOR_BGR2Lab"
,
"COLOR_RGB2Lab"
,
"COLOR_LBGR2Lab"
,
"COLOR
_LRGB2Lab"
,
"C
V_Lab2BGR"
,
"CV_Lab2RGB"
,
"CV_Lab2LBGR"
,
"CV
_Lab2LRGB"
};
"C
OLOR_Lab2BGR"
,
"COLOR_Lab2RGB"
,
"COLOR_Lab2LBGR"
,
"COLOR
_Lab2LRGB"
};
// need to be recalculated each time we change Lab algorithms, RNG or test system
// need to be recalculated each time we change Lab algorithms, RNG or test system
const
int
nIterations
=
8
;
const
int
nIterations
=
8
;
...
@@ -2707,10 +2707,10 @@ TEST(Imgproc_ColorLab_Full, bitExactness)
...
@@ -2707,10 +2707,10 @@ TEST(Imgproc_ColorLab_Full, bitExactness)
TEST
(
Imgproc_ColorLuv_Full
,
bitExactness
)
TEST
(
Imgproc_ColorLuv_Full
,
bitExactness
)
{
{
int
codes
[]
=
{
C
V_BGR2Luv
,
CV_RGB2Luv
,
CV_LBGR2Luv
,
CV
_LRGB2Luv
,
int
codes
[]
=
{
C
OLOR_BGR2Luv
,
COLOR_RGB2Luv
,
COLOR_LBGR2Luv
,
COLOR
_LRGB2Luv
,
C
V_Luv2BGR
,
CV_Luv2RGB
,
CV_Luv2LBGR
,
CV
_Luv2LRGB
};
C
OLOR_Luv2BGR
,
COLOR_Luv2RGB
,
COLOR_Luv2LBGR
,
COLOR
_Luv2LRGB
};
string
names
[]
=
{
"C
V_BGR2Luv"
,
"CV_RGB2Luv"
,
"CV_LBGR2Luv"
,
"CV
_LRGB2Luv"
,
string
names
[]
=
{
"C
OLOR_BGR2Luv"
,
"COLOR_RGB2Luv"
,
"COLOR_LBGR2Luv"
,
"COLOR
_LRGB2Luv"
,
"C
V_Luv2BGR"
,
"CV_Luv2RGB"
,
"CV_Luv2LBGR"
,
"CV
_Luv2LRGB"
};
"C
OLOR_Luv2BGR"
,
"COLOR_Luv2RGB"
,
"COLOR_Luv2LBGR"
,
"COLOR
_Luv2LRGB"
};
/* to be enabled when bit-exactness is done for other codes */
/* to be enabled when bit-exactness is done for other codes */
bool
codeEnabled
[]
=
{
true
,
true
,
false
,
false
,
true
,
true
,
true
,
true
};
bool
codeEnabled
[]
=
{
true
,
true
,
false
,
false
,
true
,
true
,
true
,
true
};
...
@@ -2812,8 +2812,8 @@ static void test_Bayer2RGB_EdgeAware_8u(const Mat& src, Mat& dst, int code)
...
@@ -2812,8 +2812,8 @@ static void test_Bayer2RGB_EdgeAware_8u(const Mat& src, Mat& dst, int code)
const
uchar
*
S
=
src
.
ptr
<
uchar
>
(
1
)
+
1
;
const
uchar
*
S
=
src
.
ptr
<
uchar
>
(
1
)
+
1
;
uchar
*
D
=
dst
.
ptr
<
uchar
>
(
1
)
+
dcn
;
uchar
*
D
=
dst
.
ptr
<
uchar
>
(
1
)
+
dcn
;
int
start_with_green
=
code
==
C
V_BayerGB2BGR_EA
||
code
==
CV
_BayerGR2BGR_EA
?
1
:
0
;
int
start_with_green
=
code
==
C
OLOR_BayerGB2BGR_EA
||
code
==
COLOR
_BayerGR2BGR_EA
?
1
:
0
;
int
blue
=
code
==
C
V_BayerGB2BGR_EA
||
code
==
CV
_BayerBG2BGR_EA
?
1
:
0
;
int
blue
=
code
==
C
OLOR_BayerGB2BGR_EA
||
code
==
COLOR
_BayerBG2BGR_EA
?
1
:
0
;
for
(
int
y
=
1
;
y
<
size
.
height
;
++
y
)
for
(
int
y
=
1
;
y
<
size
.
height
;
++
y
)
{
{
...
@@ -2962,7 +2962,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy)
...
@@ -2962,7 +2962,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy)
{
{
calculateBayerPattern
<
uchar
,
CV_8U
>
(
src
,
bayer
,
types
[
i
]);
calculateBayerPattern
<
uchar
,
CV_8U
>
(
src
,
bayer
,
types
[
i
]);
Mat
reference
;
Mat
reference
;
test_Bayer2RGB_EdgeAware_8u
(
bayer
,
reference
,
C
V
_BayerBG2BGR_EA
+
i
);
test_Bayer2RGB_EdgeAware_8u
(
bayer
,
reference
,
C
OLOR
_BayerBG2BGR_EA
+
i
);
for
(
int
t
=
0
;
t
<=
1
;
++
t
)
for
(
int
t
=
0
;
t
<=
1
;
++
t
)
{
{
...
@@ -2972,7 +2972,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy)
...
@@ -2972,7 +2972,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy)
CV_Assert
(
!
bayer
.
empty
()
&&
(
bayer
.
type
()
==
CV_8UC1
||
bayer
.
type
()
==
CV_16UC1
));
CV_Assert
(
!
bayer
.
empty
()
&&
(
bayer
.
type
()
==
CV_8UC1
||
bayer
.
type
()
==
CV_16UC1
));
Mat
actual
;
Mat
actual
;
cv
::
demosaicing
(
bayer
,
actual
,
C
V
_BayerBG2BGR_EA
+
i
);
cv
::
demosaicing
(
bayer
,
actual
,
C
OLOR
_BayerBG2BGR_EA
+
i
);
if
(
t
==
0
)
if
(
t
==
0
)
checkData
<
unsigned
char
>
(
actual
,
reference
,
ts
,
types
[
i
],
next
,
"CV_8U"
);
checkData
<
unsigned
char
>
(
actual
,
reference
,
ts
,
types
[
i
],
next
,
"CV_8U"
);
...
@@ -2996,10 +2996,10 @@ TEST(ImgProc_Bayer2RGBA, accuracy)
...
@@ -2996,10 +2996,10 @@ TEST(ImgProc_Bayer2RGBA, accuracy)
CV_Assert
(
raw
.
depth
()
==
CV_8U
);
CV_Assert
(
raw
.
depth
()
==
CV_8U
);
CV_Assert
(
!
raw
.
empty
());
CV_Assert
(
!
raw
.
empty
());
for
(
int
code
=
C
V_BayerBG2BGR
;
code
<=
CV
_BayerGR2BGR
;
++
code
)
for
(
int
code
=
C
OLOR_BayerBG2BGR
;
code
<=
COLOR
_BayerGR2BGR
;
++
code
)
{
{
cvtColor
(
raw
,
rgb
,
code
);
cvtColor
(
raw
,
rgb
,
code
);
cvtColor
(
rgb
,
reference
,
C
V
_BGR2BGRA
);
cvtColor
(
rgb
,
reference
,
C
OLOR
_BGR2BGRA
);
Mat
actual
;
Mat
actual
;
cvtColor
(
raw
,
actual
,
code
,
4
);
cvtColor
(
raw
,
actual
,
code
,
4
);
...
...
modules/imgproc/test/test_cvtyuv.cpp
View file @
4d0ed5c1
...
@@ -361,54 +361,54 @@ YUVreader* YUVreader::getReader(int code)
...
@@ -361,54 +361,54 @@ YUVreader* YUVreader::getReader(int code)
{
{
switch
(
code
)
switch
(
code
)
{
{
case
C
V
_YUV2RGB_NV12
:
case
C
OLOR
_YUV2RGB_NV12
:
case
C
V
_YUV2BGR_NV12
:
case
C
OLOR
_YUV2BGR_NV12
:
case
C
V
_YUV2RGBA_NV12
:
case
C
OLOR
_YUV2RGBA_NV12
:
case
C
V
_YUV2BGRA_NV12
:
case
C
OLOR
_YUV2BGRA_NV12
:
return
new
NV12Reader
();
return
new
NV12Reader
();
case
C
V
_YUV2RGB_NV21
:
case
C
OLOR
_YUV2RGB_NV21
:
case
C
V
_YUV2BGR_NV21
:
case
C
OLOR
_YUV2BGR_NV21
:
case
C
V
_YUV2RGBA_NV21
:
case
C
OLOR
_YUV2RGBA_NV21
:
case
C
V
_YUV2BGRA_NV21
:
case
C
OLOR
_YUV2BGRA_NV21
:
return
new
NV21Reader
();
return
new
NV21Reader
();
case
C
V
_YUV2RGB_YV12
:
case
C
OLOR
_YUV2RGB_YV12
:
case
C
V
_YUV2BGR_YV12
:
case
C
OLOR
_YUV2BGR_YV12
:
case
C
V
_YUV2RGBA_YV12
:
case
C
OLOR
_YUV2RGBA_YV12
:
case
C
V
_YUV2BGRA_YV12
:
case
C
OLOR
_YUV2BGRA_YV12
:
return
new
YV12Reader
();
return
new
YV12Reader
();
case
C
V
_YUV2RGB_IYUV
:
case
C
OLOR
_YUV2RGB_IYUV
:
case
C
V
_YUV2BGR_IYUV
:
case
C
OLOR
_YUV2BGR_IYUV
:
case
C
V
_YUV2RGBA_IYUV
:
case
C
OLOR
_YUV2RGBA_IYUV
:
case
C
V
_YUV2BGRA_IYUV
:
case
C
OLOR
_YUV2BGRA_IYUV
:
return
new
IYUVReader
();
return
new
IYUVReader
();
case
C
V
_YUV2RGB_UYVY
:
case
C
OLOR
_YUV2RGB_UYVY
:
case
C
V
_YUV2BGR_UYVY
:
case
C
OLOR
_YUV2BGR_UYVY
:
case
C
V
_YUV2RGBA_UYVY
:
case
C
OLOR
_YUV2RGBA_UYVY
:
case
C
V
_YUV2BGRA_UYVY
:
case
C
OLOR
_YUV2BGRA_UYVY
:
return
new
UYVYReader
();
return
new
UYVYReader
();
//case C
V
_YUV2RGB_VYUY = 109,
//case C
OLOR
_YUV2RGB_VYUY = 109,
//case C
V
_YUV2BGR_VYUY = 110,
//case C
OLOR
_YUV2BGR_VYUY = 110,
//case C
V
_YUV2RGBA_VYUY = 113,
//case C
OLOR
_YUV2RGBA_VYUY = 113,
//case C
V
_YUV2BGRA_VYUY = 114,
//case C
OLOR
_YUV2BGRA_VYUY = 114,
// return ??
// return ??
case
C
V
_YUV2RGB_YUY2
:
case
C
OLOR
_YUV2RGB_YUY2
:
case
C
V
_YUV2BGR_YUY2
:
case
C
OLOR
_YUV2BGR_YUY2
:
case
C
V
_YUV2RGBA_YUY2
:
case
C
OLOR
_YUV2RGBA_YUY2
:
case
C
V
_YUV2BGRA_YUY2
:
case
C
OLOR
_YUV2BGRA_YUY2
:
return
new
YUY2Reader
();
return
new
YUY2Reader
();
case
C
V
_YUV2RGB_YVYU
:
case
C
OLOR
_YUV2RGB_YVYU
:
case
C
V
_YUV2BGR_YVYU
:
case
C
OLOR
_YUV2BGR_YVYU
:
case
C
V
_YUV2RGBA_YVYU
:
case
C
OLOR
_YUV2RGBA_YVYU
:
case
C
V
_YUV2BGRA_YVYU
:
case
C
OLOR
_YUV2BGRA_YVYU
:
return
new
YVYUReader
();
return
new
YVYUReader
();
case
C
V
_YUV2GRAY_420
:
case
C
OLOR
_YUV2GRAY_420
:
return
new
NV21Reader
();
return
new
NV21Reader
();
case
C
V
_YUV2GRAY_UYVY
:
case
C
OLOR
_YUV2GRAY_UYVY
:
return
new
UYVYReader
();
return
new
UYVYReader
();
case
C
V
_YUV2GRAY_YUY2
:
case
C
OLOR
_YUV2GRAY_YUY2
:
return
new
YUY2Reader
();
return
new
YUY2Reader
();
case
C
V
_YUV2BGR
:
case
C
OLOR
_YUV2BGR
:
case
C
V
_YUV2RGB
:
case
C
OLOR
_YUV2RGB
:
return
new
YUV888Reader
();
return
new
YUV888Reader
();
default
:
default
:
return
0
;
return
0
;
...
@@ -419,17 +419,17 @@ RGBreader* RGBreader::getReader(int code)
...
@@ -419,17 +419,17 @@ RGBreader* RGBreader::getReader(int code)
{
{
switch
(
code
)
switch
(
code
)
{
{
case
C
V
_RGB2YUV_YV12
:
case
C
OLOR
_RGB2YUV_YV12
:
case
C
V
_RGB2YUV_I420
:
case
C
OLOR
_RGB2YUV_I420
:
return
new
RGB888Reader
();
return
new
RGB888Reader
();
case
C
V
_BGR2YUV_YV12
:
case
C
OLOR
_BGR2YUV_YV12
:
case
C
V
_BGR2YUV_I420
:
case
C
OLOR
_BGR2YUV_I420
:
return
new
BGR888Reader
();
return
new
BGR888Reader
();
case
C
V
_RGBA2YUV_I420
:
case
C
OLOR
_RGBA2YUV_I420
:
case
C
V
_RGBA2YUV_YV12
:
case
C
OLOR
_RGBA2YUV_YV12
:
return
new
RGBA8888Reader
();
return
new
RGBA8888Reader
();
case
C
V
_BGRA2YUV_YV12
:
case
C
OLOR
_BGRA2YUV_YV12
:
case
C
V
_BGRA2YUV_I420
:
case
C
OLOR
_BGRA2YUV_I420
:
return
new
BGRA8888Reader
();
return
new
BGRA8888Reader
();
default
:
default
:
return
0
;
return
0
;
...
@@ -440,43 +440,43 @@ RGBwriter* RGBwriter::getWriter(int code)
...
@@ -440,43 +440,43 @@ RGBwriter* RGBwriter::getWriter(int code)
{
{
switch
(
code
)
switch
(
code
)
{
{
case
C
V
_YUV2RGB_NV12
:
case
C
OLOR
_YUV2RGB_NV12
:
case
C
V
_YUV2RGB_NV21
:
case
C
OLOR
_YUV2RGB_NV21
:
case
C
V
_YUV2RGB_YV12
:
case
C
OLOR
_YUV2RGB_YV12
:
case
C
V
_YUV2RGB_IYUV
:
case
C
OLOR
_YUV2RGB_IYUV
:
case
C
V
_YUV2RGB_UYVY
:
case
C
OLOR
_YUV2RGB_UYVY
:
//case C
V
_YUV2RGB_VYUY:
//case C
OLOR
_YUV2RGB_VYUY:
case
C
V
_YUV2RGB_YUY2
:
case
C
OLOR
_YUV2RGB_YUY2
:
case
C
V
_YUV2RGB_YVYU
:
case
C
OLOR
_YUV2RGB_YVYU
:
case
C
V
_YUV2RGB
:
case
C
OLOR
_YUV2RGB
:
return
new
RGB888Writer
();
return
new
RGB888Writer
();
case
C
V
_YUV2BGR_NV12
:
case
C
OLOR
_YUV2BGR_NV12
:
case
C
V
_YUV2BGR_NV21
:
case
C
OLOR
_YUV2BGR_NV21
:
case
C
V
_YUV2BGR_YV12
:
case
C
OLOR
_YUV2BGR_YV12
:
case
C
V
_YUV2BGR_IYUV
:
case
C
OLOR
_YUV2BGR_IYUV
:
case
C
V
_YUV2BGR_UYVY
:
case
C
OLOR
_YUV2BGR_UYVY
:
//case C
V
_YUV2BGR_VYUY:
//case C
OLOR
_YUV2BGR_VYUY:
case
C
V
_YUV2BGR_YUY2
:
case
C
OLOR
_YUV2BGR_YUY2
:
case
C
V
_YUV2BGR_YVYU
:
case
C
OLOR
_YUV2BGR_YVYU
:
case
C
V
_YUV2BGR
:
case
C
OLOR
_YUV2BGR
:
return
new
BGR888Writer
();
return
new
BGR888Writer
();
case
C
V
_YUV2RGBA_NV12
:
case
C
OLOR
_YUV2RGBA_NV12
:
case
C
V
_YUV2RGBA_NV21
:
case
C
OLOR
_YUV2RGBA_NV21
:
case
C
V
_YUV2RGBA_YV12
:
case
C
OLOR
_YUV2RGBA_YV12
:
case
C
V
_YUV2RGBA_IYUV
:
case
C
OLOR
_YUV2RGBA_IYUV
:
case
C
V
_YUV2RGBA_UYVY
:
case
C
OLOR
_YUV2RGBA_UYVY
:
//case C
V
_YUV2RGBA_VYUY:
//case C
OLOR
_YUV2RGBA_VYUY:
case
C
V
_YUV2RGBA_YUY2
:
case
C
OLOR
_YUV2RGBA_YUY2
:
case
C
V
_YUV2RGBA_YVYU
:
case
C
OLOR
_YUV2RGBA_YVYU
:
return
new
RGBA8888Writer
();
return
new
RGBA8888Writer
();
case
C
V
_YUV2BGRA_NV12
:
case
C
OLOR
_YUV2BGRA_NV12
:
case
C
V
_YUV2BGRA_NV21
:
case
C
OLOR
_YUV2BGRA_NV21
:
case
C
V
_YUV2BGRA_YV12
:
case
C
OLOR
_YUV2BGRA_YV12
:
case
C
V
_YUV2BGRA_IYUV
:
case
C
OLOR
_YUV2BGRA_IYUV
:
case
C
V
_YUV2BGRA_UYVY
:
case
C
OLOR
_YUV2BGRA_UYVY
:
//case C
V
_YUV2BGRA_VYUY:
//case C
OLOR
_YUV2BGRA_VYUY:
case
C
V
_YUV2BGRA_YUY2
:
case
C
OLOR
_YUV2BGRA_YUY2
:
case
C
V
_YUV2BGRA_YVYU
:
case
C
OLOR
_YUV2BGRA_YVYU
:
return
new
BGRA8888Writer
();
return
new
BGRA8888Writer
();
default
:
default
:
return
0
;
return
0
;
...
@@ -487,9 +487,9 @@ GRAYwriter* GRAYwriter::getWriter(int code)
...
@@ -487,9 +487,9 @@ GRAYwriter* GRAYwriter::getWriter(int code)
{
{
switch
(
code
)
switch
(
code
)
{
{
case
C
V
_YUV2GRAY_420
:
case
C
OLOR
_YUV2GRAY_420
:
case
C
V
_YUV2GRAY_UYVY
:
case
C
OLOR
_YUV2GRAY_UYVY
:
case
C
V
_YUV2GRAY_YUY2
:
case
C
OLOR
_YUV2GRAY_YUY2
:
return
new
GRAYwriter
();
return
new
GRAYwriter
();
default
:
default
:
return
0
;
return
0
;
...
@@ -500,15 +500,15 @@ YUVwriter* YUVwriter::getWriter(int code)
...
@@ -500,15 +500,15 @@ YUVwriter* YUVwriter::getWriter(int code)
{
{
switch
(
code
)
switch
(
code
)
{
{
case
C
V
_RGB2YUV_YV12
:
case
C
OLOR
_RGB2YUV_YV12
:
case
C
V
_BGR2YUV_YV12
:
case
C
OLOR
_BGR2YUV_YV12
:
case
C
V
_RGBA2YUV_YV12
:
case
C
OLOR
_RGBA2YUV_YV12
:
case
C
V
_BGRA2YUV_YV12
:
case
C
OLOR
_BGRA2YUV_YV12
:
return
new
YV12Writer
();
return
new
YV12Writer
();
case
C
V
_RGB2YUV_I420
:
case
C
OLOR
_RGB2YUV_I420
:
case
C
V
_BGR2YUV_I420
:
case
C
OLOR
_BGR2YUV_I420
:
case
C
V
_RGBA2YUV_I420
:
case
C
OLOR
_RGBA2YUV_I420
:
case
C
V
_BGRA2YUV_I420
:
case
C
OLOR
_BGRA2YUV_I420
:
return
new
I420Writer
();
return
new
I420Writer
();
default
:
default
:
return
0
;
return
0
;
...
@@ -611,16 +611,16 @@ struct ConversionYUV
...
@@ -611,16 +611,16 @@ struct ConversionYUV
GRAYwriter
*
grayWriter_
;
GRAYwriter
*
grayWriter_
;
};
};
CV_ENUM
(
YUVCVTS
,
C
V_YUV2RGB_NV12
,
CV_YUV2BGR_NV12
,
CV_YUV2RGB_NV21
,
CV
_YUV2BGR_NV21
,
CV_ENUM
(
YUVCVTS
,
C
OLOR_YUV2RGB_NV12
,
COLOR_YUV2BGR_NV12
,
COLOR_YUV2RGB_NV21
,
COLOR
_YUV2BGR_NV21
,
C
V_YUV2RGBA_NV12
,
CV_YUV2BGRA_NV12
,
CV_YUV2RGBA_NV21
,
CV
_YUV2BGRA_NV21
,
C
OLOR_YUV2RGBA_NV12
,
COLOR_YUV2BGRA_NV12
,
COLOR_YUV2RGBA_NV21
,
COLOR
_YUV2BGRA_NV21
,
C
V_YUV2RGB_YV12
,
CV_YUV2BGR_YV12
,
CV_YUV2RGB_IYUV
,
CV
_YUV2BGR_IYUV
,
C
OLOR_YUV2RGB_YV12
,
COLOR_YUV2BGR_YV12
,
COLOR_YUV2RGB_IYUV
,
COLOR
_YUV2BGR_IYUV
,
C
V_YUV2RGBA_YV12
,
CV_YUV2BGRA_YV12
,
CV_YUV2RGBA_IYUV
,
CV
_YUV2BGRA_IYUV
,
C
OLOR_YUV2RGBA_YV12
,
COLOR_YUV2BGRA_YV12
,
COLOR_YUV2RGBA_IYUV
,
COLOR
_YUV2BGRA_IYUV
,
C
V_YUV2RGB_UYVY
,
CV_YUV2BGR_UYVY
,
CV_YUV2RGBA_UYVY
,
CV
_YUV2BGRA_UYVY
,
C
OLOR_YUV2RGB_UYVY
,
COLOR_YUV2BGR_UYVY
,
COLOR_YUV2RGBA_UYVY
,
COLOR
_YUV2BGRA_UYVY
,
C
V_YUV2RGB_YUY2
,
CV_YUV2BGR_YUY2
,
CV_YUV2RGB_YVYU
,
CV
_YUV2BGR_YVYU
,
C
OLOR_YUV2RGB_YUY2
,
COLOR_YUV2BGR_YUY2
,
COLOR_YUV2RGB_YVYU
,
COLOR
_YUV2BGR_YVYU
,
C
V_YUV2RGBA_YUY2
,
CV_YUV2BGRA_YUY2
,
CV_YUV2RGBA_YVYU
,
CV
_YUV2BGRA_YVYU
,
C
OLOR_YUV2RGBA_YUY2
,
COLOR_YUV2BGRA_YUY2
,
COLOR_YUV2RGBA_YVYU
,
COLOR
_YUV2BGRA_YVYU
,
C
V_YUV2GRAY_420
,
CV_YUV2GRAY_UYVY
,
CV
_YUV2GRAY_YUY2
,
C
OLOR_YUV2GRAY_420
,
COLOR_YUV2GRAY_UYVY
,
COLOR
_YUV2GRAY_YUY2
,
C
V_YUV2BGR
,
CV_YUV2RGB
,
CV_RGB2YUV_YV12
,
CV_BGR2YUV_YV12
,
CV
_RGBA2YUV_YV12
,
C
OLOR_YUV2BGR
,
COLOR_YUV2RGB
,
COLOR_RGB2YUV_YV12
,
COLOR_BGR2YUV_YV12
,
COLOR
_RGBA2YUV_YV12
,
C
V_BGRA2YUV_YV12
,
CV_RGB2YUV_I420
,
CV_BGR2YUV_I420
,
CV_RGBA2YUV_I420
,
CV
_BGRA2YUV_I420
)
C
OLOR_BGRA2YUV_YV12
,
COLOR_RGB2YUV_I420
,
COLOR_BGR2YUV_I420
,
COLOR_RGBA2YUV_I420
,
COLOR
_BGRA2YUV_I420
)
typedef
::
testing
::
TestWithParam
<
YUVCVTS
>
Imgproc_ColorYUV
;
typedef
::
testing
::
TestWithParam
<
YUVCVTS
>
Imgproc_ColorYUV
;
...
@@ -710,18 +710,18 @@ TEST_P(Imgproc_ColorYUV, roi_accuracy)
...
@@ -710,18 +710,18 @@ TEST_P(Imgproc_ColorYUV, roi_accuracy)
}
}
INSTANTIATE_TEST_CASE_P
(
cvt420
,
Imgproc_ColorYUV
,
INSTANTIATE_TEST_CASE_P
(
cvt420
,
Imgproc_ColorYUV
,
::
testing
::
Values
((
int
)
C
V_YUV2RGB_NV12
,
(
int
)
CV_YUV2BGR_NV12
,
(
int
)
CV_YUV2RGB_NV21
,
(
int
)
CV
_YUV2BGR_NV21
,
::
testing
::
Values
((
int
)
C
OLOR_YUV2RGB_NV12
,
(
int
)
COLOR_YUV2BGR_NV12
,
(
int
)
COLOR_YUV2RGB_NV21
,
(
int
)
COLOR
_YUV2BGR_NV21
,
(
int
)
C
V_YUV2RGBA_NV12
,
(
int
)
CV_YUV2BGRA_NV12
,
(
int
)
CV_YUV2RGBA_NV21
,
(
int
)
CV
_YUV2BGRA_NV21
,
(
int
)
C
OLOR_YUV2RGBA_NV12
,
(
int
)
COLOR_YUV2BGRA_NV12
,
(
int
)
COLOR_YUV2RGBA_NV21
,
(
int
)
COLOR
_YUV2BGRA_NV21
,
(
int
)
C
V_YUV2RGB_YV12
,
(
int
)
CV_YUV2BGR_YV12
,
(
int
)
CV_YUV2RGB_IYUV
,
(
int
)
CV
_YUV2BGR_IYUV
,
(
int
)
C
OLOR_YUV2RGB_YV12
,
(
int
)
COLOR_YUV2BGR_YV12
,
(
int
)
COLOR_YUV2RGB_IYUV
,
(
int
)
COLOR
_YUV2BGR_IYUV
,
(
int
)
C
V_YUV2RGBA_YV12
,
(
int
)
CV_YUV2BGRA_YV12
,
(
int
)
CV_YUV2RGBA_IYUV
,
(
int
)
CV
_YUV2BGRA_IYUV
,
(
int
)
C
OLOR_YUV2RGBA_YV12
,
(
int
)
COLOR_YUV2BGRA_YV12
,
(
int
)
COLOR_YUV2RGBA_IYUV
,
(
int
)
COLOR
_YUV2BGRA_IYUV
,
(
int
)
C
V_YUV2GRAY_420
,
(
int
)
CV_RGB2YUV_YV12
,
(
int
)
CV_BGR2YUV_YV12
,
(
int
)
CV
_RGBA2YUV_YV12
,
(
int
)
C
OLOR_YUV2GRAY_420
,
(
int
)
COLOR_RGB2YUV_YV12
,
(
int
)
COLOR_BGR2YUV_YV12
,
(
int
)
COLOR
_RGBA2YUV_YV12
,
(
int
)
C
V_BGRA2YUV_YV12
,
(
int
)
CV_RGB2YUV_I420
,
(
int
)
CV_BGR2YUV_I420
,
(
int
)
CV
_RGBA2YUV_I420
,
(
int
)
C
OLOR_BGRA2YUV_YV12
,
(
int
)
COLOR_RGB2YUV_I420
,
(
int
)
COLOR_BGR2YUV_I420
,
(
int
)
COLOR
_RGBA2YUV_I420
,
(
int
)
C
V
_BGRA2YUV_I420
));
(
int
)
C
OLOR
_BGRA2YUV_I420
));
INSTANTIATE_TEST_CASE_P
(
cvt422
,
Imgproc_ColorYUV
,
INSTANTIATE_TEST_CASE_P
(
cvt422
,
Imgproc_ColorYUV
,
::
testing
::
Values
((
int
)
C
V_YUV2RGB_UYVY
,
(
int
)
CV_YUV2BGR_UYVY
,
(
int
)
CV_YUV2RGBA_UYVY
,
(
int
)
CV
_YUV2BGRA_UYVY
,
::
testing
::
Values
((
int
)
C
OLOR_YUV2RGB_UYVY
,
(
int
)
COLOR_YUV2BGR_UYVY
,
(
int
)
COLOR_YUV2RGBA_UYVY
,
(
int
)
COLOR
_YUV2BGRA_UYVY
,
(
int
)
C
V_YUV2RGB_YUY2
,
(
int
)
CV_YUV2BGR_YUY2
,
(
int
)
CV_YUV2RGB_YVYU
,
(
int
)
CV
_YUV2BGR_YVYU
,
(
int
)
C
OLOR_YUV2RGB_YUY2
,
(
int
)
COLOR_YUV2BGR_YUY2
,
(
int
)
COLOR_YUV2RGB_YVYU
,
(
int
)
COLOR
_YUV2BGR_YVYU
,
(
int
)
C
V_YUV2RGBA_YUY2
,
(
int
)
CV_YUV2BGRA_YUY2
,
(
int
)
CV_YUV2RGBA_YVYU
,
(
int
)
CV
_YUV2BGRA_YVYU
,
(
int
)
C
OLOR_YUV2RGBA_YUY2
,
(
int
)
COLOR_YUV2BGRA_YUY2
,
(
int
)
COLOR_YUV2RGBA_YVYU
,
(
int
)
COLOR
_YUV2BGRA_YVYU
,
(
int
)
C
V_YUV2GRAY_UYVY
,
(
int
)
CV
_YUV2GRAY_YUY2
));
(
int
)
C
OLOR_YUV2GRAY_UYVY
,
(
int
)
COLOR
_YUV2GRAY_YUY2
));
}}
// namespace
}}
// namespace
modules/imgproc/test/test_goodfeaturetotrack.cpp
View file @
4d0ed5c1
...
@@ -363,7 +363,7 @@ int CV_GoodFeatureToTTest::prepare_test_case( int test_case_idx )
...
@@ -363,7 +363,7 @@ int CV_GoodFeatureToTTest::prepare_test_case( int test_case_idx )
CV_Assert
(
src
.
data
!=
NULL
);
CV_Assert
(
src
.
data
!=
NULL
);
cvtColor
(
src
,
src_gray
,
C
V
_BGR2GRAY
);
cvtColor
(
src
,
src_gray
,
C
OLOR
_BGR2GRAY
);
SrcType
=
types
[
test_case_idx
&
0x1
];
SrcType
=
types
[
test_case_idx
&
0x1
];
useHarrisDetector
=
test_case_idx
&
2
?
true
:
false
;
useHarrisDetector
=
test_case_idx
&
2
?
true
:
false
;
return
1
;
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment