Kofax Mobile SDK API Reference
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ImageCaptureView Class Reference
Inheritance diagram for ImageCaptureView:
BarCodeCaptureView LicenseCaptureView

Public Member Functions

 ImageCaptureView (Context context)
 
 ImageCaptureView (Context context, AttributeSet set)
 
 ImageCaptureView (Context context, AttributeSet set, int defStyle)
 
final int getImagePreviewWidth ()
 
final int getImagePreviewHeight ()
 
ViewGroup getViewGroup ()
 
final Flash getFlash ()
 
final void setFlash (Flash flash)
 
final boolean isFlashSupported (Flash flash)
 
final GpsUsageLimits getGpsUsage ()
 
final void setGpsUsage (GpsUsageLimits limits)
 
final void setCameraType (CameraType cameraType)
 
final void setImageResolution (Size resolution)
 
final List< SizegetAllowableImageResolutions ()
 
final List< Rect > getFocusAreas ()
 
final void setFocusAreas (List< Rect > focusAreas) throws KmcRuntimeException
 
final int getMaxFocusAreas ()
 
final boolean getUseVideoFrame ()
 
final void setUseVideoFrame (boolean useVideo)
 
final int getDeviceDeclinationPitch ()
 
final void setDeviceDeclinationPitch (int angle)
 
final int getDeviceDeclinationRoll ()
 
final void setDeviceDeclinationRoll (int angle)
 
final int getLuminanceThreshold ()
 
final void setLuminanceThreshold (int luminanceThreshold)
 
final int getTorchDelay ()
 
final void setTorchDelay (int torchDelay)
 
final void muteAutoTorch ()
 
final void unmuteAutoTorch ()
 
final void forceTakePicture ()
 
final void forceTakePicture (boolean focusAgain)
 
final synchronized void sessionCreate ()
 
final synchronized void sessionDismiss ()
 
final void addOnAutoFocusResultListener (AutoFocusResultListener listener)
 
final void removeOnAutoFocusResultListener (AutoFocusResultListener listener)
 
final void addOnImageCapturedListener (ImageCapturedListener listener)
 
final void removeOnImageCapturedListener (ImageCapturedListener listener)
 
final void addStabilityDelayListener (StabilityDelayListener listener)
 
final void removeStabilityDelayListener (StabilityDelayListener listener)
 
final void addLevelnessListener (LevelnessListener listener)
 
final void removeLevelnessListener (LevelnessListener listener)
 
final void addCameraInitializationListener (CameraInitializationListener listener)
 
final void removeCameraInitializationListener (CameraInitializationListener listener)
 
final void addCameraInitializationFailedListener (CameraInitializationFailedListener listener)
 
final void removeCameraInitializationFailedListener (CameraInitializationFailedListener listener)
 
final void addPreviewCallbackListener (PreviewCallbackListener listener)
 
final void removePreviewCallbackListener (PreviewCallbackListener listener)
 
final void addTorchLuminanceListener (TorchLuminanceListener listener)
 
final void removeTorchLuminanceListener (TorchLuminanceListener listener)
 
void removeAllViews ()
 
void surfaceChanged (SurfaceHolder holder, int format, int width, int height)
 
void surfaceCreated (SurfaceHolder holder)
 
void surfaceDestroyed (SurfaceHolder holder)
 

Static Public Attributes

static final int DEFAULT_LUMINANCE_THRESHOLD = 100
 
static final int DEFAULT_TORCH_DELAY = 3
 

Protected Member Functions

void checkLicense ()
 
void onLayout (boolean changed, int l, int t, int r, int b)
 
void onDetachedFromWindow ()
 
void onAttachedToWindow ()
 

Protected Attributes

IBus _bus
 

Detailed Description

This class is responsible for rendering the camera preview.

Constructor & Destructor Documentation

ImageCaptureView ( Context  context)
ImageCaptureView ( Context  context,
AttributeSet  set 
)
ImageCaptureView ( Context  context,
AttributeSet  set,
int  defStyle 
)

