Commit 4c591ca3 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed Mat::Mat(const IplImage*, bool) constructor (ticket #487). fixed the bayer…

fixed Mat::Mat(const IplImage*, bool) constructor (ticket #487). fixed the bayer demosaicing part in the new cv::cvtColor implementation
parent c77e8fc6
...@@ -82,7 +82,7 @@ Mat::Mat(const IplImage* img, bool copyData) ...@@ -82,7 +82,7 @@ Mat::Mat(const IplImage* img, bool copyData)
if( copyData ) if( copyData )
{ {
Mat m = *this; Mat m = *this;
rows = cols = 0; release();
if( !img->roi || !img->roi->coi || if( !img->roi || !img->roi->coi ||
img->dataOrder == IPL_DATA_ORDER_PLANE) img->dataOrder == IPL_DATA_ORDER_PLANE)
m.copyTo(*this); m.copyTo(*this);
......
...@@ -2619,6 +2619,7 @@ void cvtColor( const Mat& src, Mat& dst, int code, int dcn ) ...@@ -2619,6 +2619,7 @@ void cvtColor( const Mat& src, Mat& dst, int code, int dcn )
case CV_BayerBG2BGR: case CV_BayerGB2BGR: case CV_BayerRG2BGR: case CV_BayerGR2BGR: 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_VNG: case CV_BayerGB2BGR_VNG: case CV_BayerRG2BGR_VNG: case CV_BayerGR2BGR_VNG:
if(dcn <= 0) dcn = 3;
CV_Assert( scn == 1 && dcn == 3 && depth == CV_8U ); CV_Assert( scn == 1 && dcn == 3 && depth == CV_8U );
dst.create(sz, CV_8UC3); dst.create(sz, CV_8UC3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment