findContours alters the incoming image. (Bug #93)


Added by Jørn Christensen about 15 years ago. Updated almost 15 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:imgproc, video
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

The findContours function is defined as

void findContours( const Mat& image, vector<vector<Point> >& contours,
                   vector<Vec4i>& hierarchy, int mode,
                   int method, Point offset=Point());

with the const keyword on the image argument - but it still manages to change the image data. I'm not sure how it manages to do so, but I expect some (nasty) casts are involved. If the algorithm cannot work (efficient) without changing the data, the const keyword should be removed and the documentation updated as well.


History

Updated by anonymous - almost 15 years ago

thanks! "const" qualifier was removed in r2926

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Updated by Sebastian Krämer almost 15 years ago

So this means that the image is actually altered?? There should be a note about this in the docs so people can decide if they want to take an image copy for the contour finding algorithm. I would have preferred keeping the const (and findContours honoring it).

I'll reopen the bug so that the comment isn't lost.

  • Status changed from Done to Cancelled
  • (deleted custom field) deleted (fixed)

Updated by James Bowman almost 15 years ago

Yes, this is a documentation bug.
Extra note added to FindContours in r2949.

  • Status changed from Cancelled to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF