iterating over cv::Mat_ results in infinite loop in OpenCV 3.0.0 (head) (Bug #4209)
Description
Iterating over cv::Mat_ results in an infinite loop in some cases. In the attached file you can find a minimal example to reproduce this problem. It is strange how the different ways of iterating over a cv::Mat_ work or not.
I can reproduce this error with OpenCV 3.0.0. (GCC 4.8).
Associated revisions
Merge pull request #4209 from vladimir-dudnik:fix-opencl-opencv-interop-sample
History
Updated by be rak about 10 years ago
this probably should have gone through opencv's QA site first.
see, the problem is here:
struct Segmentation2 { Image image() { return _img; } Image _img; };
the image() function will return a copy of the Mat header, so s2.image().begin() and s2.image().end() do not refer to the same object.
try again with:
struct Segmentation2 { const Image & image() { return _img; } // Works ! Image _img; };
Updated by Steven Puttemans about 10 years ago
- Status changed from New to Done
- Assignee deleted (
Vadim Pisarevsky)