mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
objdetect(QR): avoid bug with empty input
This commit is contained in:
parent
0fb4f2cc9c
commit
d7e839b8c5
@ -122,9 +122,16 @@ void QRDetect::init(const Mat& src, double eps_vertical_, double eps_horizontal_
|
|||||||
|
|
||||||
eps_vertical = eps_vertical_;
|
eps_vertical = eps_vertical_;
|
||||||
eps_horizontal = eps_horizontal_;
|
eps_horizontal = eps_horizontal_;
|
||||||
adaptiveThreshold(barcode, bin_barcode, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY, 83, 2);
|
|
||||||
adaptiveThreshold(resized_barcode, resized_bin_barcode, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY, 83, 2);
|
|
||||||
|
|
||||||
|
if (!barcode.empty())
|
||||||
|
adaptiveThreshold(barcode, bin_barcode, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY, 83, 2);
|
||||||
|
else
|
||||||
|
bin_barcode.release();
|
||||||
|
|
||||||
|
if (!resized_barcode.empty())
|
||||||
|
adaptiveThreshold(resized_barcode, resized_bin_barcode, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY, 83, 2);
|
||||||
|
else
|
||||||
|
resized_bin_barcode.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Vec3d> QRDetect::searchHorizontalLines()
|
vector<Vec3d> QRDetect::searchHorizontalLines()
|
||||||
|
Loading…
Reference in New Issue
Block a user