How to Extract photos at Each frame from a Video in MATLAB?
    13 views (last 30 days)
  
       Show older comments
    
    Nooruddin Shaik
 on 2 Aug 2024
  
    
    
    
    
    Commented: Nooruddin Shaik
 on 2 Aug 2024
            I am working on a project where I need to create a dataset by extracting photos from a video. Specifically, I need to capture a photo at each frame of the video, after extracting I need to store all these in a folder Does MATLAB have any toolboxes which helps me doing that??I would appreciate any guidance on how to achieve this.
Accepted Answer
  Pavan Sahith
      
 on 2 Aug 2024
        
      Edited: Pavan Sahith
      
 on 2 Aug 2024
  
      Hello, 
It appears you are working on a project to create a dataset by capturing and storing each frame of a video. 
To achieve this in MATLAB, you can use the VideoReader class to read the video and the readFrame method to extract individual frames. The imwrite function can then be used to save each frame as an image file. 
MATLAB's Computer Vision Toolbox can be particularly helpful for this task. If you are new to this toolbox, I recommend taking the Computer Vision Onramp course provided by MathWorks. This course will help you quickly get up to speed. 
 You can also refer to these similar MATLAB Answer posts 
- https://www.mathworks.com/matlabcentral/answers/333532
- https://www.mathworks.com/matlabcentral/answers/423367
Hope the above information helps 
More Answers (1)
  KSSV
      
      
 on 2 Aug 2024
        vidObj = VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv');
numFrames = 0;
while hasFrame(vidObj)
    F = readFrame(vidObj);    
    numFrames = numFrames + 1;   
    imagesc(F)
    drawnow
end
numFrames
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

