I am trying to detect a Rectangle using CIDetector.
Rectangle
CIDetector
I am using code from this: https://www.cocoacontrols.com/controls/vnimagescanner
Finally I got the an Open source library WeScan by WeTransfer to detect Rectangle/Document scanning and this give accurate result. I followed below link:
WeScan
https://github.com/WeTransfer/WeScan