locateROI on roi of roi (Bugfix #3622)
Description
LocateROI returns offset and size related to the root image instead of parent image. This might be dangerous when you are asking offset for a roi of roi.
cv::Mat img(200,200,CV_8UC1); cv::Mat ROI(img,cv::Rect(20,20,50,50)); cv::Mat ROIofROI(ROI,cv::Rect(3,3,10,10));
ROIofROI.locateRoi(..)
returns offset of 23,23
while I'm expecting 3,3
.
Also the documentation doesn't clarify between root and parent
Associated revisions
Merge pull request #3622 from nagua:fix_find_gstreamer
History
Updated by Sergei Nosov almost 11 years ago
Hi! Thx for the report!
However, the function works as intended and I can't really see why you're referring to the behavior as "dangerous".
If you create a Mat like this
cv::Mat ROI(img,cv::Rect(20,20,50,50));
then by design ROI behaves exactly as if it was a Mat of its own. If it would behave differently, then ROI should be introduced as a new entity. It has its pros and cons, but I don't see anything more dangerous about it then in the approach proposed by you.
This behavior will not change in the foreseeable future, but you can help OpenCV by making a pull request on GitHub which documents the behavior more clearly.
- Status changed from New to Cancelled