Class PreviewDetectionRegion

java.lang.Object
com.digimarc.dms.readers.image.DetectionRegion
com.digimarc.dms.readers.image.PreviewDetectionRegion

public final class PreviewDetectionRegion extends DetectionRegion
A DetectionRegion for restricting detection within a camera preview. A PreviewDetectionRegion must be created by the PreviewDetectionRegion.Builder. To construct a PreviewDetectionRegion.Builder a RectF is needed to describe the percentage of the frame that is visible in the camera preview.

A PreviewDetectionRegion is useful for apps that display a camera preview. The visible image within a camera preview is often a cropped region of the full camera frame. This class allows apps to restrict detection within this visible area. To further restrict the detection region within a sub-region of the visible image, such as a targeting area, apps can construct a PreviewDetectionRegion.Builder with PreviewDetectionRegion.Builder.setRegionOfInterest(RectF).

PreviewDetectionRegion is designed to accept regions relative to the display's orientation. Internally PreviewDetectionRegion will apply the rotation needed to project regions onto input frames. The majority of use cases should use the default values described in PreviewDetectionRegion.Builder.setDisplayRotation(int) and PreviewDetectionRegion.Builder.setCameraRotation(int). Apps using a display other than default or a camera source other than CameraHelper should provide rotation information via the relevant builder methods.

Apps using CameraHelper to stream the preview can access the percentage of visible camera frame by calling CameraHelper.getRectForVisibleSurface() within a CameraRegionListener.onVisibleRegionChanged() callback.