kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
661 stars 319 forks source link

something confused #438

Closed MOONBEAR0703 closed 5 years ago

amroamroamro commented 5 years ago

did you forget to write a description of the issue?

MOONBEAR0703 commented 5 years ago

Hi, @amroamroamro ! I found that my mexopencv in the matlab, it would be stuck in someplace and didn't show error except 'busy running'.

amroamroamro commented 5 years ago

Please provide a useful report with reproducible steps and relevant code.

MOONBEAR0703 commented 5 years ago

NO, it didn't traceback to any useful information. And when I make, it indicates gcc version is high, it required 4.9.x but mine is 5.5.0, however, it shows mex completely.

MOONBEAR0703 commented 5 years ago

I stepped into this line
https://github.com/ergysr/DeepCC/blob/ab89f0a82a6b603d87c508b2c3ddc217d7075d6e/src/L3-identities/getTrajectoryFeatures.m#L31 and it jumped to this function DukeVideoReader.m https://github.com/ergysr/DeepCC/blob/ab89f0a82a6b603d87c508b2c3ddc217d7075d6e/src/duke/DukeVideoReader.m#L68 where back_frame was increasing continuously thus it seemed never end.

amroamroamro commented 5 years ago

That sounds like an issue to ask over at DeepCC not here in mexopencv.

I'm not familiar with their code base, but it looks like they are seeking in a video by reading frame-by-frame. According to their readme file, you first have to download the video dataset.

Note that cv.VideoCapture does not raise an error if you specify a non-existing video file. Consider the following:

vid = cv.VideoCapture('non-existant-file.mts');
while vid.PosFrames < 10
    frame = vid.read();
end

The above code will never return if the video file doesn't exist, frame will be 0x0 empty and PosFrames remains at 0.

You (they) should add checks to guard against unexpected outcomes:

vid = cv.VideoCapture('non-existant-file.mts');
assert(vid.isOpened());    % <===
while vid.PosFrames < 10
    frame = vid.read();
    if isempty(frame), break; end    % <===
end