Many thanks @Claude31 . The link you supplied has the solution. I stopped depending on CIDetector & starts to depend on the Vision framework (which is supported by this third party) for detecting my envelopes & Al7amdulilah it works great with the aspect ratios of interest.
For future reference, I have already tried to modify CIDetector options you mentioned before while I was searching for a solution but none of them solved the issue.
Post
Replies
Boosts
Views
Activity
What do you get as return ? nil or wrong rectangleFeatures ?
In case running on iPhone with iOS 15 & trying to detect an envelope with mentioned aspect ratio, I'm getting an empty array of CIRectangleFeature (Expected to receive a CIRectangleFeature array with one element which represents the detected envelope)
Where do you specify the aspect ratio ?
The fix I have tried is the following:
let rectangleDetector = CIDetector(ofType: CIDetectorTypeRectangle, context: CIContext(options: nil), options: [CIDetectorAccuracy: CIDetectorAccuracyHigh, CIDetectorAspectRatio: 2.0, CIDetectorMinFeatureSize: 0])
I have removed it from the method when I found that it doesn't solve the mentioned issue.