How do i plot a bounding box around the output of a Moving object algorithm?
4 views (last 30 days)
Show older comments
ive used the background subtraction process to find moving objects from a real time video input and would like to plot the bounding box around only the moving object detected. is it possible??? and can i plot the centroid of the same???
0 Comments
Answers (1)
ChristianW
on 17 Mar 2013
With Image Processing Toolbox:
doc regionprops
An example:
BW = imread('text.png'); imshow(BW)
bb = regionprops(BW, {'BoundingBox','Centroid'});
centroids = cat(1, bb.Centroid);
boundingboxes = cat(1, bb.BoundingBox);
hold on
plot(centroids(:,1), centroids(:,2), 'r+')
for k = 1:size(boundingboxes,1)
rectangle('position',boundingboxes(k,:),'Edgecolor','g')
end
hold off
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!