public class CameraUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CameraUtils.CameraFacing
摄像头方向
|
static class |
CameraUtils.PreviewSize |
| Constructor and Description |
|---|
CameraUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
chooseFixedPreviewFps(android.hardware.Camera.Parameters parms,
int desiredThousandFps)
Attempts to find a fixed preview frame rate that matches the desired frame rate.
|
static void |
choosePreviewSize(android.hardware.Camera.Parameters parms,
int width,
int height)
Attempts to find a preview size that matches the provided width and height (which
specify the dimensions of the encoded video).
|
static int |
clamp(int x,
int min,
int max) |
static int[] |
getMaxFrameRateRange(android.hardware.Camera.Parameters params) |
static CameraUtils.PreviewSize |
getSpecialCameraPreviewSizeWithModel(java.lang.String model,
android.hardware.Camera.Size size,
CameraUtils.CameraFacing facing) |
static boolean |
isCameraAvailable(int facing) |
static boolean |
isFaceDetectionSupported(android.hardware.Camera.Parameters params) |
static boolean |
isFocusAreaSupported(android.hardware.Camera.Parameters params) |
static boolean |
isMeteringAreaSupported(android.hardware.Camera.Parameters params) |
static boolean |
isSupported(java.lang.String value,
java.util.List<java.lang.String> supported) |
static android.hardware.Camera |
openCamera(CameraUtils.CameraFacing cameraFacing)
打开摄像头
|
static android.hardware.Camera |
openCamera(CameraUtils.CameraFacing cameraFacing,
android.hardware.Camera.CameraInfo info) |
static void |
prepareMatrix(android.graphics.Matrix matrix,
boolean mirror,
int displayOrientation,
int viewWidth,
int viewHeight) |
static void |
rectFToRect(android.graphics.RectF rectF,
android.graphics.Rect rect) |
static android.hardware.Camera.Size |
selectPreferredSize(android.hardware.Camera.Parameters params,
int width,
int height) |
static void |
setCameraDisplayOrientation(android.content.Context context,
android.hardware.Camera camera,
android.hardware.Camera.CameraInfo cameraInfo) |
static void |
setCameraDisplayOrientation(int displayRotation,
android.hardware.Camera camera,
android.hardware.Camera.CameraInfo cameraInfo) |
static int |
toAndroidCameraFacing(CameraUtils.CameraFacing facing) |
public static void setCameraDisplayOrientation(android.content.Context context,
android.hardware.Camera camera,
android.hardware.Camera.CameraInfo cameraInfo)
public static void setCameraDisplayOrientation(int displayRotation,
android.hardware.Camera camera,
android.hardware.Camera.CameraInfo cameraInfo)
public static android.hardware.Camera.Size selectPreferredSize(android.hardware.Camera.Parameters params,
int width,
int height)
public static void choosePreviewSize(android.hardware.Camera.Parameters parms,
int width,
int height)
TODO: should do a best-fit match, e.g. https://github.com/commonsguy/cwac-camera/blob/master/camera/src/com/commonsware/cwac/camera/CameraUtils.java
public static int chooseFixedPreviewFps(android.hardware.Camera.Parameters parms,
int desiredThousandFps)
It doesn't seem like there's a great deal of flexibility here.
TODO: follow the recipe from http://stackoverflow.com/questions/22639336/#22645327
public static android.hardware.Camera openCamera(CameraUtils.CameraFacing cameraFacing)
cameraFacing - 正面,还是反面public static android.hardware.Camera openCamera(CameraUtils.CameraFacing cameraFacing, android.hardware.Camera.CameraInfo info)
public static CameraUtils.PreviewSize getSpecialCameraPreviewSizeWithModel(java.lang.String model, android.hardware.Camera.Size size, CameraUtils.CameraFacing facing)
public static int toAndroidCameraFacing(CameraUtils.CameraFacing facing)
public static boolean isCameraAvailable(int facing)
public static int[] getMaxFrameRateRange(android.hardware.Camera.Parameters params)
public static boolean isMeteringAreaSupported(android.hardware.Camera.Parameters params)
public static boolean isFocusAreaSupported(android.hardware.Camera.Parameters params)
public static boolean isFaceDetectionSupported(android.hardware.Camera.Parameters params)
public static boolean isSupported(java.lang.String value,
java.util.List<java.lang.String> supported)
public static int clamp(int x,
int min,
int max)
public static void rectFToRect(android.graphics.RectF rectF,
android.graphics.Rect rect)
public static void prepareMatrix(android.graphics.Matrix matrix,
boolean mirror,
int displayOrientation,
int viewWidth,
int viewHeight)