Member Function Documentation

final void addCameraInitializationFailedListener ( CameraInitializationFailedListener  listener)
final void addCameraInitializationListener ( CameraInitializationListener  listener)
final void addLevelnessListener ( LevelnessListener  listener)
final void addOnAutoFocusResultListener ( AutoFocusResultListener  listener)
final void addOnImageCapturedListener ( ImageCapturedListener  listener)
final void addPreviewCallbackListener ( PreviewCallbackListener  listener)
final void addStabilityDelayListener ( StabilityDelayListener  listener)
final void addTorchLuminanceListener ( TorchLuminanceListener  listener)
void checkLicense ( )
protected
final void forceTakePicture ( )

Description: Forces capturing an image. Calling this method will ignore other capture constraints. This is equivalent to calling forceTakePicture(false);

NOTE: Capture will not take place while an autofocus cycle is running, but will happen once it completes, whether the camera is in focus or not.

final void forceTakePicture ( boolean  focusAgain)

Description: Forces capturing an image after an optional additional autofocus cycle. Calling this method will ignore other capture constraints.

NOTE: Capture will not take place while an autofocus cycle is running, but will happen once it completes, whether the camera is in focus or not.

final List<Size> getAllowableImageResolutions ( )

Returns a list of supported resolutions for image capture.

The list of resolutions returned may differ depending on the value of getUseVideoFrame()

Note: This list may be different from that returned by StreamConfigurationMap methods (Camera2 API) or Camera.Parameters methods: getSupportedPictureSizes() or getSupportedPreviewSizes()

Note: There can be resolutions returned that cannot be used if the value of getUseVideoFrame() is changed

This method should not be called until after the CameraInitializationEvent is fired.

Returns
All allowable image capture resolutions.
See also
android.hardware.Camera.getParameters().getSupportedPictureSizes()
android.hardware.Camera.getParameters().getSupportedPreviewSizes()
StreamConfigurationMap
setImageResolution(Size)
setUseVideoFrame(boolean)
getUseVideoFrame()
final int getDeviceDeclinationPitch ( )

Description: Returns the pitch angle that the Capture Control considers to be level.

Returns
An integer between -180 and 180
final int getDeviceDeclinationRoll ( )

Description: Returns the roll angle that the Capture Control considers to be level.

Returns
An integer between -180 and 180
final Flash getFlash ( )

This method should not be called until after the CameraInitializationEvent is fired.

Returns
A Flash value
See also
setFlash(Flash)
final List<Rect> getFocusAreas ( )

Gets the current focus areas

Before using this API or setFocusAreas, apps should first call getMaxFocusAreas to know the maximum number of focus areas. If the value returned is 0, focus areas is not supported.

Focus area weight is set to 1000.

This method should not be called until after the CameraInitializationEvent is fired.

Returns
The set list of FocusAreas
See also
setFocusAreas
final GpsUsageLimits getGpsUsage ( )
final int getImagePreviewHeight ( )

Description: Returns the height of the camera preview resolution. This property is read-only, and is automatically set to the resolution that will best fit the width and height of the ImageCaptureControl.

This method should not be called until after the CameraInitializationEvent is fired.

Returns
Camera resolution height
See also
getImagePreviewHeight()
final int getImagePreviewWidth ( )

Description: Returns the width of the camera preview resolution. This property is read-only, and is automatically set to the resolution that will best fit the width and height of the ImageCaptureControl.

This method should not be called until after the CameraInitializationEvent is fired.

Returns
Camera resolution width
See also
getImagePreviewWidth()
final int getLuminanceThreshold ( )

Returns the luminance level at which the torch activates when Flash is set to AUTOTORCH. Luminance level is a measure of the brightness of the color in the image. When the detected luminance level falls below this threshold property, the torch may be activated, depending on the torch delay property. The default value of this property is 100.

Android only.

