Class PreviewDetectionRegion.Builder

java.lang.Object
com.digimarc.dms.readers.image.PreviewDetectionRegion.Builder
Enclosing class:
PreviewDetectionRegion

public static class PreviewDetectionRegion.Builder extends Object
The builder used to create PreviewDetectionRegion
  • Method Details

    • setDisplayRotation

      public PreviewDetectionRegion.Builder setDisplayRotation(int displayRotation)
      Sets the display rotation of the device in degrees. Used to correct for relative display and camera rotation when mapping region of interest onto input frames.

      If not set the value of Display.getRotation() for the default display is used.

      Parameters:
      displayRotation - The display rotation in degrees
      Returns:
      The current Builder
    • setCameraRotation

      public PreviewDetectionRegion.Builder setCameraRotation(int cameraRotation)
      Sets the rotation of the camera sensor in degrees. Used to correct for relative display and camera rotation when mapping region of interest onto input frames.

      By default DMSDK attempts to retrieve the rotation from CameraHelper. However, if using a frame source other than CameraHelper, apps should retrieve the sensor rotation so that regions can be correctly transformed onto the input frames.

      Parameters:
      cameraRotation - The camera sensor rotation in degrees
      Returns:
      The current Builder
    • setRegionOfInterest

      public PreviewDetectionRegion.Builder setRegionOfInterest(@NonNull android.graphics.RectF regionOfInterest)
      Sets the region of interest that should be used for detection. The region is expected in normalized coordinates (0..1).

      Constraints:

      1) any value < 0.0f

      2) any value > 1.0f

      3) left > right

      4) top > bottom

      5) if either the height or width of the region < 0.15f.

      Parameters:
      regionOfInterest - Region rect in normalized coordinates
      Returns:
      The current Builder
    • build

      public PreviewDetectionRegion build()
      Returns:
      PreviewDetectionRegion object with current state.
      Throws:
      IllegalArgumentException - if the provided region of interest violates region constraints.