public class ContourDetectorFrameHandler implements PreviewBuffer.FrameHandler
Performs contour detection on camera preview frames. Outputs results via net.doo.snap.camera.ContourDetectorFrameHandler.ResultHandler (). ContourDetectorFrameHandler.addResultHandler
Preview frame considered intercepted if at least one net.doo.snap.camera.ContourDetectorFrameHandler.ResultHandler returns true from ContourDetectorFrameHandler.ResultHandler.handleResult
| Modifier and Type | Class and Description |
|---|---|
static class |
ContourDetectorFrameHandler.DetectedFrame
Contour detection results alongside with information about frame
|
| Constructor and Description |
|---|
ContourDetectorFrameHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
addResultHandler()
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.
|
static ContourDetectorFrameHandler |
attach()
Convenience method for creating new ContourDetectorFrameHandler and adding it as net.doo.snap.camera.PreviewBuffer.FrameHandler to given camera view.
|
boolean |
handleFrame() |
boolean |
isEnabled() |
void |
removeResultHandler()
Unregisters handler.
|
void |
setAcceptedAngleScore()
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.
|
void |
setAcceptedSizeScore()
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.
|
void |
setEnabled() |
handleFramepublic static ContourDetectorFrameHandler attach()
Convenience method for creating new ContourDetectorFrameHandler and adding it as net.doo.snap.camera.PreviewBuffer.FrameHandler to given camera view.
public boolean handleFrame()
public void addResultHandler()
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.
public void removeResultHandler()
Unregisters handler.
public boolean isEnabled()
true if contour detection is enabled. false if contour detection is disabled, i.e. incoming frames are skipped.public void setEnabled()
public void setAcceptedAngleScore()
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.
public void setAcceptedSizeScore()
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.