AspectRatio on VNDetectRectanglesRequest: Can it handle width > height?

Viewed 850

As per Apple's documentation, the maximum and minimum aspect ratios for rectangle detection requests can have values ranging from 0.0 to 1.0. I believe the aspect ratio is defined as width/height, so does that mean that the Vision Framework cannot detect rectangles that have a width bigger than height? Testing for aspect ration with values bigger than 1.0 didn't cause any compiler errors, but it doesn't seem to have any effect. The rectangle detected on the below screens is 20x30 so its aspect ratio is 0.66. It does seem to work for values within the 0.0 to 1.0 range.

Adding to that, the framework is detecting a circle as a rectangle (appreciate any explanations on that as well).

Best regards!

Coded using Xcode9 and Swift4: Sample Xcode project

enter image description here enter image description here

1 Answers

After got stuck in this for hours I found that Vision understands aspect ratio as height/width.

enter image description here

Vision Docs

Related