Repository navigation
calib3d: Fix calibrateCamera() misleading error. - #13803
Merged
opencv-pushbot merged 1 commit intoFeb 12, 2019
Merged
opencv-pushbot merged 1 commit into
opencv-pushbot merged 1 commit into
Conversation
thangktran
force-pushed
the
thangktran/fix-misleading-runtime-assertion-calibrateCamera
branch
from
February 12, 2019 06:17
9dfb41a to
59e88e1
Compare
alalek
reviewed
Feb 12, 2019
| ni = objectPoint.checkVector(3, CV_32F); | ||
| if ( objectPoint.empty() ) | ||
| CV_Error(CV_StsBadSize, "objectPoints should not contain empty vector of vectors of points"); | ||
| else if( ni <= 0 ) |
Member
There was a problem hiding this comment.
BTW,
CV_Error() doesn't return (throws exception), so "else if" is not necessary here.
Something like this:
Mat objectPoint = objectPoints.getMat(i);
if (objectPoint.empty())
CV_Error(...)
ni = objectPoint.checkVector(3, CV_32F);
if (ni <= 0)
CV_Error(...)
Contributor
Author
There was a problem hiding this comment.
@alalek I think the else if makes more sense.
E.g. if the objectPoint is indeed empty, 2 errors will be printed:
OpenCV Error: The input/output structure size is incorrect (objectPoints should not contain empty vector of vectors of points) in collectCalibrationDataOpenCV Error: Unsupported format or combination of formats (objectPoints should contain vector of vectors of points of type Point3f) in collectCalibrationData
In this case i think it's better that only error no. 1 be printed.
What is your opinion about this?
Member
There was a problem hiding this comment.
makes more sense
I understand your point from the code.
But it is correct in case if CV_Error() prints message, but CV_Error()
throws exception
So, there is no way to see both messages and else if is not required here.
objectPoints and imagePoints are not checked whether they're empty and cause checkVector() to fail, thus result in a wrong error message. Fixes: opencv#6002
opencv-pushbot
pushed a commit
that referenced
this pull request
Feb 12, 2019
…untime-assertion-calibrateCamera
Merged
Contributor
Author
@alalek Thank you. |
thangktran
deleted the
thangktran/fix-misleading-runtime-assertion-calibrateCamera
branch
February 12, 2019 15:43
SavyaSanchi-Sharma
pushed a commit
to SavyaSanchi-Sharma/opencv
that referenced
this pull request
Jul 30, 2026
…ding-runtime-assertion-calibrateCamera
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
objectPoints and imagePoints are not checked whether they're empty and
cause checkVector() to fail, thus result in a wrong error message.
Fixes: #6002
This pullrequest changes
make testsuccessfully