How to know the size and the pixel coordinates when drawing a bounding box on an image
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nalini
am 15 Nov. 2016
Beantwortet: Image Analyst
am 15 Nov. 2016
- I am drawing bounding boxes on objects which are far and close to the camera in an image.
- Object close to camera is larger in size and object farther from camera is smaller in size.
- I will then train an object detector using these ground truthed data as positive data.
- How can know the pixel coordinates and the size of a bounding box so i can train the detector differently for objects closer (larger bounding box) and farther from camera (smaller bounding box).
Thanks a lot!
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 15 Nov. 2016
The pixel coordinates and width and height of the bounding box(es) are returned from regionprops(). First you segment your objects to get a binary image of where your objects are, then label your binary image and send it in to regionprops() asking for the bounding box.
labeledImage = bwlabel(binaryImage);
props = regionprops(labeledImage, 'BoundingBox');
props is a structure array. Each structure in the array has a field called Bounding Box that contains an array, [leftColumn, topRow, width, height], with units of pixels.
See my Image Segmentation Tutorial for a full demo. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Camera Calibration finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!