Package com.digimarc.dms.readers.image
Class PreviewDetectionRegion.Builder
java.lang.Object
com.digimarc.dms.readers.image.PreviewDetectionRegion.Builder
- Enclosing class:
- PreviewDetectionRegion
The builder used to create
PreviewDetectionRegion
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
setCameraRotation
(int cameraRotation) Sets the rotation of the camera sensor in degrees.setDisplayRotation
(int displayRotation) Sets the display rotation of the device in degrees.setRegionOfInterest
(android.graphics.RectF regionOfInterest) Sets the region of interest that should be used for detection.
-
Method Details
-
setDisplayRotation
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
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
- Returns:
- PreviewDetectionRegion object with current state.
- Throws:
IllegalArgumentException
- if the provided region of interest violates region constraints.
-