Merge pull request #8178 from tomoaki0705:addBayer2RGBA

This commit is contained in:
Vadim Pisarevsky 2017-02-16 15:01:49 +00:00
commit 9053839282
5 changed files with 34 additions and 8 deletions

View File

@ -769,8 +769,18 @@ enum ColorConversionCodes {
COLOR_BayerRG2RGB_EA = COLOR_BayerBG2BGR_EA,
COLOR_BayerGR2RGB_EA = COLOR_BayerGB2BGR_EA,
//! Demosaicing with alpha channel
COLOR_BayerBG2BGRA = 139,
COLOR_BayerGB2BGRA = 140,
COLOR_BayerRG2BGRA = 141,
COLOR_BayerGR2BGRA = 142,
COLOR_COLORCVT_MAX = 139
COLOR_BayerBG2RGBA = COLOR_BayerRG2BGRA,
COLOR_BayerGB2RGBA = COLOR_BayerGR2BGRA,
COLOR_BayerRG2RGBA = COLOR_BayerBG2BGRA,
COLOR_BayerGR2RGBA = COLOR_BayerGB2BGRA,
COLOR_COLORCVT_MAX = 143
};
/** types of intersection between rectangles

View File

@ -349,7 +349,17 @@ enum
CV_BayerRG2RGB_EA = CV_BayerBG2BGR_EA,
CV_BayerGR2RGB_EA = CV_BayerGB2BGR_EA,
CV_COLORCVT_MAX = 139
CV_BayerBG2BGRA =139,
CV_BayerGB2BGRA =140,
CV_BayerRG2BGRA =141,
CV_BayerGR2BGRA =142,
CV_BayerBG2RGBA =CV_BayerRG2BGRA,
CV_BayerGB2RGBA =CV_BayerGR2BGRA,
CV_BayerRG2RGBA =CV_BayerBG2BGRA,
CV_BayerGR2RGBA =CV_BayerGB2BGRA,
CV_COLORCVT_MAX = 143
};

View File

@ -103,10 +103,10 @@ CV_ENUM(CvtMode,
CV_ENUM(CvtModeBayer,
COLOR_BayerBG2BGR, COLOR_BayerBG2BGR_VNG, COLOR_BayerBG2GRAY,
COLOR_BayerGB2BGR, COLOR_BayerGB2BGR_VNG, COLOR_BayerGB2GRAY,
COLOR_BayerGR2BGR, COLOR_BayerGR2BGR_VNG, COLOR_BayerGR2GRAY,
COLOR_BayerRG2BGR, COLOR_BayerRG2BGR_VNG, COLOR_BayerRG2GRAY
COLOR_BayerBG2BGR, COLOR_BayerBG2BGRA, COLOR_BayerBG2BGR_VNG, COLOR_BayerBG2GRAY,
COLOR_BayerGB2BGR, COLOR_BayerGB2BGRA, COLOR_BayerGB2BGR_VNG, COLOR_BayerGB2GRAY,
COLOR_BayerGR2BGR, COLOR_BayerGR2BGRA, COLOR_BayerGR2BGR_VNG, COLOR_BayerGR2GRAY,
COLOR_BayerRG2BGR, COLOR_BayerRG2BGRA, COLOR_BayerRG2BGR_VNG, COLOR_BayerRG2GRAY
)
@ -149,6 +149,8 @@ ChPair getConversionInfo(int cvtMode)
case COLOR_YUV2BGRA_NV21: case COLOR_YUV2RGBA_NV21:
case COLOR_YUV2BGRA_YV12: case COLOR_YUV2RGBA_YV12:
case COLOR_YUV2BGRA_IYUV: case COLOR_YUV2RGBA_IYUV:
case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA:
case COLOR_BayerGR2BGRA: case COLOR_BayerRG2BGRA:
return ChPair(1,4);
case COLOR_BGR5552GRAY: case COLOR_BGR5652GRAY:
return ChPair(2,1);

View File

@ -9852,6 +9852,7 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
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 CV_BayerBG2BGR_EA: case CV_BayerGB2BGR_EA: case CV_BayerRG2BGR_EA: case CV_BayerGR2BGR_EA:
case CV_BayerBG2BGRA: case CV_BayerGB2BGRA: case CV_BayerRG2BGRA: case CV_BayerGR2BGRA:
demosaicing(src, _dst, code, dcn);
break;

View File

@ -1643,6 +1643,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
break;
case CV_BayerBG2BGR: case CV_BayerGB2BGR: case CV_BayerRG2BGR: case CV_BayerGR2BGR:
case CV_BayerBG2BGRA: case CV_BayerGB2BGRA: case CV_BayerRG2BGRA: case CV_BayerGR2BGRA:
case CV_BayerBG2BGR_VNG: case CV_BayerGB2BGR_VNG: case CV_BayerRG2BGR_VNG: case CV_BayerGR2BGR_VNG:
{
if (dcn <= 0)
@ -1652,8 +1653,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_BayerGB2BGR ||
code == CV_BayerRG2BGR || code == CV_BayerGR2BGR )
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( depth == CV_8U )
Bayer2RGB_<uchar, SIMDBayerInterpolator_8u>(src, dst_, code);