-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Behavior Change] return four vertices of qrcode instead of axis aligned bounding box #3238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| if (use_nn_detector_) { | ||
| Align aligner; | ||
| cropped_img = cropObj(img, point, aligner); | ||
| aligner = new Align(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid using operator new(). You should use cv::Ptr or std::shared_ptr:
auto aligner = makePtr<Align>();
| } | ||
| if (use_nn_detector_) { | ||
| points_qr = aligner->warpBack(points_qr); | ||
| delete aligner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid using operator delete(). You should use cv::Ptr or std::shared_ptr
|
@109021017, thx for PR) I think, that need to use the new API in at least one test. |
|
Also you need create a new branch (with a meaningful name) from the base branch you chose. Check https://github.com/opencv/opencv/wiki/How_to_contribute |
| if (!ret) { | ||
| result = zx_result->getText()->getText(); | ||
| auto result_points = zx_result->getResultPoints(); | ||
| for(int i=0; i < result_points->size(); i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corners should be order as Top Left -> Top Right -> Bottom Right -> Bottom Left
result_points are returned in Bottom Left -> Top Left -> Top Right -> Bottom Right
| vector<string> decode_results; | ||
| for (auto& point : candidate_points) { | ||
| Mat cropped_img; | ||
| Align *aligner = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simple Align aligner without any extra heap allocations
| auto ret = decodemgr.decodeImage(scaled_img, use_nn_detector_, result, points_qr); | ||
| if (ret == 0) { | ||
| for (int i = 0; i < 4; i++) { | ||
| points_qr[i].x = points_qr[i].x / cur_scale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (auto&& pt: points_qr) {
pt /= cur_scale;
}| delete aligner; | ||
| } | ||
|
|
||
| for(int i = 0; i < 4; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < 4; ++i) {
point.at<Point2f>(i) = points_qr[static_cast<size_t>(i)];
}|
added fixes and test to new PR fix output qr corners #3289 |
API Behavior Change: return four vertices of qrcode instead of axis aligned bounding box.
The change can be tested by the original test files.
Related issue: #3037
Returning coordinate information of the qrcode detected.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.