Closed MichaelGrupp closed 9 years ago
I thought I fixed that, but I see I didn't commit it yet. I fixed it a bit differently, I just added a check after cap >> image;
:
if (image.empty()) { // stop if we're at the end of the video
break;
}
I think a potential problem with your fix is that the fact that CV_CAP_PROP_FRAME_COUNT
returns -1 for a camera is not documented behaviour, so it may be the case on your system and even on mine, but it may not on any other (see OpenCV 3.0 docs, same on 2.4.11). What do you think? If you want you can take my changes and I'll merge them along with your OpenCV 3.0 fix.
Ok, I think that we should use your solution to avoid the crash for the reasons you pointed out.
Please have a look at my commit.
Great, thanks! :+1:
The example app
rcr-track.cpp
crashes when using a video as input image source because it does not stop the loop after the last frame.My bugfix takes account of the limited number of frames in a video while a continuous image source (camera) behaves just like before (quit by keystroke).
Furthermore,
helpers.hpp
uses thecircle
function of OpenCV which has moved fromcore
toimgproc
in version 3.0. I don't think the additional include affects a build with OpenCV 2.x, but maybe you can test that.