How to obtain centroids from cascade object detector?

1 回表示 (過去 30 日間)
William Maurer
William Maurer 2015 年 6 月 7 日
回答済み: Dima Lisin 2015 年 6 月 12 日
I am having trouble determining a way to get centroids from objects detected by a trained object detector- the only output seems to be bounding boxes. Is there another way I could get the centroid coordinates for the detected HOG features?
code:
detector = vision.CascadeObjectDetector('Detector3.xml');
detector.MergeThreshold = 3;
img = imread('Test_image.jpg');
[bbox] = step(detector,img)

採用された回答

Image Analyst
Image Analyst 2015 年 6 月 7 日
If you have a binary image you could use regionprops(). See my Image Segmentation Tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 for a full demo.
  1 件のコメント
William Maurer
William Maurer 2015 年 6 月 9 日
Thank you, that demo was very helpful!

サインインしてコメントする。

その他の回答 (1 件)

Dima Lisin
Dima Lisin 2015 年 6 月 12 日
Hi William,
The best you can do, is to get the centroid of the box. The bounding box format is [x, y, widht, height]. So the centroid is [x+width/2, y+height/2]. or for multiple bboxes: [bbox(:,1)+bbox(:,3)/2, bbox(:,2)+bbox(:,4)/2].

Community Treasure Hunt

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

Start Hunting!

Translated by