Is it possible to increase the size of a bounding box on a rectangle detection, I am detecting a rectangle fine and cropping is perfect around the size of the box, but I would like to slightly increase the size of the bounding box before it crops, that way I get a little more than just the rectangle in the crop.
Here is the code I have.
let imageSize = changedImage.extent.size
// Verify detected rectangle is valid.
let boundingBox = detectedRectangle.boundingBox.scaled(to: imageSize)
guard changedImage.extent.contains(boundingBox)
else { return }
let topLeft = detectedRectangle.topLeft.scaled(to: imageSize)
let topRight = detectedRectangle.topRight.scaled(to: imageSize)
let bottomLeft = detectedRectangle.bottomLeft.scaled(to: imageSize)
let bottomRight = detectedRectangle.bottomRight.scaled(to: imageSize)
let correctedImage = changedImage
.cropped(to: boundingBox)