platypus icon indicating copy to clipboard operation
platypus copied to clipboard

Produce sub images based on bounding boxes

Open ngan-cassie opened this issue 3 years ago • 3 comments

Hi I'm currently using this package to detect daily objects in Haiti. As this model is only used on 80 classes, I wonder is there anyway I can cut out sub images from bounding boxes without the labels (like image segmentation but without classification)? I plan to feed those sub images into another image classification model.

ngan-cassie avatar Jul 21 '21 20:07 ngan-cassie

@ngan-cassie if you want to cut images based on bounding boxes you can use imager or magick packages using box coordinates (xmin, xmax, ymin, ymax).

maju116 avatar Jul 22 '21 07:07 maju116

@maju116 thank you for your suggestion! I looked into magick package and found image_crop function. However I don't know how to calculate the box's width and height and left padding based on box coordinates. Do you have any resources that can help me understand better which part of the image these coordinates point to exactly so that I can calculate width and height based on that? image_crop

ngan-cassie avatar Jul 23 '21 20:07 ngan-cassie

@ngan-cassie to get width and height simply subtract: xmax-xmin and ymax-ymin

maju116 avatar Jul 26 '21 07:07 maju116