How to get co-ordinates of the detected blobs in a video frame?

1 次查看(过去 30 天)
This programming code is done in Scilab,very much similar to matlab. I have detected features of vehicles and I need to co-ordinates of them or I need their position.What should I do?
Here is the reference code:-
n = aviopen('F:\Rec_2018-12-21 h18_m7_s29.avi'); //open the video file
for i=1:20
im = avireadframe(n,i);
subplot(3,2,1);
imshow(im); //show the images
title('orginal video image'); //title name
loop = rectangle(im,[80, 40, 50, 40],[255 255 255]); //rectangle fixed loop of white clr drawn
subplot(3,2,2);
imshow(loop); // rectangle drawn on input image
se = imcreatese('rect',3,3);
S_bin = im2bw(sub,imgraythresh(im));
S2 = imopen(S_bin,se);
[S3,nn] = imlabel(im2bw(S2,imgraythresh(im))); //label-binary img //nn-number of blobs
[Area, BB, ctr] = imblobprop(S3); // Find the object features
if nn ==BB then
loop1 = rectangle(im,[80, 40, 50, 40],[255 0 0]); //rectangle fixed loop of white clr drawn - veh detection
subplot(3,2,2)
imshow(loop1); // rectangle drawn on input image
title('vehicle presence:no'); //veh det yes only when small box comes inside big box
else
loop1 = rectangle(im,[80, 40, 50, 40],[255 255 255]); //rectangle fixed loop clr changed to red clr
subplot(3,2,2)
imshow(loop1); // rectangle drawn on input image
title('vehicle presence:yes');
end
end
aviclose();
avicloseall();
Here, blobs are not detected properly.Is it because if the function or the size of structuring element?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Feature Detection and Extraction 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by