Detect rectangles

How to detect a rectangle in an image

For detecting documents and signs and more

If we can detect a square artificial object, we can use it for various purposes depending on the situation.
For example, finding a rectangle in a document.

Vision rectangle detection can be used


Just make a VNDetectRectangleRequest to the image.

topLeft: (0.37335851788520813, 0.5885436534881592)
topRight: (0.5980302095413208, 0.6653665900230408)

bottomLeft: (0.45727139711380005, 0.16498719155788422)
bottomRight: (0.7020156383514404, 0.26323217153549194)

boundingBox: (0.37335851788520813, 0.16498719155788422, 0.3286571204662323, 0.5003793984651566)

You can get the normalized coordinates in the image.
The Y coordinate is based on the bottom of the image.


I’m a freelance engineer.
Work consultation
Please feel free to contact us with a brief development description.

I am making an app that uses Core ML and ARKit.
We send machine learning / AR related information.





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store