1

What happens if I use both imageCropAndScaleOption and regionOfInterest. What's the effect of the following codes

request.imageCropAndScaleOption = .centerCrop
request.regionOfInterest = CGRect(x: 0.0, y: 0.25, width: 1.0, height: 0.5)

request is a VNCoreMLRequest

Will the input be CGRect(x: 0.0, y: 0.25, width: 1.0, height: 0.5) with respect to the entire image or the center-cropped image?

Also I found when I just imageCropAndScaleOption to be .centerCrop, and if my CoreML model has an input of size 800x400, Vision API actually takes the largest centered square image from the camera, and resizes it into 800x400 before feeding into my model. It is different from their document:

maintaining aspect ratio to fit the short side, while cropping the centered image on its long side.

Danny Wang
  • 429
  • 9
  • 24

0 Answers0