Same frame is different in every run

1 view (last 30 days)
aaa aaa
aaa aaa on 26 Jul 2015
Commented: Image Analyst on 10 Aug 2015
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 ?

Answers (3)

Image Analyst
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
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.

Sign in to comment.


aaa aaa
aaa aaa on 26 Jul 2015
I suspected the problem and i wrote this 6 lines to be sure.
My video file is 45.4MB, if its necessary i will upload it.
Try this code, with "traffic.avi", and play with n.
n = 100;
vObj = VideoReader( 'traffic.avi' );
I1 = read( vObj , n );
clear vObj
vObj = VideoReader( 'traffic.avi' );
I2 = read( vObj , n );
isequal( I1, I2 )
For me if n = 100, the answer is 0 ( not every time, make some tries ).
I use Matlab R2015a i dont know if this helps.
Thank you for your time, anyway
  5 Comments
aaa aaa
aaa aaa on 28 Jul 2015
Sorry for the delay,
I use windows 8.1 Pro N 64bit and Matlab 2015a 64bit.
I attach the zip file from psr.
I used 100 , 90 and 10 as values for n.
Image Analyst
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.

Sign in to comment.


aaa aaa
aaa aaa on 10 Aug 2015
Does anyone who test it had the same result with me ?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!