Skip to content

Properly fix inf/inf issue in MCC #3939

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

Merged
merged 1 commit into from
May 21, 2025
Merged

Properly fix inf/inf issue in MCC #3939

merged 1 commit into from
May 21, 2025

Conversation

vrabaud
Copy link
Contributor

@vrabaud vrabaud commented May 20, 2025

Properly fix #3316

Without this fix, we could end up with 4 corners, which might seem valid, while some of those are (0,0).

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

Properly fix opencv#3316

Without this fix, we could end up with 4 corners, which might seem
valid, while some of those are (0,0).
@vrabaud vrabaud requested a review from gursimarsingh May 20, 2025 21:08
@vrabaud vrabaud added bug category: mcc color calibration module labels May 20, 2025
@asmorkalov
Copy link
Contributor

@gursimarsingh please test and review.

@abhishek-gola
Copy link

Hi @vrabaud,
The change looks good to me. Using return instead of continue seems preferable here. Although continue still produces the correct output—since the specific checker box is ultimately rejected during the CCM evaluation due to a high error:-

   if (!cccm.evaluate(scm, offset, iTheta, error))
            continue;

using return will help avoiding unnecessary computations by exiting early.

@vrabaud
Copy link
Contributor Author

vrabaud commented May 21, 2025

It actually crashes for me: having two points that are the same find a matrix in

Matx33f ccT = cv::getPerspectiveTransform(points, chartPhy);
that is not invertible, creating Inf values again in

Copy link
Contributor

@gursimarsingh gursimarsingh left a comment

Choose a reason for hiding this comment

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

return help avoid overhead computation for unnecessary boxes

@asmorkalov asmorkalov merged commit 0a5ac86 into opencv:4.x May 21, 2025
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug category: mcc color calibration module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SIGILL in mcc
4 participants