mirror of
https://github.com/opencv/opencv.git
synced 2025-06-17 15:20:51 +08:00
Merge pull request #12184 from alalek:issue_12163
This commit is contained in:
commit
f16f818f5f
@ -178,6 +178,8 @@ void cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
|
|||||||
{
|
{
|
||||||
CV_INSTRUMENT_REGION()
|
CV_INSTRUMENT_REGION()
|
||||||
|
|
||||||
|
CV_Assert(!_src.empty());
|
||||||
|
|
||||||
if(dcn <= 0)
|
if(dcn <= 0)
|
||||||
dcn = dstChannels(code);
|
dcn = dstChannels(code);
|
||||||
|
|
||||||
|
@ -247,10 +247,14 @@ struct CvtHelper
|
|||||||
{
|
{
|
||||||
CvtHelper(InputArray _src, OutputArray _dst, int dcn)
|
CvtHelper(InputArray _src, OutputArray _dst, int dcn)
|
||||||
{
|
{
|
||||||
|
CV_Assert(!_src.empty());
|
||||||
|
|
||||||
int stype = _src.type();
|
int stype = _src.type();
|
||||||
scn = CV_MAT_CN(stype), depth = CV_MAT_DEPTH(stype);
|
scn = CV_MAT_CN(stype), depth = CV_MAT_DEPTH(stype);
|
||||||
|
|
||||||
CV_Assert( VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) );
|
CV_Check(scn, VScn::contains(scn), "Invalid number of channels in input image");
|
||||||
|
CV_Check(dcn, VDcn::contains(dcn), "Invalid number of channels in output image");
|
||||||
|
CV_CheckDepth(depth, VDepth::contains(depth), "Unsupported depth of input image");
|
||||||
|
|
||||||
if (_src.getObj() == _dst.getObj()) // inplace processing (#6653)
|
if (_src.getObj() == _dst.getObj()) // inplace processing (#6653)
|
||||||
_src.copyTo(src);
|
_src.copyTo(src);
|
||||||
|
Loading…
Reference in New Issue
Block a user