Extraction of images from video: why images are missed?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Emerson De Souza
il 13 Mar 2013
Commentato: Akhilkumar1307
il 20 Mar 2017
INTRODUCTION:
I have a avi-video recorded at 2 frames per second and I used the following commands to extract the images of the video:
obj = VideoReader('C:\Desktop\test.avi');
vid = read(obj,[1 5000]);
for k = 1:1:5000
newname = strcat('C:\Desktop\TEST\',num2str(k),'.png');
imwrite(vid(:,:,:,k), newname);
end;
PROBLEM:
I controlled the extracted images and realized that one image is missed at every sixth image or 20 images per minutes. Instead of counting 120 images per minute I counted only 100.
I wonder if someone knows what is going wrong with the commands and what I can do to solve this problem.
Thank you in advance Emerson
0 Commenti
Risposta accettata
Image Analyst
il 13 Mar 2013
Add k to your loop to display it:
for k = 1:5000
k % No semicolon.
newname = strcat('C:\Desktop\TEST\',num2str(k),'.png');
imwrite(vid(:,:,:,k), newname);
end
Now, do you see any missing k in the list printed to the command line?
10 Commenti
AJ
il 13 Giu 2013
Hi Image Analyst, I have a problem , when I am using your code to extract individual frames from a video, I am only able to extract 80 frames from the total number of frames. Kindly help me.
Più risposte (2)
Shaun VanWeelden
il 13 Mar 2013
Also, I would do obj.FrameRate to see if it really is 2, this seems much more likely than a number not showing up in a vector.
Akhilkumar1307
il 8 Mar 2017
Hi
I am facing similar problem too
My video frame rate is 30 fps, so it should show me a frame every 33(1000/30) millisecond but its not Its showing around a frame every 400 millisecond
please help
1 Commento
Akhilkumar1307
il 20 Mar 2017
Problem is solved
Previously am using .avi files, and know its fine with .mp4 files
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!