MATLAB视频处理

应用,例子和技术

共同应用

Video applications present common but difficult challenges that require flexible analysis and processing functionality. Using MATLAB®和模拟金宝app®products, you can develop solutions to common video processing challenges such as video stabilization, video mosaicking, target detection, and tracking.

对象跟踪

Object tracking is an essential part of many applications including pedestrian avoidance, security and surveillance, and augmented reality. This examples shows motion-based tracking of moving people in a video from a stationary camera.

对象检测和计数

Video processing can be used to detect and count objects that move in video sequences. In this case study, scientists in Australia are using video footage to estimate the wildlife population of waterbirds.

视频处理in MATLAB

马铃薯®提供工具和算法,可让您查看,分析,读取和编写视频。视频处理可以在应用程序中有用:

视频处理对于深度学习,运动估计和自主驾驶等领域至关重要。了解如何通过查看Matlab的详细示例来互动,进程和分析视频。

4个简单步骤中的视频处理

MATLAB中的视频处理涉及以下步骤:

  1. 阅读视频
  2. 显示视频
  3. Processing the video
  4. Writing the video

Step 1。Reading the Video

You can read video from files or directly from cameras.

单个matlab命令允许您从文件中读取视频:

>> Vid = Videoreader('filename.avi'

Matlab支金宝app持网络摄像头用于视频处理,而图像采集工具箱™可以从许多工业和科学相机的实时收购。

马铃薯lets you使用各种编解码器读取视频文件包括Microsoft的特定操作系统编解码器®Windows®, Mac, and Linux®

Step 2。显示视频

There are two methods for displaying video in MATLAB:

视频查看器应用程序,播放MATLAB电影,视频或图像序列。该应用程序允许您以不同的速度启动,停止和播放视频,并跳转到视频的一部分。

Step 3。处理视频

A video is a sequence of individual video frames, or images. This means an algorithm designed to perform edge detection on an image can be quickly converted to perform edge detection on a video.

Read single image

从视频读取图像框架

current_image = imread('flowers.png');
edge(current_image);

current_image = readFrame(vid);
edge(current_image);

Video processing can be very simple, as in the example using edge detection, or significantly more complex, such as tracking algorithms that must account for an object’s location in previous frames.

有关高级视频处理的更多信息,请参阅示例:

步骤4。写视频

处理后,您可以将每个帧写入文件。您可以使用该功能创建一个视频文件:

>> vid_w = VideoWriter('newfile.avi');>> open(vid_w)

The variablevid_wcan accumulate new frames to create a video.

一个完整的matlab示例

将所有组件放在一起,让我们通过一个完整的榜样来显示阅读,显示,处理和编写视频的步骤:

% %读取和处理视频到MATLAB %设置:create Video Reader and WriterVideofilereader = Videoreader('tilted_face.avi');myVideo = VideoWriter('myfile.avi');%设置:创建可部署的视频播放器和面部探测器depVideoPlayer = vision.DeployableVideoPlayer; faceDetector = vision.CascadeObjectDetector(); open(myVideo);%% Detect faces in each framewhileHasfame(Videofilereader)%读取视频帧视频rame = ReadFrame(VideoFilereader);%进程框架bbox = facedetector(视频rame);视频rame = insertshape(视频rame,'Rectangle', bbox);%显示视频帧到屏幕DEPVIDEOPLAYER(Videoframe);% Write frame to final video fileWriteVideo(MyVideo,Videoframe);暂停(1 / Videofilereader.framerate);结束close(myVideo)

You can下载此代码在Matlab Central。

先进的技术

计算机愿景的视频处理算法

马铃薯algorithms that use temporal correlation for video processing are based on the concept of “state,” the idea that the algorithm is working on a current video frame but also uses previous frames to determine its output. This is crucial for object tracking algorithms, which rely on prior information to inform future action. A common example of tracking is theKLT algorithm,它跟踪对象中的各个点以跟踪对象的位置。

视频处理算法的开发人员还可以使用特定于视觉的算法Computer Vision System Toolbox™。该算法让您以快速和内存高效的方式读取和查看高分辨率视频。该工具箱还包括用于3D点云处理,立体视觉,对象检测,跟踪和识别以及其他应用程序的算法。

了解有关视频处理的更多信息

使用GPU编码器从MATLAB编写的雾化算法生成CUDA代码。
Learn the considerations, workflow, and techniques for targeting a vision processing algorithm to FPGA hardware
了解MATLAB如何解决遇到的常见挑战,同时开发对象识别系统,并查看深度学习,机器学习和计算机视觉的新功能。