1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

fix to prevent QR code decoding from throwing on degenerate source points

This commit is contained in:
Muhammed Jaseem Pallikkal
2025-09-28 01:59:20 +05:30
committed by Muhammed Pallikkal
parent edfa999b93
commit 5d54e90fa4
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -2958,7 +2958,12 @@ std::string ImplContour::decode(InputArray in, InputArray points, OutputArray st
vector<Point2f> src_points;
points.copyTo(src_points);
CV_Assert(src_points.size() == 4);
CV_CheckGT(contourArea(src_points), 0.0, "Invalid QR code source points");
if (contourArea(src_points) <= 0.0)
{
if (straight_qrcode.needed())
straight_qrcode.release();
return std::string();
}
QRDecode qrdec(useAlignmentMarkers);
qrdec.init(inarr, src_points);