视频识别基于matlab高斯模型视频车辆检测含Matlab源码 503期
Posted 紫极神光
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了视频识别基于matlab高斯模型视频车辆检测含Matlab源码 503期相关的知识,希望对你有一定的参考价值。
一、简介
二、源代码
frameRate = get(trafficObj,\'FrameRate\');
% video = read(trafficObj);
% implay(video, frameRate);
darkCarValue = 50;
darkCar = rgb2gray(read(trafficObj,71));
noDarkCar = imextendedmax(darkCar, darkCarValue);
imshow(darkCar)
figure, imshow(noDarkCar)
sedisk = strel(\'disk\',2);
noSmallStructures = imopen(noDarkCar, sedisk);
imshow(noSmallStructures)
nframes = get(trafficObj, \'NumberOfFrames\');
I = read(trafficObj, 1);
taggedCars = zeros([size(I,1) size(I,2) 3 nframes], class(I));
for k = 1 : nframes
singleFrame = read(trafficObj, k);
% Convert to grayscale to do morphological processing.
I = rgb2gray(singleFrame);
% Remove dark cars.
noDarkCars = imextendedmax(I, darkCarValue);
% Remove lane markings and other non-disk shaped structures.
noSmallStructures = imopen(noDarkCars, sedisk);
% Remove small structures.
noSmallStructures = bwareaopen(noSmallStructures, 150);
% Get the area and centroid of each remaining object in the frame. The
% object with the largest area is the light-colored car. Create a copy
% of the original frame and tag the car by changing the centroid pixel
% value to red.
L = bwlabel(noSmallStructures);
taggedCars(:,:,:,k) = singleFrame;
if any(L(:))
三、运行结果
四、备注
版本:2014a
完整代码或代写加1564658423
以上是关于视频识别基于matlab高斯模型视频车辆检测含Matlab源码 503期的主要内容,如果未能解决你的问题,请参考以下文章
车辆检测基于matlab yolo v2车辆检测识别含Matlab源码 581期
图像分割基于matlab直方图的自适应阈值方法分割前景与背景含Matlab源码 2144期