Package com.appliedrec.verid.ui2
Class CameraPreviewHelper
- java.lang.Object
-
- com.appliedrec.verid.ui2.CameraPreviewHelper
-
public class CameraPreviewHelper extends java.lang.Object
Helper class for camera previews- Since:
- 2.4.0
-
-
Constructor Summary
Constructors Constructor Description CameraPreviewHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description android.util.Size
getCorrectedTextureSize(int imageWidth, int imageHeight, int viewWidth, int viewHeight, int sensorOrientation, int deviceRotation)
Get camera preview texture size corrected to match the device and camera sensor orientationstatic CameraPreviewHelper
getInstance()
int
getMinImageArea()
android.util.Size[]
getOutputSizes(android.util.Size[] previewSizes, android.util.Size[] imageReaderSizes, android.util.Size[] videoSizes, int viewWidth, int viewHeight, int sensorRotation, int deviceRotation)
Select a set of camera output sizesandroid.graphics.Matrix
getViewTransformMatrix(int imageWidth, int imageHeight, int viewWidth, int viewHeight, int sensorOrientation, int deviceRotation)
Get matrix to transform a texture view with camera preview to upright orientation and to correct its aspect ratiovoid
setMinImageArea(int minImageArea)
Set minimum area (width x height in pixels) of images the camera should collect
-
-
-
Method Detail
-
getInstance
public static CameraPreviewHelper getInstance()
- Returns:
- Singleton instance of `CameraPreviewHelper`
- Since:
- 2.4.0
-
getMinImageArea
public int getMinImageArea()
- Returns:
- Minimum area (width x height in pixels) of images collected by the camera
- Since:
- 2.5.0
-
setMinImageArea
public void setMinImageArea(int minImageArea)
Set minimum area (width x height in pixels) of images the camera should collect- Parameters:
minImageArea
- Area (width x height in pixels)- Since:
- 2.5.0
-
getViewTransformMatrix
public android.graphics.Matrix getViewTransformMatrix(int imageWidth, int imageHeight, int viewWidth, int viewHeight, int sensorOrientation, int deviceRotation)
Get matrix to transform a texture view with camera preview to upright orientation and to correct its aspect ratio- Parameters:
imageWidth
- Camera image widthimageHeight
- Camera image heightviewWidth
- Width of the view containing the camera preview textureviewHeight
- Height of the view containing the camera preview texturesensorOrientation
- Camera sensor orientation relative to the device held uprightdeviceRotation
- Rotation of the device- Returns:
- Matrix
- Since:
- 2.4.0
-
getCorrectedTextureSize
public android.util.Size getCorrectedTextureSize(int imageWidth, int imageHeight, int viewWidth, int viewHeight, int sensorOrientation, int deviceRotation)
Get camera preview texture size corrected to match the device and camera sensor orientation- Parameters:
imageWidth
- Width of the image obtained from the cameraimageHeight
- Height of the image obtained from the cameraviewWidth
- Width of the texture containing the camera previewviewHeight
- Height of the texture containing the camera previewsensorOrientation
- Camera sensor orientationdeviceRotation
- Device rotation- Returns:
- Size
- Since:
- 2.4.0
-
getOutputSizes
public android.util.Size[] getOutputSizes(android.util.Size[] previewSizes, android.util.Size[] imageReaderSizes, android.util.Size[] videoSizes, int viewWidth, int viewHeight, int sensorRotation, int deviceRotation)
Select a set of camera output sizes- Parameters:
previewSizes
- Preview size candidatesimageReaderSizes
- Image reader size candidatesvideoSizes
- Video size candidatesviewWidth
- Width of the view containing the camera previewviewHeight
- Height of the view containing the camera previewsensorRotation
- Camera sensor rotation in degreesdeviceRotation
- Device rotation- Returns:
- Set of output sizes best matching the view size
- Since:
- 2.4.0
-
-