1

그래서 방금 MATLAB에서 Computer Vision 도구 상자를 사용하기 시작했으며 비디오에서 얼룩을 추적하려고했습니다.Computer Vision Toolbox의 MATLAB에 텍스트 레이블을 표시하는 방법

그래서 탐지 된 얼룩의 수를 출력하고 감지 된 얼룩 주위에 경계 상자가 있습니다.

이제 이미지에 레이블을 표시하려고합니다. 기본적으로 테두리 상자가 나타나기 때문에 레이블 (작은 숫자 1, 2, 3 등)이 나타나길 원합니다.

어떻게 할 수 있습니까?

이 내 코드는 지금까지 있습니다 :

blobAnalysis = vision.BlobAnalysis('BoundingBoxOutputPort', true, ... 
    'AreaOutputPort', false, 'CentroidOutputPort', true, ... 
    'MinimumBlobArea', 0,'LabelMatrixOutputPort', true); 

while ~isDone (videoReader) 
    videoFrame = step(videoReader); 
    foreground = step (foregroundDetector, videoFrame); 
    cleanForeground = imopen(foreground, strel('Disk',1)); 

    [centroids, bbox, Label] = step (blobAnalysis, cleanForeground); 

    Label; 
    centroids 

    result = insertShape(videoFrame, 'Rectangle',bbox,'Color','green'); 

    number = size(bbox,1); 

    result = insertText(result, [10 10], number, 'BoxOpacity', 1, 'FontSize', 14); 

    step(videoPlayer, result); % display the results 
end 

release(videoReader); % close the video fil 

감사합니다 여러분!

답변

0

쉬운 방법은 레이블과 함께 이미지에 테두리 상자를 그려주는 insertObjectAnnotation 함수를 사용하는 것입니다.