Reputation: 2401
I am using Blender to render a model. The model is captured by the camera whose placement changes. Then I write the image to a file. How do I find the bounding box in the image so that this box can be used for annotation useful in training object detection models?
Upvotes: 3
Views: 15346
Reputation: 2439
For anyone else looking, this answer is better suited for the task at hand (with 2.8 updates).
Upvotes: 1
Reputation: 7079
Every object in blender has a bound_box property, this is in simple axis min/max not an optimal rotated bounding box. Note that non-renderable objects will show a zero size bound_box, such as empty, camera, light, lattice, armature.
Depending on the accuracy or time trade-offs you want to make, you can translate the points in the bound_box or each object vertex, to a rendered image co-ordinate as explained here. By translating each vertex you can create a region defining the outline of the object or you can just use min/max to create a simple bounding box to surround it.
Upvotes: 5