iterating over cv::Mat_ results in infinite loop in OpenCV 3.0.0 (head) (Bug #4209)


Added by Jochen Goertler about 10 years ago. Updated about 10 years ago.


Status:Done Start date:2015-02-20
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:core
Target version:3.0
Affected version:branch 'master' (3.0-dev) Operating System:Linux
Difficulty: HW Platform:x86
Pull request:

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).


main.cpp (938 Bytes) Jochen Goertler, 2015-02-20 05:48 pm


Associated revisions

Revision c0b544af
Added by Alexander Alekhin over 9 years ago

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)

Also available in: Atom PDF