标签:ble VID 阅读器 end 转换 col class put one
1 close all 2 clear 3 clc
1 videoFReader = vision.VideoFileReader(‘yeast.avi‘,‘VideoOutputDataType‘,‘double‘); 2 vidPlayer = vision.DeployableVideoPlayer;
1 tracker = vision.HistogramBasedTracker;
1 % 读取视频的一帧 2 objectFrame = step(videoFReader); 3 4 % 转换颜色空间为HSV颜色空间 5 objectFrameHsv = rgb2hsv(objectFrame); 6 7 % 方式1:使用预定义的值初始化需要跟踪对象的位置 8 %objectRegion = [50,90,60,100]; 9 10 % 方式2:通过绘制矩形框标记出需要跟踪对象的位置 11 imshow(objectFrame) 12 h = imrect; 13 wait(h) 14 objectRegion = getLoc(h); 15 16 % 使用饱和通道进行分短 17 initializeObject(tracker,objectFrameHsv(:,:,2),objectRegion,32);
1 while ~isDone(videoFReader) 2 % 读取图像并转换为HSV颜色空间 3 frame = step(videoFReader); 4 Ihsv = rgb2hsv(frame); 5 6 % 跟踪对象展示结果 7 bbox = step(tracker,Ihsv(:,:,2)); 8 9 % 可视化结果 10 outFrame = insertShape(frame,‘Rectangle‘,bbox); 11 12 % 更新视频播放器 13 step(vidPlayer,outFrame); 14
15 pause(0.2) 16 end
1 release(vidPlayer); 2 release(videoFReader);
标签:ble VID 阅读器 end 转换 col class put one
原文地址:https://www.cnblogs.com/jeapwu/p/10986996.html