Skip to content

Conversation

@109021017
Copy link

@109021017 109021017 commented Apr 24, 2022

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

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=linux,docs

if (use_nn_detector_) {
Align aligner;
cropped_img = cropObj(img, point, aligner);
aligner = new Align();
Copy link
Contributor

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;
Copy link
Contributor

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

@AleksandrPanov
Copy link
Contributor

AleksandrPanov commented Jun 14, 2022

@109021017, thx for PR) I think, that need to use the new API in at least one test.

@AleksandrPanov
Copy link
Contributor

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++){
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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++) {
Copy link
Contributor

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)];
}

@AleksandrPanov
Copy link
Contributor

AleksandrPanov commented Aug 4, 2022

added fixes and test to new PR fix output qr corners #3289

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants