mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 06:53:50 +08:00
bug fix
This commit is contained in:
parent
a105f56957
commit
c99db2b9db
@ -359,22 +359,26 @@ bool QRDetect::localization()
|
|||||||
|
|
||||||
bool suare_flag = false, local_points_flag = false;
|
bool suare_flag = false, local_points_flag = false;
|
||||||
double triangle_sides[3];
|
double triangle_sides[3];
|
||||||
|
double triangle_perim, square_area, img_square_area;
|
||||||
|
if (localization_points.size() == 3)
|
||||||
|
{
|
||||||
triangle_sides[0] = norm(localization_points[0] - localization_points[1]);
|
triangle_sides[0] = norm(localization_points[0] - localization_points[1]);
|
||||||
triangle_sides[1] = norm(localization_points[1] - localization_points[2]);
|
triangle_sides[1] = norm(localization_points[1] - localization_points[2]);
|
||||||
triangle_sides[2] = norm(localization_points[2] - localization_points[0]);
|
triangle_sides[2] = norm(localization_points[2] - localization_points[0]);
|
||||||
|
|
||||||
double triangle_perim = (triangle_sides[0] + triangle_sides[1] + triangle_sides[2]) / 2;
|
triangle_perim = (triangle_sides[0] + triangle_sides[1] + triangle_sides[2]) / 2;
|
||||||
|
|
||||||
double square_area = sqrt((triangle_perim * (triangle_perim - triangle_sides[0])
|
square_area = sqrt((triangle_perim * (triangle_perim - triangle_sides[0])
|
||||||
* (triangle_perim - triangle_sides[1])
|
* (triangle_perim - triangle_sides[1])
|
||||||
* (triangle_perim - triangle_sides[2]))) * 2;
|
* (triangle_perim - triangle_sides[2]))) * 2;
|
||||||
double img_square_area = bin_barcode.cols * bin_barcode.rows;
|
img_square_area = bin_barcode.cols * bin_barcode.rows;
|
||||||
|
|
||||||
if (square_area > (img_square_area * 0.2))
|
if (square_area > (img_square_area * 0.2))
|
||||||
{
|
{
|
||||||
suare_flag = true;
|
suare_flag = true;
|
||||||
}
|
}
|
||||||
if (localization_points.size() != 3)
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
local_points_flag = true;
|
local_points_flag = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user