How are CIDetectorMinFeatureSize and CIDetectorAspectRatio keys used for CIDetector?
How to use CIDetectorMinFeatureSize
when configuring CIDetector for face or rectangle recognition? Apple's description doesn't tell me anything:
A key used to specify the minimum size that the detector will recognize as a function.
The value for this key is an NSNumber object in the range 0.0 to 1.0, which is a fraction of the minor size of the image.
The documentation says it ranges from 0.0 to 1.0 and then I watch the WWDC slides of session 514 and they set the value to "100" ...?
This is as much a secret to me as (undocumented?) CIDetectorAspectRatio
.
Let's say I'm trying to locate a sheet of A4 paper that is 30cm x 21cm and has an aspect ratio of 1.4 - what would I set for the two keys?
source to share
CIDetectorAspectRatio is used by CIRectangleDetector to constrain the search. In your example, the value for the CIDetectorAspectRatio key should be @ (1.43).
CIDetectorMinFeatureSize is also used to limit the search. Only rectangles that are larger than the specified portion of the input image size will be returned.
source to share
In the documentation you can find about "CIDetectorAspectRatio":
Option defining the aspect ratio (width to height) of the rectangles to search.
The value of this key is an NSNumber object whose value is a positive floating point number. Use this option with the CIDetectorTypeRectangle sensor type to fine tune the detector's accuracy. For example, to more accurately find the business card (3.5 x 2 inches) in the image, specify an aspect ratio of 1.75 (3.5 / 2).
Available in iOS 8.0 and later.
source to share