From 4d0ed5c13cee2091dde93617961afa9502bb1b95 Mon Sep 17 00:00:00 2001 From: Suleyman TURKMEN Date: Wed, 31 Oct 2018 18:08:24 +0300 Subject: [PATCH] Merge pull request #12971 from sturkmen72:upd_imgproc_hpp * Update imgproc.hpp * update color conversion codes --- modules/imgcodecs/src/grfmt_webp.cpp | 2 +- modules/imgcodecs/test/test_png.cpp | 2 +- modules/imgproc/include/opencv2/imgproc.hpp | 156 ++++++++---- modules/imgproc/src/demosaicing.cpp | 38 +-- modules/imgproc/test/test_color.cpp | 104 ++++---- modules/imgproc/test/test_cvtyuv.cpp | 222 +++++++++--------- .../imgproc/test/test_goodfeaturetotrack.cpp | 2 +- 7 files changed, 294 insertions(+), 232 deletions(-) diff --git a/modules/imgcodecs/src/grfmt_webp.cpp b/modules/imgcodecs/src/grfmt_webp.cpp index 6b1011240c..e137b8734d 100644 --- a/modules/imgcodecs/src/grfmt_webp.cpp +++ b/modules/imgcodecs/src/grfmt_webp.cpp @@ -266,7 +266,7 @@ bool WebPEncoder::write(const Mat& img, const std::vector& params) if (channels == 1) { - cvtColor(*image, temp, CV_GRAY2BGR); + cvtColor(*image, temp, COLOR_GRAY2BGR); image = &temp; channels = 3; } diff --git a/modules/imgcodecs/test/test_png.cpp b/modules/imgcodecs/test/test_png.cpp index ba4794632b..051cbf69e6 100644 --- a/modules/imgcodecs/test/test_png.cpp +++ b/modules/imgcodecs/test/test_png.cpp @@ -42,7 +42,7 @@ TEST(Imgcodecs_Png, regression_ImreadVSCvtColor) Mat original_image = imread(imgName); Mat gray_by_codec = imread(imgName, IMREAD_GRAYSCALE); Mat gray_by_cvt; - cvtColor(original_image, gray_by_cvt, CV_BGR2GRAY); + cvtColor(original_image, gray_by_cvt, COLOR_BGR2GRAY); Mat diff; absdiff(gray_by_codec, gray_by_cvt, diff); diff --git a/modules/imgproc/include/opencv2/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc.hpp index d489c02673..d60343a720 100644 --- a/modules/imgproc/include/opencv2/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc.hpp @@ -46,7 +46,10 @@ #include "opencv2/core.hpp" /** - @defgroup imgproc Image processing + @defgroup imgproc Image Processing + +This module includes image-processing functions. + @{ @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 semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main image. + @defgroup imgproc_color_conversions Color Space Conversions @defgroup imgproc_colormap ColorMaps in OpenCV The human perception isn't built for observing fine changes in grayscale images. Human eyes are more @@ -450,6 +454,9 @@ enum ShapeMatchModes { //! @} imgproc_shape +//! @addtogroup imgproc_feature +//! @{ + //! Variants of a Hough transform enum HoughModes { @@ -470,7 +477,6 @@ enum HoughModes { }; //! Variants of Line Segment %Detector -//! @ingroup imgproc_feature enum LineSegmentDetectorModes { LSD_REFINE_NONE = 0, //!< No refinement applied LSD_REFINE_STD = 1, //!< Standard refinement is applied. E.g. breaking arches into smaller straighter line approximations. @@ -478,6 +484,8 @@ enum LineSegmentDetectorModes { //!< refined through increase of precision, decrement in size, etc. }; +//! @} imgproc_feature + /** Histogram comparison methods @ingroup imgproc_hist */ @@ -508,9 +516,9 @@ enum HistCompMethods { HISTCMP_KL_DIV = 5 }; -/** the color conversion code +/** the color conversion codes @see @ref imgproc_color_conversions -@ingroup imgproc_misc +@ingroup imgproc_color_conversions */ enum ColorConversionCodes { COLOR_BGR2BGRA = 0, //!< add alpha channel to RGB or BGR image @@ -595,7 +603,7 @@ enum ColorConversionCodes { COLOR_HLS2BGR = 60, COLOR_HLS2RGB = 61, - COLOR_BGR2HSV_FULL = 66, //!< + COLOR_BGR2HSV_FULL = 66, COLOR_RGB2HSV_FULL = 67, COLOR_BGR2HLS_FULL = 68, COLOR_RGB2HLS_FULL = 69, @@ -779,16 +787,18 @@ enum ColorConversionCodes { COLOR_COLORCVT_MAX = 143 }; -/** types of intersection between rectangles -@ingroup imgproc_shape -*/ +//! @addtogroup imgproc_shape +//! @{ + +//! types of intersection between rectangles enum RectanglesIntersectTypes { INTERSECT_NONE = 0, //!< No intersection INTERSECT_PARTIAL = 1, //!< There is a partial intersection 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 { public: @@ -821,8 +831,10 @@ public: virtual int getMaxBufferSize() const = 0; }; -//! 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 +/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform + +Detects position only without translation and rotation @cite Ballard1981 . +*/ class CV_EXPORTS GeneralizedHoughBallard : public GeneralizedHough { public: @@ -835,8 +847,10 @@ public: 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. -//! Detects position, translation and rotation +/** @brief finds arbitrary template in the grayscale image using Generalized Hough Transform + +Detects position, translation and rotation @cite Guil1999 . +*/ class CV_EXPORTS GeneralizedHoughGuil : public GeneralizedHough { public: @@ -889,14 +903,19 @@ public: 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 { public: /** @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. */ CV_WRAP virtual void apply(InputArray src, OutputArray dst) = 0; @@ -923,6 +942,7 @@ public: CV_WRAP virtual void collectGarbage() = 0; }; +//! @} imgproc_hist //! @addtogroup imgproc_subdiv2d //! @{ @@ -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 variance and standard deviation around the neighborhood of a pixel. -@param _src input image -@param _dst output image of the same size and type as _src +@param src input image +@param dst output image of the same size and type as _src @param ddepth the output image depth (-1 to use src.depth()) @param ksize kernel size @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. @param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes @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), bool normalize = true, int borderType = BORDER_DEFAULT ); @@ -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 ); +/** @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 createCLAHE(double clipLimit = 40.0, Size tileGridSize = Size(8, 8)); + /** @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 @@ -3593,6 +3621,20 @@ CV_EXPORTS_W int floodFill( InputOutputArray image, InputOutputArray mask, Scalar loDiff = Scalar(), Scalar upDiff = Scalar(), 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. 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. */ 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 -CV_EXPORTS_W void demosaicing(InputArray _src, OutputArray _dst, int code, int dcn = 0); +- Demosaicing using Variable Number of Gradients. + + #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 //! @{ @@ -3905,13 +3976,14 @@ The function computes a curve length or a closed contour perimeter. */ 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. @@ -4037,6 +4109,12 @@ vector: std::vector\ implies returnPoints=false, std::vector\ impl returnPoints=true. @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, bool clockwise = false, bool returnPoints = true ); @@ -4243,31 +4321,15 @@ at most 8 vertices. Stored as std::vector\ or cv::Mat as Mx1 of ty */ CV_EXPORTS_W int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& rect2, OutputArray intersectingRegion ); -//! @} imgproc_shape -/** @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 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 +/** @brief Creates a smart pointer to a cv::GeneralizedHoughBallard class and initializes it. +*/ CV_EXPORTS Ptr 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. -//! Detects position, translation and rotation +/** @brief Creates a smart pointer to a cv::GeneralizedHoughGuil class and initializes it. +*/ CV_EXPORTS Ptr createGeneralizedHoughGuil(); -//! 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_shape //! @addtogroup imgproc_colormap //! @{ diff --git a/modules/imgproc/src/demosaicing.cpp b/modules/imgproc/src/demosaicing.cpp index 684ff026d1..9162e35fdf 100644 --- a/modules/imgproc/src/demosaicing.cpp +++ b/modules/imgproc/src/demosaicing.cpp @@ -658,10 +658,10 @@ static void Bayer2Gray_( const Mat& srcmat, Mat& dstmat, int code ) Size size = srcmat.size(); int bcoeff = B2Y, rcoeff = R2Y; - int start_with_green = code == CV_BayerGB2GRAY || code == CV_BayerGR2GRAY; + int start_with_green = code == COLOR_BayerGB2GRAY || code == COLOR_BayerGR2GRAY; bool brow = true; - if( code != CV_BayerBG2GRAY && code != CV_BayerGB2GRAY ) + if( code != COLOR_BayerBG2GRAY && code != COLOR_BayerGB2GRAY ) { brow = false; std::swap(bcoeff, rcoeff); @@ -923,10 +923,10 @@ static void Bayer2RGB_( const Mat& srcmat, Mat& dstmat, int code ) { int dst_step = (int)(dstmat.step/sizeof(T)); Size size = srcmat.size(); - int blue = (code == CV_BayerBG2BGR || code == CV_BayerGB2BGR || - code == CV_BayerBG2BGRA || code == CV_BayerGB2BGRA ) ? -1 : 1; - int start_with_green = (code == CV_BayerGB2BGR || code == CV_BayerGR2BGR || - code == CV_BayerGB2BGRA || code == CV_BayerGR2BGRA); + int blue = (code == COLOR_BayerBG2BGR || code == COLOR_BayerGB2BGR || + code == COLOR_BayerBG2BGRA || code == COLOR_BayerGB2BGRA ) ? -1 : 1; + int start_with_green = (code == COLOR_BayerGB2BGR || code == COLOR_BayerGR2BGR || + code == COLOR_BayerGB2BGRA || code == COLOR_BayerGR2BGRA); int dcn = dstmat.channels(); size.height -= 2; @@ -964,8 +964,8 @@ static void Bayer2RGB_VNG_8u( const Mat& srcmat, Mat& dstmat, int code ) int dststep = (int)dstmat.step; Size size = srcmat.size(); - int blueIdx = code == CV_BayerBG2BGR_VNG || code == CV_BayerGB2BGR_VNG ? 0 : 2; - bool greenCell0 = code != CV_BayerBG2BGR_VNG && code != CV_BayerRG2BGR_VNG; + int blueIdx = code == COLOR_BayerBG2BGR_VNG || code == COLOR_BayerGB2BGR_VNG ? 0 : 2; + bool greenCell0 = code != COLOR_BayerBG2BGR_VNG && code != COLOR_BayerRG2BGR_VNG; // for too small images use the simple interpolation algorithm if( MIN(size.width, size.height) < 8 ) @@ -1625,8 +1625,8 @@ static void Bayer2RGB_EdgeAware_T(const Mat& src, Mat& dst, int code) size.width -= 2; size.height -= 2; - int start_with_green = code == CV_BayerGB2BGR_EA || code == CV_BayerGR2BGR_EA ? 1 : 0; - int blue = code == CV_BayerGB2BGR_EA || code == CV_BayerBG2BGR_EA ? 1 : 0; + int start_with_green = code == COLOR_BayerGB2BGR_EA || code == COLOR_BayerGR2BGR_EA ? 1 : 0; + int blue = code == COLOR_BayerGB2BGR_EA || code == COLOR_BayerBG2BGR_EA ? 1 : 0; if (size.height > 0) { @@ -1672,7 +1672,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn) switch (code) { - case CV_BayerBG2GRAY: case CV_BayerGB2GRAY: case CV_BayerRG2GRAY: case CV_BayerGR2GRAY: + case COLOR_BayerBG2GRAY: case COLOR_BayerGB2GRAY: case COLOR_BayerRG2GRAY: case COLOR_BayerGR2GRAY: if (dcn <= 0) dcn = 1; CV_Assert( scn == 1 && dcn == 1 ); @@ -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"); break; - case CV_BayerBG2BGRA: case CV_BayerGB2BGRA: case CV_BayerRG2BGRA: case CV_BayerGR2BGRA: + case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA: case COLOR_BayerRG2BGRA: case COLOR_BayerGR2BGRA: if (dcn <= 0) dcn = 4; /* fallthrough */ - case CV_BayerBG2BGR: case CV_BayerGB2BGR: case CV_BayerRG2BGR: case CV_BayerGR2BGR: - case CV_BayerBG2BGR_VNG: case CV_BayerGB2BGR_VNG: case CV_BayerRG2BGR_VNG: case CV_BayerGR2BGR_VNG: + case COLOR_BayerBG2BGR: case COLOR_BayerGB2BGR: case COLOR_BayerRG2BGR: case COLOR_BayerGR2BGR: + case COLOR_BayerBG2BGR_VNG: case COLOR_BayerGB2BGR_VNG: case COLOR_BayerRG2BGR_VNG: case COLOR_BayerGR2BGR_VNG: { if (dcn <= 0) dcn = 3; @@ -1702,10 +1702,10 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn) _dst.create(sz, CV_MAKE_TYPE(depth, dcn)); Mat dst_ = _dst.getMat(); - if( code == CV_BayerBG2BGR || code == CV_BayerBG2BGRA || - code == CV_BayerGB2BGR || code == CV_BayerGB2BGRA || - code == CV_BayerRG2BGR || code == CV_BayerRG2BGRA || - code == CV_BayerGR2BGR || code == CV_BayerGR2BGRA ) + if( code == COLOR_BayerBG2BGR || code == COLOR_BayerBG2BGRA || + code == COLOR_BayerGB2BGR || code == COLOR_BayerGB2BGRA || + code == COLOR_BayerRG2BGR || code == COLOR_BayerRG2BGRA || + code == COLOR_BayerGR2BGR || code == COLOR_BayerGR2BGRA ) { if( depth == CV_8U ) Bayer2RGB_(src, dst_, code); @@ -1722,7 +1722,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn) } break; - case CV_BayerBG2BGR_EA: case CV_BayerGB2BGR_EA: case CV_BayerRG2BGR_EA: case CV_BayerGR2BGR_EA: + case COLOR_BayerBG2BGR_EA: case COLOR_BayerGB2BGR_EA: case COLOR_BayerRG2BGR_EA: case COLOR_BayerGR2BGR_EA: if (dcn <= 0) dcn = 3; diff --git a/modules/imgproc/test/test_color.cpp b/modules/imgproc/test/test_color.cpp index 5f5de472a2..c36bc1fd6e 100644 --- a/modules/imgproc/test/test_color.cpp +++ b/modules/imgproc/test/test_color.cpp @@ -415,7 +415,7 @@ void CV_ColorCvtBaseTest::convert_backward( const Mat& src, const Mat& dst, Mat& #undef INIT_FWD_INV_CODES #define INIT_FWD_INV_CODES( fwd, inv ) \ - fwd_code = CV_##fwd; inv_code = CV_##inv; \ + fwd_code = COLOR_##fwd; inv_code = COLOR_##inv; \ fwd_code_str = #fwd; inv_code_str = #inv //// rgb <=> gray @@ -447,16 +447,16 @@ void CV_ColorGrayTest::get_test_array_types_and_sizes( int test_case_idx, vector if( cn == 3 ) { if( blue_idx == 0 ) - fwd_code = CV_BGR2GRAY, inv_code = CV_GRAY2BGR; + fwd_code = COLOR_BGR2GRAY, inv_code = COLOR_GRAY2BGR; else - fwd_code = CV_RGB2GRAY, inv_code = CV_GRAY2RGB; + fwd_code = COLOR_RGB2GRAY, inv_code = COLOR_GRAY2RGB; } else { if( blue_idx == 0 ) - fwd_code = CV_BGRA2GRAY, inv_code = CV_GRAY2BGRA; + fwd_code = COLOR_BGRA2GRAY, inv_code = COLOR_GRAY2BGRA; else - fwd_code = CV_RGBA2GRAY, inv_code = CV_GRAY2RGBA; + fwd_code = COLOR_RGBA2GRAY, inv_code = COLOR_GRAY2RGBA; } } @@ -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 ); if( blue_idx == 0 ) - fwd_code = CV_BGR2YCrCb, inv_code = CV_YCrCb2BGR; + fwd_code = COLOR_BGR2YCrCb, inv_code = COLOR_YCrCb2BGR; else - fwd_code = CV_RGB2YCrCb, inv_code = CV_YCrCb2RGB; + fwd_code = COLOR_RGB2YCrCb, inv_code = COLOR_YCrCb2RGB; } @@ -612,17 +612,17 @@ void CV_ColorHSVTest::get_test_array_types_and_sizes( int test_case_idx, vector< if( full_hrange ) { if( blue_idx == 0 ) - fwd_code = CV_BGR2HSV_FULL, inv_code = CV_HSV2BGR_FULL; + fwd_code = COLOR_BGR2HSV_FULL, inv_code = COLOR_HSV2BGR_FULL; else - fwd_code = CV_RGB2HSV_FULL, inv_code = CV_HSV2RGB_FULL; + fwd_code = COLOR_RGB2HSV_FULL, inv_code = COLOR_HSV2RGB_FULL; hue_range = 256; } else { if( blue_idx == 0 ) - fwd_code = CV_BGR2HSV, inv_code = CV_HSV2BGR; + fwd_code = COLOR_BGR2HSV, inv_code = COLOR_HSV2BGR; else - fwd_code = CV_RGB2HSV, inv_code = CV_HSV2RGB; + fwd_code = COLOR_RGB2HSV, inv_code = COLOR_HSV2RGB; hue_range = 180; } } @@ -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 ); if( blue_idx == 0 ) - fwd_code = CV_BGR2HLS, inv_code = CV_HLS2BGR; + fwd_code = COLOR_BGR2HLS, inv_code = COLOR_HLS2BGR; else - fwd_code = CV_RGB2HLS, inv_code = CV_HLS2RGB; + fwd_code = COLOR_RGB2HLS, inv_code = COLOR_HLS2RGB; } @@ -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 ); if( blue_idx == 0 ) - fwd_code = CV_BGR2XYZ, inv_code = CV_XYZ2BGR; + fwd_code = COLOR_BGR2XYZ, inv_code = COLOR_XYZ2BGR; else - fwd_code = CV_RGB2XYZ, inv_code = CV_XYZ2RGB; + fwd_code = COLOR_RGB2XYZ, inv_code = COLOR_XYZ2RGB; } @@ -1059,16 +1059,16 @@ void CV_ColorLabTest::get_test_array_types_and_sizes( int test_case_idx, vector< if(srgb) { if( blue_idx == 0 ) - fwd_code = CV_BGR2Lab, inv_code = CV_Lab2BGR; + fwd_code = COLOR_BGR2Lab, inv_code = COLOR_Lab2BGR; else - fwd_code = CV_RGB2Lab, inv_code = CV_Lab2RGB; + fwd_code = COLOR_RGB2Lab, inv_code = COLOR_Lab2RGB; } else { if( blue_idx == 0 ) - fwd_code = CV_LBGR2Lab, inv_code = CV_Lab2LBGR; + fwd_code = COLOR_LBGR2Lab, inv_code = COLOR_Lab2LBGR; else - fwd_code = CV_LRGB2Lab, inv_code = CV_Lab2LRGB; + fwd_code = COLOR_LRGB2Lab, inv_code = COLOR_Lab2LRGB; } } @@ -1238,16 +1238,16 @@ void CV_ColorLuvTest::get_test_array_types_and_sizes( int test_case_idx, vector< if(srgb) { if( blue_idx == 0 ) - fwd_code = CV_BGR2Luv, inv_code = CV_Luv2BGR; + fwd_code = COLOR_BGR2Luv, inv_code = COLOR_Luv2BGR; else - fwd_code = CV_RGB2Luv, inv_code = CV_Luv2RGB; + fwd_code = COLOR_RGB2Luv, inv_code = COLOR_Luv2RGB; } else { if( blue_idx == 0 ) - fwd_code = CV_LBGR2Luv, inv_code = CV_Luv2LBGR; + fwd_code = COLOR_LBGR2Luv, inv_code = COLOR_Luv2LBGR; else - fwd_code = CV_LRGB2Luv, inv_code = CV_Luv2LRGB; + fwd_code = COLOR_LRGB2Luv, inv_code = COLOR_Luv2LRGB; } } @@ -1453,17 +1453,17 @@ void CV_ColorRGBTest::get_test_array_types_and_sizes( int test_case_idx, vector< if( cvtest::randInt(rng) & 1 ) { if( blue_idx == 0 ) - fwd_code = CV_BGR2BGR565, inv_code = CV_BGR5652BGR; + fwd_code = COLOR_BGR2BGR565, inv_code = COLOR_BGR5652BGR; else - fwd_code = CV_RGB2BGR565, inv_code = CV_BGR5652RGB; + fwd_code = COLOR_RGB2BGR565, inv_code = COLOR_BGR5652RGB; dst_bits = 16; } else { if( blue_idx == 0 ) - fwd_code = CV_BGR2BGR555, inv_code = CV_BGR5552BGR; + fwd_code = COLOR_BGR2BGR555, inv_code = COLOR_BGR5552BGR; else - fwd_code = CV_RGB2BGR555, inv_code = CV_BGR5552RGB; + fwd_code = COLOR_RGB2BGR555, inv_code = COLOR_BGR5552RGB; dst_bits = 15; } } @@ -1471,13 +1471,13 @@ void CV_ColorRGBTest::get_test_array_types_and_sizes( int test_case_idx, vector< { if( cn == 3 ) { - fwd_code = CV_RGB2BGR, inv_code = CV_BGR2RGB; + fwd_code = COLOR_RGB2BGR, inv_code = COLOR_BGR2RGB; blue_idx = 2; } else if( blue_idx == 0 ) - fwd_code = CV_BGRA2BGR, inv_code = CV_BGR2BGRA; + fwd_code = COLOR_BGRA2BGR, inv_code = COLOR_BGR2BGRA; else - fwd_code = CV_RGBA2BGR, inv_code = CV_BGR2RGBA; + fwd_code = COLOR_RGBA2BGR, inv_code = COLOR_BGR2RGBA; } 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 fwd_code_str = "BayerBG2BGR"; inv_code_str = ""; - fwd_code = CV_BayerBG2BGR; + fwd_code = COLOR_BayerBG2BGR; inv_code = -1; } @@ -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); inplace = false; - fwd_code = cvtest::randInt(rng)%4 + CV_BayerBG2BGR; + fwd_code = cvtest::randInt(rng)%4 + COLOR_BayerBG2BGR; } @@ -1747,7 +1747,7 @@ static void bayer2BGR_(const Mat& src, Mat& dst, int code) int bi = 0; int step = (int)(src.step/sizeof(T)); - if( code == CV_BayerRG2BGR || code == CV_BayerGR2BGR ) + if( code == COLOR_BayerRG2BGR || code == COLOR_BayerGR2BGR ) bi ^= 2; for( i = 1; i < src.rows - 1; i++ ) @@ -1850,7 +1850,7 @@ TEST(Imgproc_ColorBayer, regression) CV_Assert( !given.empty() && !gold.empty() ); - cvtColor(given, result, CV_BayerBG2GRAY); + cvtColor(given, result, COLOR_BayerBG2GRAY); EXPECT_EQ(gold.type(), result.type()); EXPECT_EQ(gold.cols, result.cols); @@ -1873,7 +1873,7 @@ TEST(Imgproc_ColorBayerVNG, regression) CV_Assert( !given.empty() ); - cvtColor(given, result, CV_BayerBG2BGR_VNG, 3); + cvtColor(given, result, COLOR_BayerBG2BGR_VNG, 3); if (gold.empty()) imwrite(goldfname, result); @@ -1977,7 +1977,7 @@ TEST(Imgproc_ColorBayerVNG_Strict, regression) CV_Assert(!bayer.empty() && bayer.type() == CV_8UC1); // calculating a dst image - cvtColor(bayer, dst, CV_BayerBG2BGR_VNG + i); + cvtColor(bayer, dst, COLOR_BayerBG2BGR_VNG + i); // reading a reference image full_path = parent_path + pattern[i] + image_name; @@ -2099,8 +2099,8 @@ TEST(Imgproc_ColorLab_Full, accuracy) // Convert test image to LAB cv::Mat lab; - int forward_code = blueInd ? srgb ? CV_BGR2Lab : CV_LBGR2Lab : srgb ? CV_RGB2Lab : CV_LRGB2Lab; - int inverse_code = blueInd ? srgb ? CV_Lab2BGR : CV_Lab2LBGR : srgb ? CV_Lab2RGB : CV_Lab2LRGB; + int forward_code = blueInd ? srgb ? COLOR_BGR2Lab : COLOR_LBGR2Lab : srgb ? COLOR_RGB2Lab : COLOR_LRGB2Lab; + int inverse_code = blueInd ? srgb ? COLOR_Lab2BGR : COLOR_Lab2LBGR : srgb ? COLOR_Lab2RGB : COLOR_Lab2LRGB; cv::cvtColor(src, lab, forward_code); // Convert LAB image back to BGR(RGB) cv::Mat recons; @@ -2623,10 +2623,10 @@ int row8uLuvChoose(const uchar* src_row, uchar *dst_row, int n, bool forward, in TEST(Imgproc_ColorLab_Full, bitExactness) { - int codes[] = { CV_BGR2Lab, CV_RGB2Lab, CV_LBGR2Lab, CV_LRGB2Lab, - CV_Lab2BGR, CV_Lab2RGB, CV_Lab2LBGR, CV_Lab2LRGB}; - string names[] = { "CV_BGR2Lab", "CV_RGB2Lab", "CV_LBGR2Lab", "CV_LRGB2Lab", - "CV_Lab2BGR", "CV_Lab2RGB", "CV_Lab2LBGR", "CV_Lab2LRGB" }; + int codes[] = { COLOR_BGR2Lab, COLOR_RGB2Lab, COLOR_LBGR2Lab, COLOR_LRGB2Lab, + COLOR_Lab2BGR, COLOR_Lab2RGB, COLOR_Lab2LBGR, COLOR_Lab2LRGB}; + string names[] = { "COLOR_BGR2Lab", "COLOR_RGB2Lab", "COLOR_LBGR2Lab", "COLOR_LRGB2Lab", + "COLOR_Lab2BGR", "COLOR_Lab2RGB", "COLOR_Lab2LBGR", "COLOR_Lab2LRGB" }; // need to be recalculated each time we change Lab algorithms, RNG or test system const int nIterations = 8; @@ -2707,10 +2707,10 @@ TEST(Imgproc_ColorLab_Full, bitExactness) TEST(Imgproc_ColorLuv_Full, bitExactness) { - int codes[] = { CV_BGR2Luv, CV_RGB2Luv, CV_LBGR2Luv, CV_LRGB2Luv, - CV_Luv2BGR, CV_Luv2RGB, CV_Luv2LBGR, CV_Luv2LRGB}; - string names[] = { "CV_BGR2Luv", "CV_RGB2Luv", "CV_LBGR2Luv", "CV_LRGB2Luv", - "CV_Luv2BGR", "CV_Luv2RGB", "CV_Luv2LBGR", "CV_Luv2LRGB" }; + int codes[] = { COLOR_BGR2Luv, COLOR_RGB2Luv, COLOR_LBGR2Luv, COLOR_LRGB2Luv, + COLOR_Luv2BGR, COLOR_Luv2RGB, COLOR_Luv2LBGR, COLOR_Luv2LRGB}; + string names[] = { "COLOR_BGR2Luv", "COLOR_RGB2Luv", "COLOR_LBGR2Luv", "COLOR_LRGB2Luv", + "COLOR_Luv2BGR", "COLOR_Luv2RGB", "COLOR_Luv2LBGR", "COLOR_Luv2LRGB" }; /* to be enabled when bit-exactness is done for other codes */ 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) const uchar* S = src.ptr(1) + 1; uchar* D = dst.ptr(1) + dcn; - int start_with_green = code == CV_BayerGB2BGR_EA || code == CV_BayerGR2BGR_EA ? 1 : 0; - int blue = code == CV_BayerGB2BGR_EA || code == CV_BayerBG2BGR_EA ? 1 : 0; + int start_with_green = code == COLOR_BayerGB2BGR_EA || code == COLOR_BayerGR2BGR_EA ? 1 : 0; + int blue = code == COLOR_BayerGB2BGR_EA || code == COLOR_BayerBG2BGR_EA ? 1 : 0; for (int y = 1; y < size.height; ++y) { @@ -2962,7 +2962,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy) { calculateBayerPattern(src, bayer, types[i]); Mat reference; - test_Bayer2RGB_EdgeAware_8u(bayer, reference, CV_BayerBG2BGR_EA + i); + test_Bayer2RGB_EdgeAware_8u(bayer, reference, COLOR_BayerBG2BGR_EA + i); for (int t = 0; t <= 1; ++t) { @@ -2972,7 +2972,7 @@ TEST(ImgProc_BayerEdgeAwareDemosaicing, accuracy) CV_Assert(!bayer.empty() && (bayer.type() == CV_8UC1 || bayer.type() == CV_16UC1)); Mat actual; - cv::demosaicing(bayer, actual, CV_BayerBG2BGR_EA + i); + cv::demosaicing(bayer, actual, COLOR_BayerBG2BGR_EA + i); if (t == 0) checkData(actual, reference, ts, types[i], next, "CV_8U"); @@ -2996,10 +2996,10 @@ TEST(ImgProc_Bayer2RGBA, accuracy) CV_Assert(raw.depth() == CV_8U); CV_Assert(!raw.empty()); - for (int code = CV_BayerBG2BGR; code <= CV_BayerGR2BGR; ++code) + for (int code = COLOR_BayerBG2BGR; code <= COLOR_BayerGR2BGR; ++code) { cvtColor(raw, rgb, code); - cvtColor(rgb, reference, CV_BGR2BGRA); + cvtColor(rgb, reference, COLOR_BGR2BGRA); Mat actual; cvtColor(raw, actual, code, 4); diff --git a/modules/imgproc/test/test_cvtyuv.cpp b/modules/imgproc/test/test_cvtyuv.cpp index c5a1e36a98..2a2f72ffe2 100644 --- a/modules/imgproc/test/test_cvtyuv.cpp +++ b/modules/imgproc/test/test_cvtyuv.cpp @@ -361,54 +361,54 @@ YUVreader* YUVreader::getReader(int code) { switch(code) { - case CV_YUV2RGB_NV12: - case CV_YUV2BGR_NV12: - case CV_YUV2RGBA_NV12: - case CV_YUV2BGRA_NV12: + case COLOR_YUV2RGB_NV12: + case COLOR_YUV2BGR_NV12: + case COLOR_YUV2RGBA_NV12: + case COLOR_YUV2BGRA_NV12: return new NV12Reader(); - case CV_YUV2RGB_NV21: - case CV_YUV2BGR_NV21: - case CV_YUV2RGBA_NV21: - case CV_YUV2BGRA_NV21: + case COLOR_YUV2RGB_NV21: + case COLOR_YUV2BGR_NV21: + case COLOR_YUV2RGBA_NV21: + case COLOR_YUV2BGRA_NV21: return new NV21Reader(); - case CV_YUV2RGB_YV12: - case CV_YUV2BGR_YV12: - case CV_YUV2RGBA_YV12: - case CV_YUV2BGRA_YV12: + case COLOR_YUV2RGB_YV12: + case COLOR_YUV2BGR_YV12: + case COLOR_YUV2RGBA_YV12: + case COLOR_YUV2BGRA_YV12: return new YV12Reader(); - case CV_YUV2RGB_IYUV: - case CV_YUV2BGR_IYUV: - case CV_YUV2RGBA_IYUV: - case CV_YUV2BGRA_IYUV: + case COLOR_YUV2RGB_IYUV: + case COLOR_YUV2BGR_IYUV: + case COLOR_YUV2RGBA_IYUV: + case COLOR_YUV2BGRA_IYUV: return new IYUVReader(); - case CV_YUV2RGB_UYVY: - case CV_YUV2BGR_UYVY: - case CV_YUV2RGBA_UYVY: - case CV_YUV2BGRA_UYVY: + case COLOR_YUV2RGB_UYVY: + case COLOR_YUV2BGR_UYVY: + case COLOR_YUV2RGBA_UYVY: + case COLOR_YUV2BGRA_UYVY: return new UYVYReader(); - //case CV_YUV2RGB_VYUY = 109, - //case CV_YUV2BGR_VYUY = 110, - //case CV_YUV2RGBA_VYUY = 113, - //case CV_YUV2BGRA_VYUY = 114, + //case COLOR_YUV2RGB_VYUY = 109, + //case COLOR_YUV2BGR_VYUY = 110, + //case COLOR_YUV2RGBA_VYUY = 113, + //case COLOR_YUV2BGRA_VYUY = 114, // return ?? - case CV_YUV2RGB_YUY2: - case CV_YUV2BGR_YUY2: - case CV_YUV2RGBA_YUY2: - case CV_YUV2BGRA_YUY2: + case COLOR_YUV2RGB_YUY2: + case COLOR_YUV2BGR_YUY2: + case COLOR_YUV2RGBA_YUY2: + case COLOR_YUV2BGRA_YUY2: return new YUY2Reader(); - case CV_YUV2RGB_YVYU: - case CV_YUV2BGR_YVYU: - case CV_YUV2RGBA_YVYU: - case CV_YUV2BGRA_YVYU: + case COLOR_YUV2RGB_YVYU: + case COLOR_YUV2BGR_YVYU: + case COLOR_YUV2RGBA_YVYU: + case COLOR_YUV2BGRA_YVYU: return new YVYUReader(); - case CV_YUV2GRAY_420: + case COLOR_YUV2GRAY_420: return new NV21Reader(); - case CV_YUV2GRAY_UYVY: + case COLOR_YUV2GRAY_UYVY: return new UYVYReader(); - case CV_YUV2GRAY_YUY2: + case COLOR_YUV2GRAY_YUY2: return new YUY2Reader(); - case CV_YUV2BGR: - case CV_YUV2RGB: + case COLOR_YUV2BGR: + case COLOR_YUV2RGB: return new YUV888Reader(); default: return 0; @@ -419,17 +419,17 @@ RGBreader* RGBreader::getReader(int code) { switch(code) { - case CV_RGB2YUV_YV12: - case CV_RGB2YUV_I420: + case COLOR_RGB2YUV_YV12: + case COLOR_RGB2YUV_I420: return new RGB888Reader(); - case CV_BGR2YUV_YV12: - case CV_BGR2YUV_I420: + case COLOR_BGR2YUV_YV12: + case COLOR_BGR2YUV_I420: return new BGR888Reader(); - case CV_RGBA2YUV_I420: - case CV_RGBA2YUV_YV12: + case COLOR_RGBA2YUV_I420: + case COLOR_RGBA2YUV_YV12: return new RGBA8888Reader(); - case CV_BGRA2YUV_YV12: - case CV_BGRA2YUV_I420: + case COLOR_BGRA2YUV_YV12: + case COLOR_BGRA2YUV_I420: return new BGRA8888Reader(); default: return 0; @@ -440,43 +440,43 @@ RGBwriter* RGBwriter::getWriter(int code) { switch(code) { - case CV_YUV2RGB_NV12: - case CV_YUV2RGB_NV21: - case CV_YUV2RGB_YV12: - case CV_YUV2RGB_IYUV: - case CV_YUV2RGB_UYVY: - //case CV_YUV2RGB_VYUY: - case CV_YUV2RGB_YUY2: - case CV_YUV2RGB_YVYU: - case CV_YUV2RGB: + case COLOR_YUV2RGB_NV12: + case COLOR_YUV2RGB_NV21: + case COLOR_YUV2RGB_YV12: + case COLOR_YUV2RGB_IYUV: + case COLOR_YUV2RGB_UYVY: + //case COLOR_YUV2RGB_VYUY: + case COLOR_YUV2RGB_YUY2: + case COLOR_YUV2RGB_YVYU: + case COLOR_YUV2RGB: return new RGB888Writer(); - case CV_YUV2BGR_NV12: - case CV_YUV2BGR_NV21: - case CV_YUV2BGR_YV12: - case CV_YUV2BGR_IYUV: - case CV_YUV2BGR_UYVY: - //case CV_YUV2BGR_VYUY: - case CV_YUV2BGR_YUY2: - case CV_YUV2BGR_YVYU: - case CV_YUV2BGR: + case COLOR_YUV2BGR_NV12: + case COLOR_YUV2BGR_NV21: + case COLOR_YUV2BGR_YV12: + case COLOR_YUV2BGR_IYUV: + case COLOR_YUV2BGR_UYVY: + //case COLOR_YUV2BGR_VYUY: + case COLOR_YUV2BGR_YUY2: + case COLOR_YUV2BGR_YVYU: + case COLOR_YUV2BGR: return new BGR888Writer(); - case CV_YUV2RGBA_NV12: - case CV_YUV2RGBA_NV21: - case CV_YUV2RGBA_YV12: - case CV_YUV2RGBA_IYUV: - case CV_YUV2RGBA_UYVY: - //case CV_YUV2RGBA_VYUY: - case CV_YUV2RGBA_YUY2: - case CV_YUV2RGBA_YVYU: + case COLOR_YUV2RGBA_NV12: + case COLOR_YUV2RGBA_NV21: + case COLOR_YUV2RGBA_YV12: + case COLOR_YUV2RGBA_IYUV: + case COLOR_YUV2RGBA_UYVY: + //case COLOR_YUV2RGBA_VYUY: + case COLOR_YUV2RGBA_YUY2: + case COLOR_YUV2RGBA_YVYU: return new RGBA8888Writer(); - case CV_YUV2BGRA_NV12: - case CV_YUV2BGRA_NV21: - case CV_YUV2BGRA_YV12: - case CV_YUV2BGRA_IYUV: - case CV_YUV2BGRA_UYVY: - //case CV_YUV2BGRA_VYUY: - case CV_YUV2BGRA_YUY2: - case CV_YUV2BGRA_YVYU: + case COLOR_YUV2BGRA_NV12: + case COLOR_YUV2BGRA_NV21: + case COLOR_YUV2BGRA_YV12: + case COLOR_YUV2BGRA_IYUV: + case COLOR_YUV2BGRA_UYVY: + //case COLOR_YUV2BGRA_VYUY: + case COLOR_YUV2BGRA_YUY2: + case COLOR_YUV2BGRA_YVYU: return new BGRA8888Writer(); default: return 0; @@ -487,9 +487,9 @@ GRAYwriter* GRAYwriter::getWriter(int code) { switch(code) { - case CV_YUV2GRAY_420: - case CV_YUV2GRAY_UYVY: - case CV_YUV2GRAY_YUY2: + case COLOR_YUV2GRAY_420: + case COLOR_YUV2GRAY_UYVY: + case COLOR_YUV2GRAY_YUY2: return new GRAYwriter(); default: return 0; @@ -500,15 +500,15 @@ YUVwriter* YUVwriter::getWriter(int code) { switch(code) { - case CV_RGB2YUV_YV12: - case CV_BGR2YUV_YV12: - case CV_RGBA2YUV_YV12: - case CV_BGRA2YUV_YV12: + case COLOR_RGB2YUV_YV12: + case COLOR_BGR2YUV_YV12: + case COLOR_RGBA2YUV_YV12: + case COLOR_BGRA2YUV_YV12: return new YV12Writer(); - case CV_RGB2YUV_I420: - case CV_BGR2YUV_I420: - case CV_RGBA2YUV_I420: - case CV_BGRA2YUV_I420: + case COLOR_RGB2YUV_I420: + case COLOR_BGR2YUV_I420: + case COLOR_RGBA2YUV_I420: + case COLOR_BGRA2YUV_I420: return new I420Writer(); default: return 0; @@ -611,16 +611,16 @@ struct ConversionYUV GRAYwriter* grayWriter_; }; -CV_ENUM(YUVCVTS, CV_YUV2RGB_NV12, CV_YUV2BGR_NV12, CV_YUV2RGB_NV21, CV_YUV2BGR_NV21, - CV_YUV2RGBA_NV12, CV_YUV2BGRA_NV12, CV_YUV2RGBA_NV21, CV_YUV2BGRA_NV21, - CV_YUV2RGB_YV12, CV_YUV2BGR_YV12, CV_YUV2RGB_IYUV, CV_YUV2BGR_IYUV, - CV_YUV2RGBA_YV12, CV_YUV2BGRA_YV12, CV_YUV2RGBA_IYUV, CV_YUV2BGRA_IYUV, - CV_YUV2RGB_UYVY, CV_YUV2BGR_UYVY, CV_YUV2RGBA_UYVY, CV_YUV2BGRA_UYVY, - CV_YUV2RGB_YUY2, CV_YUV2BGR_YUY2, CV_YUV2RGB_YVYU, CV_YUV2BGR_YVYU, - CV_YUV2RGBA_YUY2, CV_YUV2BGRA_YUY2, CV_YUV2RGBA_YVYU, CV_YUV2BGRA_YVYU, - CV_YUV2GRAY_420, CV_YUV2GRAY_UYVY, CV_YUV2GRAY_YUY2, - CV_YUV2BGR, CV_YUV2RGB, CV_RGB2YUV_YV12, CV_BGR2YUV_YV12, CV_RGBA2YUV_YV12, - CV_BGRA2YUV_YV12, CV_RGB2YUV_I420, CV_BGR2YUV_I420, CV_RGBA2YUV_I420, CV_BGRA2YUV_I420) +CV_ENUM(YUVCVTS, COLOR_YUV2RGB_NV12, COLOR_YUV2BGR_NV12, COLOR_YUV2RGB_NV21, COLOR_YUV2BGR_NV21, + COLOR_YUV2RGBA_NV12, COLOR_YUV2BGRA_NV12, COLOR_YUV2RGBA_NV21, COLOR_YUV2BGRA_NV21, + COLOR_YUV2RGB_YV12, COLOR_YUV2BGR_YV12, COLOR_YUV2RGB_IYUV, COLOR_YUV2BGR_IYUV, + COLOR_YUV2RGBA_YV12, COLOR_YUV2BGRA_YV12, COLOR_YUV2RGBA_IYUV, COLOR_YUV2BGRA_IYUV, + COLOR_YUV2RGB_UYVY, COLOR_YUV2BGR_UYVY, COLOR_YUV2RGBA_UYVY, COLOR_YUV2BGRA_UYVY, + COLOR_YUV2RGB_YUY2, COLOR_YUV2BGR_YUY2, COLOR_YUV2RGB_YVYU, COLOR_YUV2BGR_YVYU, + COLOR_YUV2RGBA_YUY2, COLOR_YUV2BGRA_YUY2, COLOR_YUV2RGBA_YVYU, COLOR_YUV2BGRA_YVYU, + COLOR_YUV2GRAY_420, COLOR_YUV2GRAY_UYVY, COLOR_YUV2GRAY_YUY2, + COLOR_YUV2BGR, COLOR_YUV2RGB, COLOR_RGB2YUV_YV12, COLOR_BGR2YUV_YV12, COLOR_RGBA2YUV_YV12, + COLOR_BGRA2YUV_YV12, COLOR_RGB2YUV_I420, COLOR_BGR2YUV_I420, COLOR_RGBA2YUV_I420, COLOR_BGRA2YUV_I420) typedef ::testing::TestWithParam Imgproc_ColorYUV; @@ -710,18 +710,18 @@ TEST_P(Imgproc_ColorYUV, roi_accuracy) } INSTANTIATE_TEST_CASE_P(cvt420, Imgproc_ColorYUV, - ::testing::Values((int)CV_YUV2RGB_NV12, (int)CV_YUV2BGR_NV12, (int)CV_YUV2RGB_NV21, (int)CV_YUV2BGR_NV21, - (int)CV_YUV2RGBA_NV12, (int)CV_YUV2BGRA_NV12, (int)CV_YUV2RGBA_NV21, (int)CV_YUV2BGRA_NV21, - (int)CV_YUV2RGB_YV12, (int)CV_YUV2BGR_YV12, (int)CV_YUV2RGB_IYUV, (int)CV_YUV2BGR_IYUV, - (int)CV_YUV2RGBA_YV12, (int)CV_YUV2BGRA_YV12, (int)CV_YUV2RGBA_IYUV, (int)CV_YUV2BGRA_IYUV, - (int)CV_YUV2GRAY_420, (int)CV_RGB2YUV_YV12, (int)CV_BGR2YUV_YV12, (int)CV_RGBA2YUV_YV12, - (int)CV_BGRA2YUV_YV12, (int)CV_RGB2YUV_I420, (int)CV_BGR2YUV_I420, (int)CV_RGBA2YUV_I420, - (int)CV_BGRA2YUV_I420)); + ::testing::Values((int)COLOR_YUV2RGB_NV12, (int)COLOR_YUV2BGR_NV12, (int)COLOR_YUV2RGB_NV21, (int)COLOR_YUV2BGR_NV21, + (int)COLOR_YUV2RGBA_NV12, (int)COLOR_YUV2BGRA_NV12, (int)COLOR_YUV2RGBA_NV21, (int)COLOR_YUV2BGRA_NV21, + (int)COLOR_YUV2RGB_YV12, (int)COLOR_YUV2BGR_YV12, (int)COLOR_YUV2RGB_IYUV, (int)COLOR_YUV2BGR_IYUV, + (int)COLOR_YUV2RGBA_YV12, (int)COLOR_YUV2BGRA_YV12, (int)COLOR_YUV2RGBA_IYUV, (int)COLOR_YUV2BGRA_IYUV, + (int)COLOR_YUV2GRAY_420, (int)COLOR_RGB2YUV_YV12, (int)COLOR_BGR2YUV_YV12, (int)COLOR_RGBA2YUV_YV12, + (int)COLOR_BGRA2YUV_YV12, (int)COLOR_RGB2YUV_I420, (int)COLOR_BGR2YUV_I420, (int)COLOR_RGBA2YUV_I420, + (int)COLOR_BGRA2YUV_I420)); INSTANTIATE_TEST_CASE_P(cvt422, Imgproc_ColorYUV, - ::testing::Values((int)CV_YUV2RGB_UYVY, (int)CV_YUV2BGR_UYVY, (int)CV_YUV2RGBA_UYVY, (int)CV_YUV2BGRA_UYVY, - (int)CV_YUV2RGB_YUY2, (int)CV_YUV2BGR_YUY2, (int)CV_YUV2RGB_YVYU, (int)CV_YUV2BGR_YVYU, - (int)CV_YUV2RGBA_YUY2, (int)CV_YUV2BGRA_YUY2, (int)CV_YUV2RGBA_YVYU, (int)CV_YUV2BGRA_YVYU, - (int)CV_YUV2GRAY_UYVY, (int)CV_YUV2GRAY_YUY2)); + ::testing::Values((int)COLOR_YUV2RGB_UYVY, (int)COLOR_YUV2BGR_UYVY, (int)COLOR_YUV2RGBA_UYVY, (int)COLOR_YUV2BGRA_UYVY, + (int)COLOR_YUV2RGB_YUY2, (int)COLOR_YUV2BGR_YUY2, (int)COLOR_YUV2RGB_YVYU, (int)COLOR_YUV2BGR_YVYU, + (int)COLOR_YUV2RGBA_YUY2, (int)COLOR_YUV2BGRA_YUY2, (int)COLOR_YUV2RGBA_YVYU, (int)COLOR_YUV2BGRA_YVYU, + (int)COLOR_YUV2GRAY_UYVY, (int)COLOR_YUV2GRAY_YUY2)); }} // namespace diff --git a/modules/imgproc/test/test_goodfeaturetotrack.cpp b/modules/imgproc/test/test_goodfeaturetotrack.cpp index 362cc014cf..097ced35a9 100644 --- a/modules/imgproc/test/test_goodfeaturetotrack.cpp +++ b/modules/imgproc/test/test_goodfeaturetotrack.cpp @@ -363,7 +363,7 @@ int CV_GoodFeatureToTTest::prepare_test_case( int test_case_idx ) CV_Assert(src.data != NULL); - cvtColor( src, src_gray, CV_BGR2GRAY ); + cvtColor( src, src_gray, COLOR_BGR2GRAY ); SrcType = types[test_case_idx & 0x1]; useHarrisDetector = test_case_idx & 2 ? true : false; return 1;