Video Processing in MATLAB
Video processing is essential to areas such as deep learning, motion estimation, and autonomous driving. Learn how MATLAB® can simplify working with videos. This introduction to video processing in MATLAB will walk through the essential elements of the video processing workflow. Learn how to read, write, process, and display videos in MATLAB. These steps can be accomplished in a few lines of code and enable interacting with HD videos at high-frame rates.
MATLAB provides algorithms and tools to process, analyze and interact with your videos.
Some applications of Video Processing are:
- Deep Learning, which lets you train networks to classify and recognize objects in videos.
- Motion Estimation methods like Optical Flow, which can be used to track cars across multiple frames.
- Detection and Tracking algorithms, which can detect objects like faces and track their location as they move through a video.
Let’s discuss how to read, write and view video in MATLAB.
- VideoReader lets you import videos into MATLAB. This function supports formats such as AVI, MPEG as well as platform specific formats for Windows, MAC and Linux.
- Often, we may want to import live video streams. Image Acquisition Toolbox provides a common interface through MATLAB code or an app to interact with a wide range of industrial and scientific cameras.
- There are a variety of ways to display videos in MATLAB.
- You can use the DeployableVideoPlayer which supports HD videos at high frame rates.
- Alternatively, the Video Viewer App lets you display the entire video, jump to a specific frame and alter the frame rate of the video.
- To write video data from MATLAB, we can use Video Writer which supports many codecs across Windows, MAC and Linux.
Now, let’s combine these elements to detect a face in a video:
- First, let’s read a video into MATLAB using VideoReader, and then read each frame of the video in a loop.
- Next, let’s process each video frame to detect a face and display a box around it.
- We can store our results as a video using VideoWriter. The function writeVideo adds each processed frame to the video file.
- Finally, we can verify the final video using the Video Viewer app.
In this video, we discussed how MATLAB can be used to develop Video Processing solutions. To learn more about Video Processing in MATLAB and to experiment with code, try out the examples in the link below.
DOWNLOAD DEMO FILES
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.