Same frame is different in every run
1 view (last 30 days)
Show older comments
Hi to all,
I run this code,
vObj = VideoReader( 'test.avi' );
I1 = read( vObj , 1000 );
clear vObj
vObj = VideoReader( 'test.avi' );
I2 = read( vObj , 1000 );
isequal( I1, I2 )
And the answer is 0.
Why I1 and I2 are not equal ?
Is this normal ?
0 Comments
Answers (3)
Image Analyst
on 26 Jul 2015
With the standard "traffic" demo image, it works as expected:
vObj = VideoReader( 'traffic.avi' );
I1 = read( vObj , 10 );
clear vObj
vObj = VideoReader( 'traffic.avi' );
I2 = read( vObj , 10 );
isequal( I1, I2 )
You'll need to post your test.avi file for us to check it. But I strongly suspect that there is a bunch of code that you are not showing us that is causing the problem. Or is your whole script just those 6 lines?
1 Comment
Image Analyst
on 26 Jul 2015
Regarding your "Answer" below, I tried your code to read frame #100 and I tried it over and over again and I always got "ans = 1". If you're not getting that, then call tech support, because you have a very unusual situation that no one else has.
aaa aaa
on 26 Jul 2015
5 Comments
Image Analyst
on 10 Aug 2015
It does seem strange. I can't reproduce it. First, when it says they're not equal, find out what row and column it thinks are not equal:
[rows, columns] = find(I1~=I2)
for k = 1 : length(rows)
row = rows(k);
col = columns(k);
fprintf('I1(%d, %d) = %d, while I2(%d, %d) = %d\n',...
row, col, I1(row, col), row, col, I2(row, col));
end
Show us what it says.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!