Path: blob/master/modules/imgproc/test/test_cvtyuv.cpp
16344 views
#include "test_precomp.hpp"12namespace opencv_test { namespace {34#undef RGB5#undef YUV67typedef Vec3b YUV;8typedef Vec3b RGB;910int countOfDifferencies(const Mat& gold, const Mat& result, int maxAllowedDifference = 1)11{12Mat diff;13absdiff(gold, result, diff);14return countNonZero(diff.reshape(1) > maxAllowedDifference);15}1617class YUVreader18{19public:20virtual ~YUVreader() {}21virtual YUV read(const Mat& yuv, int row, int col) = 0;22virtual int channels() = 0;23virtual Size size(Size imgSize) = 0;2425virtual bool requiresEvenHeight() { return true; }26virtual bool requiresEvenWidth() { return true; }2728static YUVreader* getReader(int code);29};3031class RGBreader32{33public:34virtual ~RGBreader() {}35virtual RGB read(const Mat& rgb, int row, int col) = 0;36virtual int channels() = 0;3738static RGBreader* getReader(int code);39};4041class RGBwriter42{43public:44virtual ~RGBwriter() {}4546virtual void write(Mat& rgb, int row, int col, const RGB& val) = 0;47virtual int channels() = 0;4849static RGBwriter* getWriter(int code);50};5152class GRAYwriter53{54public:55virtual ~GRAYwriter() {}5657virtual void write(Mat& gray, int row, int col, const uchar& val)58{59gray.at<uchar>(row, col) = val;60}6162virtual int channels() { return 1; }6364static GRAYwriter* getWriter(int code);65};6667class YUVwriter68{69public:70virtual ~YUVwriter() {}7172virtual void write(Mat& yuv, int row, int col, const YUV& val) = 0;73virtual int channels() = 0;74virtual Size size(Size imgSize) = 0;7576virtual bool requiresEvenHeight() { return true; }77virtual bool requiresEvenWidth() { return true; }7879static YUVwriter* getWriter(int code);80};8182class RGB888Writer : public RGBwriter83{84void write(Mat& rgb, int row, int col, const RGB& val)85{86rgb.at<Vec3b>(row, col) = val;87}8889int channels() { return 3; }90};9192class BGR888Writer : public RGBwriter93{94void write(Mat& rgb, int row, int col, const RGB& val)95{96Vec3b tmp(val[2], val[1], val[0]);97rgb.at<Vec3b>(row, col) = tmp;98}99100int channels() { return 3; }101};102103class RGBA8888Writer : public RGBwriter104{105void write(Mat& rgb, int row, int col, const RGB& val)106{107Vec4b tmp(val[0], val[1], val[2], 255);108rgb.at<Vec4b>(row, col) = tmp;109}110111int channels() { return 4; }112};113114class BGRA8888Writer : public RGBwriter115{116void write(Mat& rgb, int row, int col, const RGB& val)117{118Vec4b tmp(val[2], val[1], val[0], 255);119rgb.at<Vec4b>(row, col) = tmp;120}121122int channels() { return 4; }123};124125class YUV420pWriter: public YUVwriter126{127int channels() { return 1; }128Size size(Size imgSize) { return Size(imgSize.width, imgSize.height + imgSize.height/2); }129};130131class YV12Writer: public YUV420pWriter132{133void write(Mat& yuv, int row, int col, const YUV& val)134{135int h = yuv.rows * 2 / 3;136137yuv.ptr<uchar>(row)[col] = val[0];138if( row % 2 == 0 && col % 2 == 0 )139{140yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)] = val[2];141yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)] = val[1];142}143}144};145146class I420Writer: public YUV420pWriter147{148void write(Mat& yuv, int row, int col, const YUV& val)149{150int h = yuv.rows * 2 / 3;151152yuv.ptr<uchar>(row)[col] = val[0];153if( row % 2 == 0 && col % 2 == 0 )154{155yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)] = val[1];156yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)] = val[2];157}158}159};160161class YUV420Reader: public YUVreader162{163int channels() { return 1; }164Size size(Size imgSize) { return Size(imgSize.width, imgSize.height * 3 / 2); }165};166167class YUV422Reader: public YUVreader168{169int channels() { return 2; }170Size size(Size imgSize) { return imgSize; }171bool requiresEvenHeight() { return false; }172};173174class NV21Reader: public YUV420Reader175{176YUV read(const Mat& yuv, int row, int col)177{178uchar y = yuv.ptr<uchar>(row)[col];179uchar u = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2 + 1];180uchar v = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2];181182return YUV(y, u, v);183}184};185186187struct NV12Reader: public YUV420Reader188{189YUV read(const Mat& yuv, int row, int col)190{191uchar y = yuv.ptr<uchar>(row)[col];192uchar u = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2];193uchar v = yuv.ptr<uchar>(yuv.rows * 2 / 3 + row/2)[(col/2)*2 + 1];194195return YUV(y, u, v);196}197};198199class YV12Reader: public YUV420Reader200{201YUV read(const Mat& yuv, int row, int col)202{203int h = yuv.rows * 2 / 3;204uchar y = yuv.ptr<uchar>(row)[col];205uchar u = yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)];206uchar v = yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)];207208return YUV(y, u, v);209}210};211212class IYUVReader: public YUV420Reader213{214YUV read(const Mat& yuv, int row, int col)215{216int h = yuv.rows * 2 / 3;217uchar y = yuv.ptr<uchar>(row)[col];218uchar u = yuv.ptr<uchar>(h + row/4)[col/2 + ((row/2) % 2) * (yuv.cols/2)];219uchar v = yuv.ptr<uchar>(h + (row/2 + h/2)/2)[col/2 + ((row/2 + h/2) % 2) * (yuv.cols/2)];220221return YUV(y, u, v);222}223};224225class UYVYReader: public YUV422Reader226{227YUV read(const Mat& yuv, int row, int col)228{229uchar y = yuv.ptr<Vec2b>(row)[col][1];230uchar u = yuv.ptr<Vec2b>(row)[(col/2)*2][0];231uchar v = yuv.ptr<Vec2b>(row)[(col/2)*2 + 1][0];232233return YUV(y, u, v);234}235};236237class YUY2Reader: public YUV422Reader238{239YUV read(const Mat& yuv, int row, int col)240{241uchar y = yuv.ptr<Vec2b>(row)[col][0];242uchar u = yuv.ptr<Vec2b>(row)[(col/2)*2][1];243uchar v = yuv.ptr<Vec2b>(row)[(col/2)*2 + 1][1];244245return YUV(y, u, v);246}247};248249class YVYUReader: public YUV422Reader250{251YUV read(const Mat& yuv, int row, int col)252{253uchar y = yuv.ptr<Vec2b>(row)[col][0];254uchar u = yuv.ptr<Vec2b>(row)[(col/2)*2 + 1][1];255uchar v = yuv.ptr<Vec2b>(row)[(col/2)*2][1];256257return YUV(y, u, v);258}259};260261class YUV888Reader : public YUVreader262{263YUV read(const Mat& yuv, int row, int col)264{265return yuv.at<YUV>(row, col);266}267268int channels() { return 3; }269Size size(Size imgSize) { return imgSize; }270bool requiresEvenHeight() { return false; }271bool requiresEvenWidth() { return false; }272};273274class RGB888Reader : public RGBreader275{276RGB read(const Mat& rgb, int row, int col)277{278return rgb.at<RGB>(row, col);279}280281int channels() { return 3; }282};283284class BGR888Reader : public RGBreader285{286RGB read(const Mat& rgb, int row, int col)287{288RGB tmp = rgb.at<RGB>(row, col);289return RGB(tmp[2], tmp[1], tmp[0]);290}291292int channels() { return 3; }293};294295class RGBA8888Reader : public RGBreader296{297RGB read(const Mat& rgb, int row, int col)298{299Vec4b rgba = rgb.at<Vec4b>(row, col);300return RGB(rgba[0], rgba[1], rgba[2]);301}302303int channels() { return 4; }304};305306class BGRA8888Reader : public RGBreader307{308RGB read(const Mat& rgb, int row, int col)309{310Vec4b rgba = rgb.at<Vec4b>(row, col);311return RGB(rgba[2], rgba[1], rgba[0]);312}313314int channels() { return 4; }315};316317class YUV2RGB_Converter318{319public:320RGB convert(YUV yuv)321{322int y = std::max(0, yuv[0] - 16);323int u = yuv[1] - 128;324int v = yuv[2] - 128;325uchar r = saturate_cast<uchar>(1.164f * y + 1.596f * v);326uchar g = saturate_cast<uchar>(1.164f * y - 0.813f * v - 0.391f * u);327uchar b = saturate_cast<uchar>(1.164f * y + 2.018f * u);328329return RGB(r, g, b);330}331};332333class YUV2GRAY_Converter334{335public:336uchar convert(YUV yuv)337{338return yuv[0];339}340};341342class RGB2YUV_Converter343{344public:345YUV convert(RGB rgb)346{347int r = rgb[0];348int g = rgb[1];349int b = rgb[2];350351uchar y = saturate_cast<uchar>((int)( 0.257f*r + 0.504f*g + 0.098f*b + 0.5f) + 16);352uchar u = saturate_cast<uchar>((int)(-0.148f*r - 0.291f*g + 0.439f*b + 0.5f) + 128);353uchar v = saturate_cast<uchar>((int)( 0.439f*r - 0.368f*g - 0.071f*b + 0.5f) + 128);354355return YUV(y, u, v);356}357};358359YUVreader* YUVreader::getReader(int code)360{361switch(code)362{363case CV_YUV2RGB_NV12:364case CV_YUV2BGR_NV12:365case CV_YUV2RGBA_NV12:366case CV_YUV2BGRA_NV12:367return new NV12Reader();368case CV_YUV2RGB_NV21:369case CV_YUV2BGR_NV21:370case CV_YUV2RGBA_NV21:371case CV_YUV2BGRA_NV21:372return new NV21Reader();373case CV_YUV2RGB_YV12:374case CV_YUV2BGR_YV12:375case CV_YUV2RGBA_YV12:376case CV_YUV2BGRA_YV12:377return new YV12Reader();378case CV_YUV2RGB_IYUV:379case CV_YUV2BGR_IYUV:380case CV_YUV2RGBA_IYUV:381case CV_YUV2BGRA_IYUV:382return new IYUVReader();383case CV_YUV2RGB_UYVY:384case CV_YUV2BGR_UYVY:385case CV_YUV2RGBA_UYVY:386case CV_YUV2BGRA_UYVY:387return new UYVYReader();388//case CV_YUV2RGB_VYUY = 109,389//case CV_YUV2BGR_VYUY = 110,390//case CV_YUV2RGBA_VYUY = 113,391//case CV_YUV2BGRA_VYUY = 114,392// return ??393case CV_YUV2RGB_YUY2:394case CV_YUV2BGR_YUY2:395case CV_YUV2RGBA_YUY2:396case CV_YUV2BGRA_YUY2:397return new YUY2Reader();398case CV_YUV2RGB_YVYU:399case CV_YUV2BGR_YVYU:400case CV_YUV2RGBA_YVYU:401case CV_YUV2BGRA_YVYU:402return new YVYUReader();403case CV_YUV2GRAY_420:404return new NV21Reader();405case CV_YUV2GRAY_UYVY:406return new UYVYReader();407case CV_YUV2GRAY_YUY2:408return new YUY2Reader();409case CV_YUV2BGR:410case CV_YUV2RGB:411return new YUV888Reader();412default:413return 0;414}415}416417RGBreader* RGBreader::getReader(int code)418{419switch(code)420{421case CV_RGB2YUV_YV12:422case CV_RGB2YUV_I420:423return new RGB888Reader();424case CV_BGR2YUV_YV12:425case CV_BGR2YUV_I420:426return new BGR888Reader();427case CV_RGBA2YUV_I420:428case CV_RGBA2YUV_YV12:429return new RGBA8888Reader();430case CV_BGRA2YUV_YV12:431case CV_BGRA2YUV_I420:432return new BGRA8888Reader();433default:434return 0;435};436}437438RGBwriter* RGBwriter::getWriter(int code)439{440switch(code)441{442case CV_YUV2RGB_NV12:443case CV_YUV2RGB_NV21:444case CV_YUV2RGB_YV12:445case CV_YUV2RGB_IYUV:446case CV_YUV2RGB_UYVY:447//case CV_YUV2RGB_VYUY:448case CV_YUV2RGB_YUY2:449case CV_YUV2RGB_YVYU:450case CV_YUV2RGB:451return new RGB888Writer();452case CV_YUV2BGR_NV12:453case CV_YUV2BGR_NV21:454case CV_YUV2BGR_YV12:455case CV_YUV2BGR_IYUV:456case CV_YUV2BGR_UYVY:457//case CV_YUV2BGR_VYUY:458case CV_YUV2BGR_YUY2:459case CV_YUV2BGR_YVYU:460case CV_YUV2BGR:461return new BGR888Writer();462case CV_YUV2RGBA_NV12:463case CV_YUV2RGBA_NV21:464case CV_YUV2RGBA_YV12:465case CV_YUV2RGBA_IYUV:466case CV_YUV2RGBA_UYVY:467//case CV_YUV2RGBA_VYUY:468case CV_YUV2RGBA_YUY2:469case CV_YUV2RGBA_YVYU:470return new RGBA8888Writer();471case CV_YUV2BGRA_NV12:472case CV_YUV2BGRA_NV21:473case CV_YUV2BGRA_YV12:474case CV_YUV2BGRA_IYUV:475case CV_YUV2BGRA_UYVY:476//case CV_YUV2BGRA_VYUY:477case CV_YUV2BGRA_YUY2:478case CV_YUV2BGRA_YVYU:479return new BGRA8888Writer();480default:481return 0;482};483}484485GRAYwriter* GRAYwriter::getWriter(int code)486{487switch(code)488{489case CV_YUV2GRAY_420:490case CV_YUV2GRAY_UYVY:491case CV_YUV2GRAY_YUY2:492return new GRAYwriter();493default:494return 0;495}496}497498YUVwriter* YUVwriter::getWriter(int code)499{500switch(code)501{502case CV_RGB2YUV_YV12:503case CV_BGR2YUV_YV12:504case CV_RGBA2YUV_YV12:505case CV_BGRA2YUV_YV12:506return new YV12Writer();507case CV_RGB2YUV_I420:508case CV_BGR2YUV_I420:509case CV_RGBA2YUV_I420:510case CV_BGRA2YUV_I420:511return new I420Writer();512default:513return 0;514};515}516517template<class convertor>518void referenceYUV2RGB(const Mat& yuv, Mat& rgb, YUVreader* yuvReader, RGBwriter* rgbWriter)519{520convertor cvt;521522for(int row = 0; row < rgb.rows; ++row)523for(int col = 0; col < rgb.cols; ++col)524rgbWriter->write(rgb, row, col, cvt.convert(yuvReader->read(yuv, row, col)));525}526527template<class convertor>528void referenceYUV2GRAY(const Mat& yuv, Mat& rgb, YUVreader* yuvReader, GRAYwriter* grayWriter)529{530convertor cvt;531532for(int row = 0; row < rgb.rows; ++row)533for(int col = 0; col < rgb.cols; ++col)534grayWriter->write(rgb, row, col, cvt.convert(yuvReader->read(yuv, row, col)));535}536537template<class convertor>538void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter* yuvWriter)539{540convertor cvt;541542for(int row = 0; row < rgb.rows; ++row)543for(int col = 0; col < rgb.cols; ++col)544yuvWriter->write(yuv, row, col, cvt.convert(rgbReader->read(rgb, row, col)));545}546547struct ConversionYUV548{549explicit ConversionYUV( const int code )550{551yuvReader_ = YUVreader :: getReader(code);552yuvWriter_ = YUVwriter :: getWriter(code);553rgbReader_ = RGBreader :: getReader(code);554rgbWriter_ = RGBwriter :: getWriter(code);555grayWriter_ = GRAYwriter:: getWriter(code);556}557558~ConversionYUV()559{560if (yuvReader_)561delete yuvReader_;562563if (yuvWriter_)564delete yuvWriter_;565566if (rgbReader_)567delete rgbReader_;568569if (rgbWriter_)570delete rgbWriter_;571572if (grayWriter_)573delete grayWriter_;574}575576int getDcn()577{578return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());579}580581int getScn()582{583return (yuvReader_ != 0) ? yuvReader_->channels() : rgbReader_->channels();584}585586Size getSrcSize( const Size& imgSize )587{588return (yuvReader_ != 0) ? yuvReader_->size(imgSize) : imgSize;589}590591Size getDstSize( const Size& imgSize )592{593return (yuvWriter_ != 0) ? yuvWriter_->size(imgSize) : imgSize;594}595596bool requiresEvenHeight()597{598return (yuvReader_ != 0) ? yuvReader_->requiresEvenHeight() : ((yuvWriter_ != 0) ? yuvWriter_->requiresEvenHeight() : false);599}600601bool requiresEvenWidth()602{603return (yuvReader_ != 0) ? yuvReader_->requiresEvenWidth() : ((yuvWriter_ != 0) ? yuvWriter_->requiresEvenWidth() : false);604}605606YUVreader* yuvReader_;607YUVwriter* yuvWriter_;608RGBreader* rgbReader_;609RGBwriter* rgbWriter_;610GRAYwriter* grayWriter_;611};612613CV_ENUM(YUVCVTS, CV_YUV2RGB_NV12, CV_YUV2BGR_NV12, CV_YUV2RGB_NV21, CV_YUV2BGR_NV21,614CV_YUV2RGBA_NV12, CV_YUV2BGRA_NV12, CV_YUV2RGBA_NV21, CV_YUV2BGRA_NV21,615CV_YUV2RGB_YV12, CV_YUV2BGR_YV12, CV_YUV2RGB_IYUV, CV_YUV2BGR_IYUV,616CV_YUV2RGBA_YV12, CV_YUV2BGRA_YV12, CV_YUV2RGBA_IYUV, CV_YUV2BGRA_IYUV,617CV_YUV2RGB_UYVY, CV_YUV2BGR_UYVY, CV_YUV2RGBA_UYVY, CV_YUV2BGRA_UYVY,618CV_YUV2RGB_YUY2, CV_YUV2BGR_YUY2, CV_YUV2RGB_YVYU, CV_YUV2BGR_YVYU,619CV_YUV2RGBA_YUY2, CV_YUV2BGRA_YUY2, CV_YUV2RGBA_YVYU, CV_YUV2BGRA_YVYU,620CV_YUV2GRAY_420, CV_YUV2GRAY_UYVY, CV_YUV2GRAY_YUY2,621CV_YUV2BGR, CV_YUV2RGB, CV_RGB2YUV_YV12, CV_BGR2YUV_YV12, CV_RGBA2YUV_YV12,622CV_BGRA2YUV_YV12, CV_RGB2YUV_I420, CV_BGR2YUV_I420, CV_RGBA2YUV_I420, CV_BGRA2YUV_I420)623624typedef ::testing::TestWithParam<YUVCVTS> Imgproc_ColorYUV;625626TEST_P(Imgproc_ColorYUV, accuracy)627{628int code = GetParam();629RNG& random = theRNG();630631ConversionYUV cvt(code);632633const int scn = cvt.getScn();634const int dcn = cvt.getDcn();635for(int iter = 0; iter < 30; ++iter)636{637Size sz(random.uniform(1, 641), random.uniform(1, 481));638639if(cvt.requiresEvenWidth()) sz.width += sz.width % 2;640if(cvt.requiresEvenHeight()) sz.height += sz.height % 2;641642Size srcSize = cvt.getSrcSize(sz);643Mat src = Mat(srcSize.height, srcSize.width * scn, CV_8UC1).reshape(scn);644645Size dstSize = cvt.getDstSize(sz);646Mat dst = Mat(dstSize.height, dstSize.width * dcn, CV_8UC1).reshape(dcn);647Mat gold(dstSize, CV_8UC(dcn));648649random.fill(src, RNG::UNIFORM, 0, 256);650651if(cvt.rgbWriter_)652referenceYUV2RGB<YUV2RGB_Converter> (src, gold, cvt.yuvReader_, cvt.rgbWriter_);653else if(cvt.grayWriter_)654referenceYUV2GRAY<YUV2GRAY_Converter>(src, gold, cvt.yuvReader_, cvt.grayWriter_);655else if(cvt.yuvWriter_)656referenceRGB2YUV<RGB2YUV_Converter> (src, gold, cvt.rgbReader_, cvt.yuvWriter_);657658cv::cvtColor(src, dst, code, -1);659660EXPECT_EQ(0, countOfDifferencies(gold, dst));661}662}663664TEST_P(Imgproc_ColorYUV, roi_accuracy)665{666int code = GetParam();667RNG& random = theRNG();668669ConversionYUV cvt(code);670671const int scn = cvt.getScn();672const int dcn = cvt.getDcn();673for(int iter = 0; iter < 30; ++iter)674{675Size sz(random.uniform(1, 641), random.uniform(1, 481));676677if(cvt.requiresEvenWidth()) sz.width += sz.width % 2;678if(cvt.requiresEvenHeight()) sz.height += sz.height % 2;679680int roi_offset_top = random.uniform(0, 6);681int roi_offset_bottom = random.uniform(0, 6);682int roi_offset_left = random.uniform(0, 6);683int roi_offset_right = random.uniform(0, 6);684685Size srcSize = cvt.getSrcSize(sz);686Mat src_full(srcSize.height + roi_offset_top + roi_offset_bottom, srcSize.width + roi_offset_left + roi_offset_right, CV_8UC(scn));687688Size dstSize = cvt.getDstSize(sz);689Mat dst_full(dstSize.height + roi_offset_left + roi_offset_right, dstSize.width + roi_offset_top + roi_offset_bottom, CV_8UC(dcn), Scalar::all(0));690Mat gold_full(dst_full.size(), CV_8UC(dcn), Scalar::all(0));691692random.fill(src_full, RNG::UNIFORM, 0, 256);693694Mat src = src_full(Range(roi_offset_top, roi_offset_top + srcSize.height), Range(roi_offset_left, roi_offset_left + srcSize.width));695Mat dst = dst_full(Range(roi_offset_left, roi_offset_left + dstSize.height), Range(roi_offset_top, roi_offset_top + dstSize.width));696Mat gold = gold_full(Range(roi_offset_left, roi_offset_left + dstSize.height), Range(roi_offset_top, roi_offset_top + dstSize.width));697698if(cvt.rgbWriter_)699referenceYUV2RGB<YUV2RGB_Converter> (src, gold, cvt.yuvReader_, cvt.rgbWriter_);700else if(cvt.grayWriter_)701referenceYUV2GRAY<YUV2GRAY_Converter>(src, gold, cvt.yuvReader_, cvt.grayWriter_);702else if(cvt.yuvWriter_)703referenceRGB2YUV<RGB2YUV_Converter> (src, gold, cvt.rgbReader_, cvt.yuvWriter_);704705cv::cvtColor(src, dst, code, -1);706707EXPECT_EQ(0, countOfDifferencies(gold_full, dst_full));708}709}710711INSTANTIATE_TEST_CASE_P(cvt420, Imgproc_ColorYUV,712::testing::Values((int)CV_YUV2RGB_NV12, (int)CV_YUV2BGR_NV12, (int)CV_YUV2RGB_NV21, (int)CV_YUV2BGR_NV21,713(int)CV_YUV2RGBA_NV12, (int)CV_YUV2BGRA_NV12, (int)CV_YUV2RGBA_NV21, (int)CV_YUV2BGRA_NV21,714(int)CV_YUV2RGB_YV12, (int)CV_YUV2BGR_YV12, (int)CV_YUV2RGB_IYUV, (int)CV_YUV2BGR_IYUV,715(int)CV_YUV2RGBA_YV12, (int)CV_YUV2BGRA_YV12, (int)CV_YUV2RGBA_IYUV, (int)CV_YUV2BGRA_IYUV,716(int)CV_YUV2GRAY_420, (int)CV_RGB2YUV_YV12, (int)CV_BGR2YUV_YV12, (int)CV_RGBA2YUV_YV12,717(int)CV_BGRA2YUV_YV12, (int)CV_RGB2YUV_I420, (int)CV_BGR2YUV_I420, (int)CV_RGBA2YUV_I420,718(int)CV_BGRA2YUV_I420));719720INSTANTIATE_TEST_CASE_P(cvt422, Imgproc_ColorYUV,721::testing::Values((int)CV_YUV2RGB_UYVY, (int)CV_YUV2BGR_UYVY, (int)CV_YUV2RGBA_UYVY, (int)CV_YUV2BGRA_UYVY,722(int)CV_YUV2RGB_YUY2, (int)CV_YUV2BGR_YUY2, (int)CV_YUV2RGB_YVYU, (int)CV_YUV2BGR_YVYU,723(int)CV_YUV2RGBA_YUY2, (int)CV_YUV2BGRA_YUY2, (int)CV_YUV2RGBA_YVYU, (int)CV_YUV2BGRA_YVYU,724(int)CV_YUV2GRAY_UYVY, (int)CV_YUV2GRAY_YUY2));725726}} // namespace727728729