locateROI on roi of roi (Bugfix #3622)


Added by PkLab net almost 11 years ago. Updated almost 11 years ago.


Status:Cancelled Start date:2014-03-25
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:-
Affected version:2.4.0 - 2.4.7 Operating System:Windows
Difficulty: HW Platform:x86
Pull request:

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

Revision adbe8442
Added by Vadim Pisarevsky about 10 years ago

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

Also available in: Atom PDF