Skip to content

objdetect: qrcode_encoder: fix to missing timing pattern#22030

Merged
alalek merged 2 commits intoopencv:3.4from
Kumataro:3.4-fix22029
May 31, 2022
Merged

objdetect: qrcode_encoder: fix to missing timing pattern#22030
alalek merged 2 commits intoopencv:3.4from
Kumataro:3.4-fix22029

Conversation

@Kumataro
Copy link
Copy Markdown
Contributor

Pull Request Readiness Checklist

fix #22029

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

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix and especially for the test!

// (1) White margin(Left)
for(i = 0; i < white_margin ; i++ )
{
CV_Assert( qrimg.at<uint8_t>(i, timing_pos) == 255 ) ;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CV_Assert

Please use GoogleTest checks instead:

  • ASSERT_EQ(expected_value, actual_value) << "i=" << i;

Please note about the order of parameters:
ASSERT_EQ((uint8_t)255, qrimg.at<uint8_t>(i, timing_pos)) << "i=" << i;

BTW, ASSERT_ could be replaced by EXPECT_ if there number of error messages is limited and small (we should not trash logs in case of failure).

Comment on lines +439 to +441
for ( int v = min_version ; v <= max_version ; v++ )
{
Mat qrimg;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add GoogleTest's scope identifier in "for" loop body (used for error messages):

SCOPED_TRACE(cv::format("version=%d", v));

… to ASSERT_EQ().

- Add SCOPED_TRACE() for version loop.

- Replace CV_Assert() to ASSERT_EQ().

- Rename expect_msg to msg.
@Kumataro
Copy link
Copy Markdown
Contributor Author

Thank you for your reviewing and comment.

I re-pushed commits to fix it.

@asmorkalov asmorkalov requested a review from AleksandrPanov May 25, 2022 05:29
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@alalek alalek merged commit 1a24e31 into opencv:3.4 May 31, 2022
@alalek alalek mentioned this pull request Jun 4, 2022
@alalek alalek mentioned this pull request Aug 21, 2022
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.

2 participants