From: Saied on
Hi every one
Actually I have a problem that I can't use frame2im function,this is what I want to do.
1-convert all the frames on the video to an im
2-then I will apply some filters on the images.
3-then I would like to convert the images to a video again.
4-play the video after converting it.
Thank you all very much
From: Saied on
hey guys I know how read a video and how to do filters to it but my problem is that I don't know how to convert from video to images which mean convert its frames to images and vise versa.
any help.
From: Saied on
any help please.
From: Walter Roberson on
Saied wrote:

> Actually I have a problem that I can't use frame2im function,this is
> what I want to do.
> 1-convert all the frames on the video to an im
> 2-then I will apply some filters on the images.
> 3-then I would like to convert the images to a video again.
> 4-play the video after converting it.
> Thank you all very much

See the documentation for read(), and in particular the examples() section.
Chances are that you can skip using frame2im -- though the associated
functions only work with Windows.

If you are working on a non-Windows system, then see aviread() if you have a
non-compressed AVI file. At least as of 2008b, there is no provision on
non-Windows systems to read compressed AVI files or any other type of movie
files (mmread can handle several different types on Windows.)

Once you have an individual image, im2frame() converts it to an individual
movie frame, which is a structure. Just store all of the frames in the same
array to create a complete matlab movie data structure suitable for playing
with the movie() command.
From: Alec Rogers on
Hi Saied,

It sounds like you do not really need the intermediary images, is that
correct?

If you have MATLAB R2010a, I would recommend using the
video.MultimediaFileReader and video.MultimediaFileWriter System
objects, which are designed for this sort of task.

Here is some sample code that detects edges by looking at the red plane
of an RGB, and writes those edges as a new video file. The example is
simplistic, but hopefully it will give you some ideas.

Regards,
-alec


hmfr = video.MultimediaFileReader;
hmfw = video.MultimediaFileWriter('vipmen1.avi', ...
'AudioInputPort', false, ...
'VideoInputPort', true);
hedge = video.EdgeDetector;

while ~isDone(hmfr)
videoFrame = step(hmfr);
edges = step(hedge, videoFrame(:,:,1));
step(hmfw, edges);
end

release(hmfr);
release(hmfw);



PS: If you wanted an example of generating images from a video in
Simulink, have a look at the following URL:
http://www.mathworks.com/support/solutions/en/data/1-3NV9LZ/?solution=1-3NV9LZ



Saied wrote:
> Hi every one
> Actually I have a problem that I can't use frame2im function,this is
> what I want to do.
> 1-convert all the frames on the video to an im
> 2-then I will apply some filters on the images.
> 3-then I would like to convert the images to a video again.
> 4-play the video after converting it.
> Thank you all very much