automatically selecting video and extracting frames?

i just have .avi video files from 12 am to 6 pm (day) with 5 min intervals, how can i select automatically videos of 12am, 4pm and 6pm, and extracting frames from each video?I know how to extract frame but can not automatically do for my problem. all video sorted with time sequence.

 Accepted Answer

4 Comments

it just read video frames with different intervals, but for me: i need to read videos in different time (12 am, 4 pm and 6 pm) then extract frames from each video. so my question here is how can do read videos?
No that link shows you how to set the time from the beginning of the interval to read from. If you know the video started at midnight then CurrentTime of 0 would be midnight, CurrentTime of 16*60*60 would be 4pm, CurrentTime of 18*60*60 would be 6pm. You set the object CurrentTime property and then you readFrame() however many frames you want.
Or is it that you have a number of videos that are each 5 minutes long, and you need to figure out the proper file to read from? If so then you need to tell us what the file names look like, and also you need to tell us whether we should count on the files being at the current intervals or if instead we might have to figure out which of the files 4pm is contained in because the file does not start at an exact multiple of 5 minutes?
thank you. the first you recommended is the best for me.
Correction, you need to multiply by another factor of 60 than what I originally wrote. 3600 seconds times the hour number.

Sign in to comment.

More Answers (1)

It seems the gist of your question is "how can i select automatically videos of 12am, 4pm and 6pm, and extracting frames from each video?"
For the first question, how do you select the videos that were made at a specific time, you can use dir(). dir() returns a structure, or structure array if you have a file pattern instead of just one filename passed into it. The structure has as one of its fields the date and time stamp on the file. Now I'm not sure if you start recording a file at 4 p.m. and quit recording and close up the file at 4:30 if the file time is 4:00 or 4:30, so you'll have to check on that.
For the second question about how to open a video file and extract frames from it and do something with them, I ask you to run the demo script I have attached.

Community Treasure Hunt

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

Start Hunting!