-
- All Implemented Interfaces:
-
io.scanbot.sdk.camera.FrameHandler
public final class ContourDetectorFrameHandler implements FrameHandlerPerforms contour detection on camera preview frames. Outputs results via ContourDetectorFrameHandler.ResultHandler (.addResultHandler).
Preview frame considered intercepted if at least one ContourDetectorFrameHandler.ResultHandler returns
truefrom ContourDetectorFrameHandler.ResultHandler.handle (FrameHandlerResult)}
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceContourDetectorFrameHandler.ResultHandlerContinuously notified about contour detection results.
public abstract classContourDetectorFrameHandler.ContourDetectorResultHandlerSuccessor-class needed for cross-platform implementation
public final classContourDetectorFrameHandler.DetectedFrameContour detection results alongside with information about frame
public classContourDetectorFrameHandler.Companion
-
Constructor Summary
Constructors Constructor Description ContourDetectorFrameHandler(Context context, ContourDetector contourDetector)
-
Method Summary
Modifier and Type Method Description final BooleangetIsEnabled()final UnitsetIsEnabled(Boolean isEnabled)BooleanhandleFrame(FrameHandler.Frame previewFrame)final UnitaddResultHandler(ContourDetectorFrameHandler.ResultHandler handler)Registers result handler which will be notified about contour detection results. final UnitremoveResultHandler(ContourDetectorFrameHandler.ResultHandler handler)Unregisters handler. final UnitclearResultHandlers()Unregisters all handlers. 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. -
-
Constructor Detail
-
ContourDetectorFrameHandler
ContourDetectorFrameHandler(Context context, ContourDetector contourDetector)
-
-
Method Detail
-
getIsEnabled
final Boolean getIsEnabled()
-
setIsEnabled
final Unit setIsEnabled(Boolean isEnabled)
-
handleFrame
@Synchronized() Boolean handleFrame(FrameHandler.Frame previewFrame)
-
addResultHandler
final Unit addResultHandler(ContourDetectorFrameHandler.ResultHandler handler)
Registers result handler which will be notified about contour detection results.
Results are coming on the worker thread. Don't forget to move execution to main thread before updating UI.
- Parameters:
handler- handler to register.
-
removeResultHandler
final Unit removeResultHandler(ContourDetectorFrameHandler.ResultHandler handler)
Unregisters handler.
- Parameters:
handler- handler to unregister.
-
clearResultHandlers
final Unit clearResultHandlers()
Unregisters all handlers.
-
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.
-
-
-
-