Replace the first frame of a video with another frame using MATLAB - matlab

I am using MATLAB for a video processing task.
When I tried to create an object for the grayscale video (the video has a .FLV extension) using the mmreader function of MATLAB, it showed an warning saying that it cannot determine the number of frames.
Then when I tried to read the video using read(mmreader), it showed an error saying not enough memory for 3246 frames.
Therefore I just read the first frame of the video, edited it and now trying to place the frame in the position of the first frame of the video.
Things that I have done:
Read and extracted the first frame of a grayscale video (the file has a .FLV extension) using mmreader function of MATLAB.
I embedded some text in the frame.
Things that I want to do and need your help:
Replace the first frame of the source video with the edited frame (i.e. the frame with the embedded text in it)
Save and Play the video.

Related

how to use melt to do video overlay? It's just like a PiP(picture in picture)

I want to use melt.exe (command line video editor) to do something with video overlay. It's like overlay a video on the other that I can control the size and position of the video which will be placed. I have done this with shotcut and view the xml it generates.
But I want to know how can I do this with melt command script. Or if I have known all the information about video overlay such as in/out points, size, position, and how to create a xxx.mlt(xml) file according to these info?
I got the three videos overlaied to generate one like this :
final effect
I use shotcut to do this and I get a .mlt file. sorry I don't know how to upload the xml file or maybe it can't be.
So I want to know how to do the same thing with melt.exe?

Creating video skim of YUV video in matab

I am having Y,U,V components of some frames and now I want to create a video from these components. To be more specific I want to create video summary of a video. Till now I have obtained which frames needs to be there (after some processing) in final video skim and I want to generate a video skim from these frames.
Thanks.
Edit:
I have created video skim but I doubt that might not be the most efficient method. What I am doing is first I am storing the required frame's Y,U,V component in a cell then I am using frwrite function of matlab.

Text overlapping in video processing Matlab

I'm a fresher to matlab, and I'm trying to extract text from video using ocr methods. My problem is, there is same text appearing in consecutive frames, and sometimes when camera is panning new parts of already extracted text will reveal and I have to add those to already extracted text. Both makes it difficult to store a text only once if it appear in video once while playing. Text usually are name boards or road side boards having text which are captured in the video. How to solve this problem?

Correct Video for lens distortion in Matlab?

I have a video that was taken with a GoPro and I would like to get rid of the fisheye distortion. I know I can get rid of the fisheye with the gopro software, but I want to do this using Matlab instead.
I know there's this http://www.mathworks.com/help/vision/ref/undistortimage.html that applies for images, however, how would I apply it for a full video? The number of frames in the video 207 (it's like 5 - 6 second short video).
Thank you very much!
Can't you just sample your video stream at 24fp (using e.g. ffmpeg, see here ), apply your Matlab routine one frame at a time, then rebuild the video stream in Matlab itself?
You can apply undistortImage to each frame of the video. If the video is saved to a file, you can use vision.VideoFileReader to read it one frame at a time, and then you call undistortImage. Then you can write the undistorted frame to a different file using vision.VideoFileWriter, or you can display it using vision.VideoPlayer.
Of course, this is all assuming that you have calibrated your camera beforehand using the Camera Calibrator App.

How can I render a moving circle over a video which positions itself based on data from a text file?

I have some video (.mp4), and some text data which includes the XY coordinates of a circle that I wish to draw over the video's frames and render a new video.
I have been able to do this in MATLAB using the computer vision toolbox, however the formats of video I can use are extremely limited... I need another method.
Use the insertShape function in the Computer Vision System Toolbox.