-
public final class ContourDetectorPerforms contour detection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumContourDetector.TypeThe type of the ContourDetector. ML_BASED is the default implementation
public classContourDetector.Companion
-
Field Summary
Fields Modifier and Type Field Description private final List<Point>polygonprivate final List<PointF>polygonFprivate final DoubledetectionScoreprivate final List<Line2D>verticalLinesprivate final List<Line2D>horizontalLines
-
Constructor Summary
Constructors Constructor Description ContourDetector(ContourDetector.Type contourDetectorType)
-
Method Summary
Modifier and Type Method Description final List<Point>getPolygon()final List<PointF>getPolygonF()final DoublegetDetectionScore()final List<Line2D>getVerticalLines()final List<Line2D>getHorizontalLines()final DetectionResultdetect(ByteArray nv21, Integer width, Integer height)Tries to detect a polygon from the given image. final DetectionResultdetect(ByteArray data)Tries to detect a polygon from the given image. final DetectionResultdetect(String fileName)Tries to detect a polygon from the given file. final DetectionResultdetect(Bitmap bitmap)Tries to detect a polygon from the given image. final UnitsetAcceptedAngleScore(Double acceptedAngleScore)The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. final UnitsetAcceptedSizeScore(Double acceptedSizeScore)The minimum size in percent (0 - 100) of the screen size to accept a detected document. final UnitsetRequiredAspectRatios(List<PageAspectRatio> requiredPageAspectRatios)Set required PageAspectRatios. final UnitsetRectOfInterest(RectF rectOfInterest)Set rect od interest sizes. final UnitresetPolygonHistory()Calling this method will reset the polygon smoothing history. final Unitdtor(Long ptr)-
-
Constructor Detail
-
ContourDetector
ContourDetector(ContourDetector.Type contourDetectorType)
- Parameters:
contourDetectorType- type of the document detector to use
-
-
Method Detail
-
getPolygon
final List<Point> getPolygon()
-
getPolygonF
final List<PointF> getPolygonF()
-
getDetectionScore
final Double getDetectionScore()
-
getVerticalLines
final List<Line2D> getVerticalLines()
-
getHorizontalLines
final List<Line2D> getHorizontalLines()
-
detect
final DetectionResult detect(ByteArray nv21, Integer width, Integer height)
Tries to detect a polygon from the given image.
- Parameters:
nv21- NV21 encoded camera imagewidth- Width of the image pixelsheight- Height of the image in pixels
-
detect
final DetectionResult detect(ByteArray data)
Tries to detect a polygon from the given image.
- Parameters:
data- Encoded image (e.g.
-
detect
final DetectionResult detect(String fileName)
Tries to detect a polygon from the given file.
- Parameters:
fileName- Encoded file path (e.g.
-
detect
final DetectionResult detect(Bitmap bitmap)
Tries to detect a polygon from the given image.
- Parameters:
bitmap- The image
-
setAcceptedAngleScore
final Unit setAcceptedAngleScore(Double acceptedAngleScore)
The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. Default is 75.0. Set lower values to accept more perspective distortion.
Warning: Lower values result in more blurred document images.
-
setAcceptedSizeScore
final Unit setAcceptedSizeScore(Double acceptedSizeScore)
The minimum size in percent (0 - 100) of the screen size to accept a detected document. It is sufficient that height or width match the score. Default is 80.0.
Warning: Lower values result in low resolution document images.
-
setRequiredAspectRatios
final Unit setRequiredAspectRatios(List<PageAspectRatio> requiredPageAspectRatios)
Set required PageAspectRatios.
-
setRectOfInterest
final Unit setRectOfInterest(RectF rectOfInterest)
Set rect od interest sizes.
- Parameters:
rectOfInterest- RectF
-
resetPolygonHistory
final Unit resetPolygonHistory()
Calling this method will reset the polygon smoothing history.
-
-
-
-