Returns
The current luminance threshold
See also
setLuminanceThreshold(int)
getTorchDelay()
setTorchDelay(int)
final int getMaxFocusAreas ( )

Returns the device's maximum number of focusable areas.

This method should not be called until after the CameraInitializationEvent is fired.

Returns
The maximum number of supported focus areas, or 0 if unsupported
See also
setFocusAreas(List<Rect>)
getFocusAreas()
final int getTorchDelay ( )

Returns the delay that controls when the torch activates when Flash is set to AUTOTORCH. This delay specifies the number of consecutive times the detected luminance must be below the configured threshold before activating the torch. The default value of this property is 3.

Android only.

Returns
The current torch delay
See also
setTorchDelay(int)
getLuminanceThreshold()
setLuminanceThreshold(int)
final boolean getUseVideoFrame ( )

Whether the control is using the video frame as the captured image

See also
setUseVideoFrame
ViewGroup getViewGroup ( )
final boolean isFlashSupported ( Flash  flash)
final void muteAutoTorch ( )

When Flash is set to AUTOTORCH, the app can temporarily prevent the torch from lighting by calling this method. This might be necessary if you are attempting to capture a laminated document and activating the torch creates glare. This method can also be called when the torch is lit (via AUTOTORCH) to turn torch off and prevent it from lighting again.

Android only.

See also
unmuteAutoTorch()
void onAttachedToWindow ( )
protected
void onDetachedFromWindow ( )
protected
void onLayout ( boolean  changed,
int  l,
int  t,
int  r,
int  b 
)
protected

Layout our children

void removeAllViews ( )
final void removeCameraInitializationFailedListener ( CameraInitializationFailedListener  listener)
final void removeCameraInitializationListener ( CameraInitializationListener  listener)
final void removeLevelnessListener ( LevelnessListener  listener)
final void removeOnAutoFocusResultListener ( AutoFocusResultListener  listener)
final void removeOnImageCapturedListener ( ImageCapturedListener  listener)
final void removePreviewCallbackListener ( PreviewCallbackListener  listener)
final void removeStabilityDelayListener ( StabilityDelayListener  listener)
final void removeTorchLuminanceListener ( TorchLuminanceListener  listener)
final synchronized void sessionCreate ( )
final synchronized void sessionDismiss ( )
final void setCameraType ( CameraType  cameraType)

Sets the desire camera type for image capture view. The default cameraType will be BACK_CAMERA.

Parameters
cameraTypethe camera type.
See also
CameraType
final void setDeviceDeclinationPitch ( int  angle)

Description: Sets the pitch declination of the device, which affects how far it must be tilted along the y axis of the phone in order to be considered level. By default, this is set to 0, which is considered to be the levelness of a device laying flat on its back and facing upwards.

Parameters
angleAn integer value between -180 and 180.
final void setDeviceDeclinationRoll ( int  angle)

Description: Sets the roll declination of the device, which affects how far it must be tilted along the x axis of the phone in order to be considered level. By default, this is set to 0, which is considered to be the levelness of a device laying flat on its back and facing upwards.

Parameters
angleAn integer value between -180 and 180.
final void setFlash ( Flash  flash)

This method will attempt to set the camera flash mode to the mode specified. It polls the camera for the flash modes the hardware allows; if the flash parameter given is not included in the supported flash modes, this method will throw an exception.

This method must not be called until after the CameraInitializationEvent is fired. An IllegalStateException is thrown if this method is called when the camera is not open.

Parameters
flashA Flash enum that corresponds to various flash modes
See also
getFlash()
final void setFocusAreas ( List< Rect >  focusAreas) throws KmcRuntimeException

Sets the focus areas for the control.

Before using this API or getFocusAreas, apps should first call getMaxFocusAreas to know the maximum number of focus areas. If the value returned is 0, focus areas is not supported.

Image capture focus area bounds have valid values (0,0) to a maximum of (viewWidth, viewHeight) which are then translated to valid Android focus area coordinates.

