-
public class UVCCamera
-
-
Field Summary
Fields Modifier and Type Field Description public final static intDEFAULT_PREVIEW_WIDTHpublic final static intDEFAULT_PREVIEW_HEIGHTpublic final static intDEFAULT_PREVIEW_MODEpublic final static intDEFAULT_PREVIEW_MIN_FPSpublic final static intDEFAULT_PREVIEW_MAX_FPSpublic final static floatDEFAULT_BANDWIDTHpublic final static intFRAME_FORMAT_YUYVpublic final static intFRAME_FORMAT_MJPEGpublic final static intPIXEL_FORMAT_RAWpublic final static intPIXEL_FORMAT_YUVpublic final static intPIXEL_FORMAT_RGB565public final static intPIXEL_FORMAT_RGBXpublic final static intPIXEL_FORMAT_YUV420SPpublic final static intPIXEL_FORMAT_NV21public final static intCTRL_SCANNINGpublic final static intCTRL_AEpublic final static intCTRL_AE_PRIORITYpublic final static intCTRL_AE_ABSpublic final static intCTRL_AR_RELpublic final static intCTRL_FOCUS_ABSpublic final static intCTRL_FOCUS_RELpublic final static intCTRL_IRIS_ABSpublic final static intCTRL_IRIS_RELpublic final static intCTRL_ZOOM_ABSpublic final static intCTRL_ZOOM_RELpublic final static intCTRL_PANTILT_ABSpublic final static intCTRL_PANTILT_RELpublic final static intCTRL_ROLL_ABSpublic final static intCTRL_ROLL_RELpublic final static intCTRL_FOCUS_AUTOpublic final static intCTRL_PRIVACYpublic final static intCTRL_FOCUS_SIMPLEpublic final static intCTRL_WINDOWpublic final static intPU_BRIGHTNESSpublic final static intPU_CONTRASTpublic final static intPU_HUEpublic final static intPU_SATURATIONpublic final static intPU_SHARPNESSpublic final static intPU_GAMMApublic final static intPU_WB_TEMPpublic final static intPU_WB_COMPOpublic final static intPU_BACKLIGHTpublic final static intPU_GAINpublic final static intPU_POWER_LFpublic final static intPU_HUE_AUTOpublic final static intPU_WB_TEMP_AUTOpublic final static intPU_WB_COMPO_AUTOpublic final static intPU_DIGITAL_MULTpublic final static intPU_DIGITAL_LIMITpublic final static intPU_AVIDEO_STDpublic final static intPU_AVIDEO_LOCKpublic final static intPU_CONTRAST_AUTOpublic final static intSTATUS_CLASS_CONTROLpublic final static intSTATUS_CLASS_CONTROL_CAMERApublic final static intSTATUS_CLASS_CONTROL_PROCESSINGpublic final static intSTATUS_ATTRIBUTE_VALUE_CHANGEpublic final static intSTATUS_ATTRIBUTE_INFO_CHANGEpublic final static intSTATUS_ATTRIBUTE_FAILURE_CHANGEpublic final static intSTATUS_ATTRIBUTE_UNKNOWN
-
Constructor Summary
Constructors Constructor Description UVCCamera()the sonctructor of this class should be call within the thread that has a looper(UI thread or a thread that called Looper.
-
Method Summary
Modifier and Type Method Description synchronized voidopen(USBMonitor.UsbControlBlock ctrlBlock)connect to a UVC cameraUSB permission is necessary before this method is called voidsetStatusCallback(IStatusCallback callback)set status callback voidsetButtonCallback(IButtonCallback callback)set button callback synchronized voidclose()close and release UVC camera UsbDevicegetDevice()StringgetDeviceName()USBMonitor.UsbControlBlockgetUsbControlBlock()synchronized StringgetSupportedSize()SizegetPreviewSize()voidsetPreviewSize(int width, int height)Set preview size and preview mode voidsetPreviewSize(int width, int height, int frameFormat)Set preview size and preview mode voidsetPreviewSize(int width, int height, int frameFormat, float bandwidth)Set preview size and preview mode voidsetPreviewSize(int width, int height, int min_fps, int max_fps, int frameFormat, float bandwidthFactor)Set preview size and preview mode List<Size>getSupportedSizeList()static List<Size>getSupportedSize(int type, String supportedSize)synchronized voidsetPreviewDisplay(SurfaceHolder holder)set preview surface with SurfaceHolderyou can use SurfaceHolder came from SurfaceView/GLSurfaceView synchronized voidsetPreviewTexture(SurfaceTexture texture)set preview surface with SurfaceTexture. synchronized voidsetPreviewDisplay(Surface surface)set preview surface with Surface voidsetFrameCallback(IFrameCallback callback, int pixelFormat)set frame callback synchronized voidstartPreview()start preview synchronized voidstopPreview()stop preview synchronized voiddestroy()destroy UVCCamera object booleancheckSupportFlag(long flag)synchronized voidsetAutoFocus(boolean autoFocus)synchronized booleangetAutoFocus()synchronized voidsetFocus(int focus)synchronized intgetFocus(int focus_abs)synchronized intgetFocus()synchronized voidresetFocus()synchronized voidsetAutoWhiteBlance(boolean autoWhiteBlance)synchronized booleangetAutoWhiteBlance()synchronized voidsetWhiteBlance(int whiteBlance)synchronized intgetWhiteBlance(int whiteBlance_abs)synchronized intgetWhiteBlance()synchronized voidresetWhiteBlance()synchronized voidsetBrightness(int brightness)synchronized intgetBrightness(int brightness_abs)synchronized intgetBrightness()synchronized voidresetBrightness()synchronized voidsetContrast(int contrast)synchronized intgetContrast(int contrast_abs)synchronized intgetContrast()synchronized voidresetContrast()synchronized voidsetSharpness(int sharpness)synchronized intgetSharpness(int sharpness_abs)synchronized intgetSharpness()synchronized voidresetSharpness()synchronized voidsetGain(int gain)synchronized intgetGain(int gain_abs)synchronized intgetGain()synchronized voidresetGain()synchronized voidsetGamma(int gamma)synchronized intgetGamma(int gamma_abs)synchronized intgetGamma()synchronized voidresetGamma()synchronized voidsetSaturation(int saturation)synchronized intgetSaturation(int saturation_abs)synchronized intgetSaturation()synchronized voidresetSaturation()synchronized voidsetHue(int hue)synchronized intgetHue(int hue_abs)synchronized intgetHue()synchronized voidresetHue()voidsetPowerlineFrequency(int frequency)intgetPowerlineFrequency()synchronized voidsetZoom(int zoom)this may not work well with some combination of camera and device synchronized intgetZoom(int zoom_abs)synchronized intgetZoom()synchronized voidresetZoom()synchronized voidupdateCameraParams()voidstartCapture(Surface surface)start movie capturing(this should call while previewing) voidstopCapture()stop movie capturing -
-
Method Detail
-
open
synchronized void open(USBMonitor.UsbControlBlock ctrlBlock)
connect to a UVC cameraUSB permission is necessary before this method is called
-
setStatusCallback
void setStatusCallback(IStatusCallback callback)
set status callback
-
setButtonCallback
void setButtonCallback(IButtonCallback callback)
set button callback
-
close
synchronized void close()
close and release UVC camera
-
getDeviceName
String getDeviceName()
-
getUsbControlBlock
USBMonitor.UsbControlBlock getUsbControlBlock()
-
getSupportedSize
synchronized String getSupportedSize()
-
getPreviewSize
Size getPreviewSize()
-
setPreviewSize
void setPreviewSize(int width, int height)
Set preview size and preview mode
-
setPreviewSize
void setPreviewSize(int width, int height, int frameFormat)
Set preview size and preview mode
- Parameters:
frameFormat- either FRAME_FORMAT_YUYV(0) or FRAME_FORMAT_MJPEG(1)
-
setPreviewSize
void setPreviewSize(int width, int height, int frameFormat, float bandwidth)
Set preview size and preview mode
- Parameters:
frameFormat- either FRAME_FORMAT_YUYV(0) or FRAME_FORMAT_MJPEG(1)bandwidth- [0.0f,1.
-
setPreviewSize
void setPreviewSize(int width, int height, int min_fps, int max_fps, int frameFormat, float bandwidthFactor)
Set preview size and preview mode
- Parameters:
frameFormat- either FRAME_FORMAT_YUYV(0) or FRAME_FORMAT_MJPEG(1)
-
getSupportedSizeList
List<Size> getSupportedSizeList()
-
getSupportedSize
static List<Size> getSupportedSize(int type, String supportedSize)
-
setPreviewDisplay
synchronized void setPreviewDisplay(SurfaceHolder holder)
set preview surface with SurfaceHolderyou can use SurfaceHolder came from SurfaceView/GLSurfaceView
-
setPreviewTexture
synchronized void setPreviewTexture(SurfaceTexture texture)
set preview surface with SurfaceTexture.this method require API >= 14
-
setPreviewDisplay
synchronized void setPreviewDisplay(Surface surface)
set preview surface with Surface
-
setFrameCallback
void setFrameCallback(IFrameCallback callback, int pixelFormat)
set frame callback
-
startPreview
synchronized void startPreview()
start preview
-
stopPreview
synchronized void stopPreview()
stop preview
-
destroy
synchronized void destroy()
destroy UVCCamera object
-
checkSupportFlag
boolean checkSupportFlag(long flag)
-
setAutoFocus
synchronized void setAutoFocus(boolean autoFocus)
-
getAutoFocus
synchronized boolean getAutoFocus()
-
setFocus
synchronized void setFocus(int focus)
- Parameters:
focus- [%]
-
getFocus
synchronized int getFocus(int focus_abs)
-
getFocus
synchronized int getFocus()
-
resetFocus
synchronized void resetFocus()
-
setAutoWhiteBlance
synchronized void setAutoWhiteBlance(boolean autoWhiteBlance)
-
getAutoWhiteBlance
synchronized boolean getAutoWhiteBlance()
-
setWhiteBlance
synchronized void setWhiteBlance(int whiteBlance)
- Parameters:
whiteBlance- [%]
-
getWhiteBlance
synchronized int getWhiteBlance(int whiteBlance_abs)
-
getWhiteBlance
synchronized int getWhiteBlance()
-
resetWhiteBlance
synchronized void resetWhiteBlance()
-
setBrightness
synchronized void setBrightness(int brightness)
- Parameters:
brightness- [%]
-
getBrightness
synchronized int getBrightness(int brightness_abs)
-
getBrightness
synchronized int getBrightness()
-
resetBrightness
synchronized void resetBrightness()
-
setContrast
synchronized void setContrast(int contrast)
- Parameters:
contrast- [%]
-
getContrast
synchronized int getContrast(int contrast_abs)
-
getContrast
synchronized int getContrast()
-
resetContrast
synchronized void resetContrast()
-
setSharpness
synchronized void setSharpness(int sharpness)
- Parameters:
sharpness- [%]
-
getSharpness
synchronized int getSharpness(int sharpness_abs)
-
getSharpness
synchronized int getSharpness()
-
resetSharpness
synchronized void resetSharpness()
-
setGain
synchronized void setGain(int gain)
- Parameters:
gain- [%]
-
getGain
synchronized int getGain(int gain_abs)
-
getGain
synchronized int getGain()
-
resetGain
synchronized void resetGain()
-
setGamma
synchronized void setGamma(int gamma)
- Parameters:
gamma- [%]
-
getGamma
synchronized int getGamma(int gamma_abs)
-
getGamma
synchronized int getGamma()
-
resetGamma
synchronized void resetGamma()
-
setSaturation
synchronized void setSaturation(int saturation)
- Parameters:
saturation- [%]
-
getSaturation
synchronized int getSaturation(int saturation_abs)
-
getSaturation
synchronized int getSaturation()
-
resetSaturation
synchronized void resetSaturation()
-
setHue
synchronized void setHue(int hue)
- Parameters:
hue- [%]
-
getHue
synchronized int getHue(int hue_abs)
-
getHue
synchronized int getHue()
-
resetHue
synchronized void resetHue()
-
setPowerlineFrequency
void setPowerlineFrequency(int frequency)
-
getPowerlineFrequency
int getPowerlineFrequency()
-
setZoom
synchronized void setZoom(int zoom)
this may not work well with some combination of camera and device
- Parameters:
zoom- [%]
-
getZoom
synchronized int getZoom(int zoom_abs)
-
getZoom
synchronized int getZoom()
-
resetZoom
synchronized void resetZoom()
-
updateCameraParams
synchronized void updateCameraParams()
-
startCapture
void startCapture(Surface surface)
start movie capturing(this should call while previewing)
-
stopCapture
void stopCapture()
stop movie capturing
-
-
-
-