mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 07:13:02 +04:00
Merge branch 4.x
This commit is contained in:
@@ -769,21 +769,27 @@ vector<Point2f> QRDetect::getQuadrilateral(vector<Point2f> angle_list)
|
||||
const double experimental_area = fabs(contourArea(hull));
|
||||
|
||||
vector<Point2f> result_hull_point(angle_size);
|
||||
vector<bool> used_hull_point(hull_size, false);
|
||||
double min_norm;
|
||||
for (size_t i = 0; i < angle_size; i++)
|
||||
{
|
||||
min_norm = std::numeric_limits<double>::max();
|
||||
Point closest_pnt;
|
||||
int closest_pnt_idx = -1;
|
||||
for (int j = 0; j < hull_size; j++)
|
||||
{
|
||||
if (used_hull_point[j])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
double temp_norm = norm(hull[j] - angle_list[i]);
|
||||
if (min_norm > temp_norm)
|
||||
{
|
||||
min_norm = temp_norm;
|
||||
closest_pnt = hull[j];
|
||||
closest_pnt_idx = j;
|
||||
}
|
||||
}
|
||||
result_hull_point[i] = closest_pnt;
|
||||
result_hull_point[i] = hull[closest_pnt_idx];
|
||||
used_hull_point[closest_pnt_idx] = true;
|
||||
}
|
||||
|
||||
int start_line[2] = { 0, 0 }, finish_line[2] = { 0, 0 }, unstable_pnt = 0;
|
||||
@@ -2921,12 +2927,7 @@ std::string ImplContour::decode(InputArray in, InputArray points, OutputArray st
|
||||
vector<Point2f> src_points;
|
||||
points.copyTo(src_points);
|
||||
CV_Assert(src_points.size() == 4);
|
||||
if (contourArea(src_points) <= 0.0)
|
||||
{
|
||||
if (straight_qrcode.needed())
|
||||
straight_qrcode.release();
|
||||
return std::string();
|
||||
}
|
||||
CV_CheckGT(contourArea(src_points), 0.0, "Invalid QR code source points");
|
||||
|
||||
QRDecode qrdec(useAlignmentMarkers);
|
||||
qrdec.init(inarr, src_points);
|
||||
|
||||
Reference in New Issue
Block a user