When a focus area is set that has bounds outside of the view bounds the focus area rectangle will be clamped to the nearest valid view bound.

The width and height of focus areas cannot be 0 or negative. Any Rect in the list passed in must follow the left < right, and top < bottom rule or a KmcRuntimeException will be thrown as this is an invalid focus area Rect.

A Rect in the list will also need to have a sufficient area to provide the underlying camera autofocus algorithm enough information to focus on that area. Creating a Rect that has width and height that is between 5-10% of the width and height of the preview view size is recommended. When the Rect area is too small it is likely, but this is highly device dependent, that the camera will use the entire view as the focus area.

This method should not be called until after the CameraInitializationEvent is fired.

Parameters
focusAreasA list of Rect objects representing the desired focus areas
Exceptions
KmcRuntimeExceptionIf invalid Rect
See also
getFocusAreas
final void setGpsUsage ( GpsUsageLimits  limits)

Description: Calling this with a value of GpsUsageLimits#ALWAYS_USE_IF_ENABLED will cause the control to embed GPS coordinates in the captured image if Location Services are enabled. A value of GpsUsageLimits#NEVER_USE will prevent the inclusion of GPS coordinates in captured images, regardless of the availability of Location Services.

Defaults to GpsUsageLimits#ALWAYS_USE_IF_ENABLED.

See also
getGpsUsage()
final void setImageResolution ( Size  resolution)

Sets the desired resolution for image capture. The actual resolution of a captured image may be reversed from what is given (e.g. a 960x1280 image may be returned for a 1280x960 request).

The resolution parameter must be one of the given resolutions returned from getAllowableImageResolutions()

After calling this method, the ImageCaptureView instance may resize itself.

This method should not be called until after the CameraInitializationEvent is fired.

Parameters
resolutiona Size, one of those returned by getAllowableImageResolutions()
See also
getAllowableImageResolutions()
setUseVideoFrame(boolean)
final void setLuminanceThreshold ( int  luminanceThreshold)

This method sets the luminance level (> 0) at which the torch activates when Flash is set to AUTOTORCH. Luminance level is a measure of the brightness of the color in the image. When the detected luminance level falls below this threshold property, the torch may be activated, depending on the torch delay property. The default value of this property is 100.

Android only.

Parameters
luminanceThresholdAn integer that specifies the luminance threshold
See also
getLuminanceThreshold()
getTorchDelay()
setTorchDelay(int)
final void setTorchDelay ( int  torchDelay)

This method sets the delay (> 0) that controls when the torch activates when Flash is set to AUTOTORCH. This delay specifies the number of consecutive times the detected luminance must be below the configured threshold before activating the torch. The default value of this property is 3.

Android only.

Parameters
torchDelayAn integer that specifies the delay
See also
getTorchDelay()
getLuminanceThreshold()
setLuminanceThreshold(int)
final void setUseVideoFrame ( boolean  useVideo)

Description: Calling this with a value of true will cause the control to return the video frame when takePicture() is called, or when requirements are met. The video frame will normally be of lower resolution and may not be appropriate for image processing.

Defaults to false.

Parameters
useVideowhether to use preview frames for capture or not
See also
getUseVideoFrame()
void surfaceChanged ( SurfaceHolder  holder,
int  format,
int  width,
int  height 
)
void surfaceCreated ( SurfaceHolder  holder)
void surfaceDestroyed ( SurfaceHolder  holder)
final void unmuteAutoTorch ( )

When Flash is set to AUTOTORCH, the app can temporarily prevent the torch from lighting by calling muteAutoTorch(). Call this method to revert the auto torch functionality to configured behavior.

Android only.

See also
muteAutoTorch()

Member Data Documentation

IBus _bus
protected
final int DEFAULT_LUMINANCE_THRESHOLD = 100
static
final int DEFAULT_TORCH_DELAY = 3
static

The documentation for this class was generated from the following file:
Untitled Document © 2018 Kofax, Inc. All rights reserved. Use is subject to license terms.