7

我有一个电影文件,其中我有兴趣记录点的移动;圆形特征的中心要具体。我正试图在Matlab中使用边缘检测和角点检测技术来执行此操作。如何在Matlab中提供边缘检测和角点检测的感兴趣区域(ROI)?

要执行此操作,如何指定视频中的感兴趣区域?情节是个好主意吗?

我试图执行此使用二进制面具下面,

hVideoSrc = vision.VideoFileReader('video.avi','ImageColorSpace', 'Intensity'); 
hEdge = vision.EdgeDetector('Method', 'Prewitt','ThresholdSource', 'Property','Threshold', 15/256, 'EdgeThinning', true); 
hAB = vision.AlphaBlender('Operation', 'Highlight selected pixels'); 
WindowSize = [190 150]; 
hVideoOrig = vision.VideoPlayer('Name', 'Original'); 
hVideoOrig.Position = [10 hVideoOrig.Position(2) WindowSize]; 

hVideoEdges = vision.VideoPlayer('Name', 'Edges'); 
hVideoEdges.Position = [210 hVideoOrig.Position(2) WindowSize]; 

hVideoOverlay = vision.VideoPlayer('Name', 'Overlay'); 
hVideoOverlay.Position = [410 hVideoOrig.Position(2) WindowSize]; 

c = [123 123 170 170]; 
r = [160 210 210 160]; 
m = 480; % height of pout image 
n = 720; % width of pout image 
BW = ~poly2mask(c,r,m,n); 

while ~isDone(hVideoSrc) 
    dummy_frame = step(hVideoSrc) > 0.5;    % Read input video 
    frame = dummy_frame-BW; 
    edges = step(hEdge, frame); 
    composite = step(hAB, frame, edges);  % AlphaBlender 

    step(hVideoOrig, frame);     % Display original 
    step(hVideoEdges, edges);     % Display edges 
    step(hVideoOverlay, composite);    % Display edges overlayed 
end 
release(hVideoSrc); 

,但事实证明,应用在框架的口罩是很好的只对原始视频。边缘检测算法检测那些被二进制掩码屏蔽的边缘。如何永久屏蔽其他功能并执行边缘检测?

回答

2

这是你的意思吗?

BW = poly2mask(c,r,m,n); 
frame = dummy_frame .* BW;