Framing a Video
3 次查看(过去 30 天)
显示 更早的评论
I need help for writing codes for frame a Video in order to take 10 sequence by using Matlab codes. There is a avi file and i need to take 10 sequence out of it for my image processing. I required write a code on a M file to do this by using Matlab codings.
PLS need help ASAP
1 个评论
Andreas Goser
2011-2-5
This looks like you have not started yet, right? MATLAB Answers is intended to help you with specific coding problems or for help to get started, but not for providing complete code. I interprete your question that you need some starting points and will craft and answer with that in mind
回答(4 个)
Andreas Goser
2011-2-5
As a starting point, please familiarize with the commands AVIREAD, MMREADER, VIDEOREADER, e.g.:
The rest of the description remains unclear to me. It sounds like you would like to use only every 10th frame. You can certainly do that with the imported structure.
0 个评论
Pramod Bhat
2011-2-12
Dear sir, even I am working on video processing. I am able to capture video from the webcam.But still i am not able to convert the video to frames and process them. plz help.
0 个评论
Walter Roberson
2011-2-12
aviread() accepts as a parameter the frame number(s) to read. The output of aviread() is an array of movie frames. The structure of movie frames is described in the getframe documentation. You can then loop over the frame array using frame2im() to convert the frames to images.
If your avi movie happens to be TrueColor (quite plausible) then if you stored the result of the aviread() in the variable F, you can do all the frame conversions at once, using
images = cat(4,F.cdata);
This will result in a 4D array indexed by row, column, plane, and (relative) frame. Plane in this sense is 1 for R, 2 for G, 3 for B.
You can test for TrueColor movies by using
if isempty(F(1).colormap)
%it _is_ truecolor
else
%not truecolor. Have to convert the frames one by one
end
0 个评论
James Bond
2011-2-12
^^^ Walter, I tried using aviread but received the following error:
F=aviread('hello.avi')
Warning: AVIREAD will be removed in a future release. Use MMREADER instead.
> In aviread at 29 ??? Error using ==> findchunk at 20 Incorrect chunk size information in AVI file.
Error in ==> aviinfo at 96 [chunk, msg, msgID] = findchunk(fid,'RIFF');
Error in ==> aviread>getAviInfo at 439 info = aviinfo(filename,'Robust');
Error in ==> aviread at 57 info = getAviInfo( filename );
I don't understand why I get these errors.
1 个评论
Walter Roberson
2011-2-12
You could try using mmreader, but I suspect it might not work any better. I think you might have a corrupt video. It might help to read it in to some other program and re-save it.
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!