Package com.cognex.cmbsdk.cameramanager
Class CameraManager
java.lang.Object
com.cognex.cmbsdk.cameramanager.CognexCameraManager
com.cognex.cmbsdk.cameramanager.CameraManager
Represents a static CameraManager class.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.cognex.cmbsdk.cameramanager.CognexCameraManager
CognexCameraManager.CameraStateCallback -
Field Summary
FieldsModifier and TypeFieldDescriptionandroid.hardware.Camerastatic booleanFields inherited from class com.cognex.cmbsdk.cameramanager.CognexCameraManager
cameraInitialized, focusTimer, mDesiredResolution, previewing, REFOCUSING_DELAY, resources, SHOW_CAMERA_DRIVER_ERRORS_AS_TOAST, USE_FRONT_CAMERA, windowManager -
Constructor Summary
ConstructorsConstructorDescriptionCameraManager(android.view.WindowManager windowManager, android.content.res.Resources resources) -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the Camera object and releases resources.android.graphics.Pointintfloat[]android.graphics.PointintGets the maximum zoom level the Camera supports.booleanChecks torch availability.voidopenDriver(android.view.TextureView textureView, CognexCameraManager.CameraStateCallback cameraStateCallback) Invokes Camera.open and configures the Camera.voidrequestPreviewFrame(android.os.Handler handler, int message) Requests a preview frame.voidSets the camera display orientation.voidsetDesiredPreviewSize(CameraPreviewResolution cameraPreviewResolution) Select desired camera resolution.voidsetExposureCompensation(float value) voidsetTorch(boolean enabled) Turns the torch on or off.voidsetZoom(int zoom, boolean isPreviewing) Sets the Camera zoom level.voidvoidStarts the Camera Preview and starts focusing.voidvoidStops the Camera Preview and stops focusing.voidupdateCameraOrientation(int rotation) Methods inherited from class com.cognex.cmbsdk.cameramanager.CognexCameraManager
renderCroppedGreyscaleBitmap
-
Field Details
-
useBufferedCallback
public static boolean useBufferedCallback -
camera
public android.hardware.Camera camera
-
-
Constructor Details
-
CameraManager
public CameraManager(android.view.WindowManager windowManager, android.content.res.Resources resources)
-
-
Method Details
-
getMaxResolution
public android.graphics.Point getMaxResolution() -
setDesiredPreviewSize
Description copied from class:CognexCameraManagerSelect desired camera resolution. Not all devices supports all resolutions, closest available will be chosen. If not selected, closest match to screen resolution will be chosen. High resolutions will slow down scanning process on slower devices.- Overrides:
setDesiredPreviewSizein classCognexCameraManager- Parameters:
cameraPreviewResolution- desired preview resolution
-
getCurrentResolution
public android.graphics.Point getCurrentResolution()- Specified by:
getCurrentResolutionin classCognexCameraManager
-
openDriver
public void openDriver(android.view.TextureView textureView, CognexCameraManager.CameraStateCallback cameraStateCallback) throws RuntimeException Invokes Camera.open and configures the Camera.- Overrides:
openDriverin classCognexCameraManager- Parameters:
textureView- active texture view- Throws:
RuntimeException- error when camera open fails after multiple tries
-
getMaxZoom
public int getMaxZoom()Gets the maximum zoom level the Camera supports.- Specified by:
getMaxZoomin classCognexCameraManager- Returns:
- int max zoom level
-
setZoom
public void setZoom(int zoom, boolean isPreviewing) Sets the Camera zoom level.- Specified by:
setZoomin classCognexCameraManager- Parameters:
zoom- zoom level
-
isTorchAvailable
public boolean isTorchAvailable()Checks torch availability.- Specified by:
isTorchAvailablein classCognexCameraManager- Returns:
- boolean torch availability
-
setTorch
public void setTorch(boolean enabled) Turns the torch on or off.- Specified by:
setTorchin classCognexCameraManager- Parameters:
enabled- set to true to turn torch on
-
getExposureCompensationRange
public float[] getExposureCompensationRange()- Specified by:
getExposureCompensationRangein classCognexCameraManager
-
setExposureCompensation
public void setExposureCompensation(float value) - Specified by:
setExposureCompensationin classCognexCameraManager
-
closeDriver
public void closeDriver()Closes the Camera object and releases resources.- Specified by:
closeDriverin classCognexCameraManager
-
startFocusing
public void startFocusing()- Specified by:
startFocusingin classCognexCameraManager
-
stopFocusing
public void stopFocusing()- Overrides:
stopFocusingin classCognexCameraManager
-
startPreview
Starts the Camera Preview and starts focusing.- Specified by:
startPreviewin classCognexCameraManager- Throws:
RuntimeException
-
stopPreview
public void stopPreview()Stops the Camera Preview and stops focusing.- Specified by:
stopPreviewin classCognexCameraManager
-
requestPreviewFrame
public void requestPreviewFrame(android.os.Handler handler, int message) Requests a preview frame.- Specified by:
requestPreviewFramein classCognexCameraManager- Parameters:
handler- handler to send the frame tomessage- message to pass the handler
-
getDeviceDefaultOrientation
public int getDeviceDefaultOrientation() -
updateCameraOrientation
public void updateCameraOrientation(int rotation) -
setCameraDisplay
public void setCameraDisplay()Sets the camera display orientation.- Specified by:
setCameraDisplayin classCognexCameraManager
-