Fix intrinsics processing in case USAC parameters#21166
Merged
alalek merged 2 commits intoopencv:4.xfrom Dec 13, 2021
Merged
Conversation
alalek
reviewed
Dec 1, 2021
Member
alalek
left a comment
There was a problem hiding this comment.
Thank you!
Please add simple regression tests case based on code from the issue.
modules/calib3d/src/usac/utils.cpp
Outdated
| void Utils::calibratePoints (const Mat &K1, const Mat &K2, const Mat &points, Mat &calib_points) { | ||
| const auto * const points_ = (float *) points.data; | ||
| const auto * const k1 = (double *) K1.data; | ||
| const auto * const k1 = K1.isContinuous() ? (double *) K1.data : (double *) K1.clone().data; |
Member
There was a problem hiding this comment.
K1.clone().data
Don't use dangling pointers.
This expression creates temporary object which is disposed before the next line.
To declare assumptions of this code we should have several checks:
CV_Assert(K1.isContinuous());CV_CheckDepthEQ(K1.depth(), CV_32F, "");due to assumption(double *) K1.dataCV_CheckEQ(K1.total(), (size_t)9, "");- and similar for other types.
To avoid such "void" interface checks it is better to use const Matx33d& K1 parameters in internal API.
.clone() should be done by caller function of this function (or convert to Matx33d).
51595ec to
a334717
Compare
Merged
Merged
a-sajjad72
pushed a commit
to a-sajjad72/opencv
that referenced
this pull request
Mar 30, 2023
Fix intrinsics processing in case USAC parameters * fixed USAC intrinsics processing * change mat to matx33d, added test
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.
fixes #21105
relates #17683
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.