-
Notifications
You must be signed in to change notification settings - Fork 5.9k
rlof optflow: fix crash when no match are found #2804
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
Conversation
Thank you for contribution! Please fix the whitespace issue (and amend commit in this PR: |
|
||
// Interpolators below expect non empty matches | ||
if (filtered_prevPoints.empty()) | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @tsenst Could you please take a look on this change? Should we "reset" some fields/parameters to return consistent result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ammended the commit with correct author, i think this should be fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can take a look during the next days
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrKepzie thank you for this bugfix 👍 . Here the optical flow could not be computed because of the algorithm behaviour. It would be great if it would be possible to indicate this. Unfortunately the DenseOpticalFlow class has no interface for the error case. Maybe throwing an exception would be the correct way. If not the flow should be at least set to 0 ( e.g. flow.setTo(0) ). In both cases please update the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CV_Error(Error::StsNoConv, ...)
may be used to indicate issue (throwing an exception).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to return a vector field with 0 everywhere is this is not really an error but just 2 images without any correspondences, I'm going to ammend commit and do as suggested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And please add a note in the docfile that when no correspondences could be found for interpolation the optical flow field would be 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just updated the commit
4d23cb7
to
f57990d
Compare
f57990d
to
55f5303
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done.
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.