Commit 1a6c2b37 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #13499 from alalek:issue_13498

parents 09d8bbb1 2f3e06ac
...@@ -782,6 +782,9 @@ bool QRCodeDetector::detect(InputArray in, OutputArray points) const ...@@ -782,6 +782,9 @@ bool QRCodeDetector::detect(InputArray in, OutputArray points) const
Mat inarr = in.getMat(); Mat inarr = in.getMat();
CV_Assert(!inarr.empty()); CV_Assert(!inarr.empty());
CV_Assert(inarr.depth() == CV_8U); CV_Assert(inarr.depth() == CV_8U);
if (inarr.cols <= 20 || inarr.rows <= 20)
return false; // image data is not enough for providing reliable results
int incn = inarr.channels(); int incn = inarr.channels();
if( incn == 3 || incn == 4 ) if( incn == 3 || incn == 4 )
{ {
...@@ -1070,6 +1073,8 @@ cv::String QRCodeDetector::decode(InputArray in, InputArray points, ...@@ -1070,6 +1073,8 @@ cv::String QRCodeDetector::decode(InputArray in, InputArray points,
Mat inarr = in.getMat(); Mat inarr = in.getMat();
CV_Assert(!inarr.empty()); CV_Assert(!inarr.empty());
CV_Assert(inarr.depth() == CV_8U); CV_Assert(inarr.depth() == CV_8U);
if (inarr.cols <= 20 || inarr.rows <= 20)
return cv::String(); // image data is not enough for providing reliable results
int incn = inarr.channels(); int incn = inarr.channels();
if( incn == 3 || incn == 4 ) if( incn == 3 || incn == 4 )
...@@ -1108,6 +1113,8 @@ cv::String QRCodeDetector::detectAndDecode(InputArray in, ...@@ -1108,6 +1113,8 @@ cv::String QRCodeDetector::detectAndDecode(InputArray in,
Mat inarr = in.getMat(); Mat inarr = in.getMat();
CV_Assert(!inarr.empty()); CV_Assert(!inarr.empty());
CV_Assert(inarr.depth() == CV_8U); CV_Assert(inarr.depth() == CV_8U);
if (inarr.cols <= 20 || inarr.rows <= 20)
return cv::String(); // image data is not enough for providing reliable results
int incn = inarr.channels(); int incn = inarr.channels();
if( incn == 3 || incn == 4 ) if( incn == 3 || incn == 4 )
......
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