storing the individual frames of a video i(existing on workspace) n to image locations and analyse each frame's image on imtool (perhaps using imwrite?).

1 Ansicht (letzte 30 Tage)
I have a video on the workspace, which I can open using movieplayer.
Now all I want to do is get each frame of the video and analyze it on imtool.
I tried:
number= size(fractogene)_ (fractogene is the name of my video)_
for frame = 1: number
thisFrame = mov(frame).cdata;
Image = subplot(1,2,1);
image(thisFrame);
axis square;
caption = sprintf('Frame %4d of %d.', frame, numberOfFrames);
title(caption, 'FontSize', fontSize);
drawnow;
end
It did open the imtool, but it was just a blue square....what went wrong?
but its too hard for me...PLEASE GIVE ME SOMETHING SIMPLE!

Antworten (2)

Image Analyst
Image Analyst am 16 Okt. 2011
Your first frame is all zeros. Take a look at it with the Variable Editor. Or try typing out a few pixels in the command window like
>> thisFrame(20,30,1)
  2 Kommentare
Yagnaseni Roy
Yagnaseni Roy am 16 Okt. 2011
Hi,
i put thisframe(20,30,1)
and many other values, but I'm getting all 0s.....
isn't there a simple code like
for frame = 1: number
imwrite(frame,'images of fractogene',jpg)
% which would store my frames as images in a file called 'images of fractogene' as jpg files.
imshow(frame)
end
WOULDNT'T THIS WORK?
Image Analyst
Image Analyst am 16 Okt. 2011
No that would not work. You're writing out the loop index "frame", which is just a single number, as an image. And your "thisframe" is all zeros for some reason - I have no idea why - maybe your movie is all black.

Melden Sie sich an, um zu kommentieren.


Yagnaseni Roy
Yagnaseni Roy am 16 Okt. 2011
I did
for frame = 1:number
fractogene(frame)= getframe;
end
fractogene(117)
ans =
cdata: [240x320 uint16]
colormap: [0x3 double]
As you can see, I got a value...is this anything substantial?How can I plot it, as I didn't get a plot...*BOLD TEXT*

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by