Search code examples
matlabtransformpointsbounding-box

Convert List of Points to a Bounding Box in Matlab


I have a bounding box:

 bbox = [10 20 50 60];

I convert the bounding box to a list of points using:

 points = bbox2points(bbox);

I then apply a rotation to the points using affine2d and transformPointsForward. Now I have my transformed points, how can I convert them back to a bounding box? Is there some built in function equivalent to "points2bbox"? Thanks.


Solution

  • Now sorted. I just flipped the images in various ways and then calculated the new bounding box position using the angle of rotation and the dimensions of the original image (which remained constant).