Skip to content

Empty vectors before filling them in ChessBoardDetector::processQuads#24702

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
vrabaud:compilation
Dec 18, 2023
Merged

Empty vectors before filling them in ChessBoardDetector::processQuads#24702
asmorkalov merged 1 commit intoopencv:4.xfrom
vrabaud:compilation

Conversation

@vrabaud
Copy link
Copy Markdown
Contributor

@vrabaud vrabaud commented Dec 15, 2023

It seems the port in #11703 lost the initialization.

The only breaking tests I have are unfortunately internal and complex.

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

@vrabaud
Copy link
Copy Markdown
Contributor Author

vrabaud commented Dec 15, 2023

@MaximSmolskiy , you seem to have fixed a lot lately in that code, does that make sense?

if (count > 0 || (-count > (int)out_corners.size()))
{
// copy corners to output array
out_corners.clear();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is out_corners.resize(0); at the function beginning (line 1886). M.b. it should be replaced with clear() call and the condition may be reduced.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, there is one line 1886 but what if you enter this block (1938 to 1951), fill out_corners and actually fail the condition like 1946?
You then can push_back again in the next loop iteration (from loop at 1899) while out_corners has not been cleared.

@asmorkalov asmorkalov added this to the 4.9.0 milestone Dec 18, 2023
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@asmorkalov asmorkalov self-assigned this Dec 18, 2023
@asmorkalov asmorkalov merged commit 70618cb into opencv:4.x Dec 18, 2023
@asmorkalov asmorkalov mentioned this pull request Jan 19, 2024
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