public class ContourDetectorFrameHandler
Performs contour detection on camera preview frames. Outputs results via
interface ContourDetectorFrameHandler.ResultHandler
(.addResultHandler).
Preview frame considered intercepted if at least one
interface ContourDetectorFrameHandler.ResultHandler returns true from
ContourDetectorFrameHandler.ResultHandler.handle (FrameHandlerResult)}
public static io.scanbot.sdk.contourdetector.ContourDetectorFrameHandler.Companion Companion
public ContourDetectorFrameHandler(@NotNull
android.content.Context context,
@NotNull
io.scanbot.sdk.core.contourdetector.ContourDetector contourDetector)
Performs contour detection on camera preview frames. Outputs results via
interface ContourDetectorFrameHandler.ResultHandler
(.addResultHandler).
Preview frame considered intercepted if at least one
interface ContourDetectorFrameHandler.ResultHandler returns true from
ContourDetectorFrameHandler.ResultHandler.handle (FrameHandlerResult)}
public boolean isEnabled()
true if contour detection is enabled. false if contour detection
is disabled, i.e. incoming frames are skipped.public void setEnabled(boolean p)
@Synchronized
public boolean handleFrame(@NotNull
io.scanbot.sdk.camera.FrameHandler.Frame previewFrame)
public void addResultHandler(@NotNull
io.scanbot.sdk.contourdetector.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.
handler - handler to register. Must not be null. If handler was alreadyregistered, nothing happens.public void removeResultHandler(@NotNull
io.scanbot.sdk.contourdetector.ContourDetectorFrameHandler.ResultHandler handler)
Unregisters handler.
handler - handler to unregister. If it was not registered before, nothing happens.public void clearResultHandlers()
Unregisters all handlers.
public void 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.
acceptedAngleScore - public void 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.
acceptedSizeScore - public void setRequiredAspectRatios(@Nullable
java.util.List<io.scanbot.sdk.core.contourdetector.PageAspectRatio> requiredPageAspectRatios)
Set required PageAspectRatios.
requiredPageAspectRatios - protected boolean notifyHandlers(@NotNull
io.scanbot.sdk.camera.FrameHandlerResult<io.scanbot.sdk.contourdetector.ContourDetectorFrameHandler.DetectedFrame,io.scanbot.sdk.SdkLicenseError> result)
public void <no name provided>()
Continuously notified about contour detection results.
@JvmStatic @NotNull public static ContourDetectorFrameHandler attach(@NotNull io.scanbot.sdk.ui.camera.IScanbotCameraView cameraView, @NotNull io.scanbot.sdk.core.contourdetector.ContourDetector detector)
Convenience method for creating new class ContourDetectorFrameHandler and adding it
as FrameHandler to given camera view.
cameraView - camera view to which new contour detector will be attacheddetector - contour detector instanceclass ContourDetectorFrameHandlerclass ContourDetectorFrameHandler