Create camera view by passing application context, dimensions of the
preview image, and specifying if emulator or device is running the
application.
- Parameters:
context
- Application contextimageCaptureComponent
- ImageCaptureComponent referencecameraIndex
- Camera index to use (only used on SDK > 8), if the index invalid, the
nearest possible index is usedwidth
- Camera preview image widthheight
- Camera preview image height
openCamera
getPreviewWidth
public int getPreviewWidth()
- Get preview image width
- Returns:
- Preview image width in pixels
getPreviewHeight
public int getPreviewHeight()
- Get preview image height
- Returns:
- Preview image height in pixels
getCamera
public Camera getCamera()
- Get Camera object
- Returns:
- Camera object
getCameraIndex
public int getCameraIndex()
- Get currently used camera index.
For SDK < 9, it is always 0
- Returns:
- Camera index
surfaceCreated
public void surfaceCreated(SurfaceHolder holder)
surfaceChanged
public void surfaceChanged(SurfaceHolder holder,
int format,
int w,
int h)
setFocusMode
public void setFocusMode(int mode)
- Set camera focus mode
- Parameters:
mode
- Focus Mode from IImageCaptureComponent- See Also:
IImageCaptureComponent
stopCamera
public void stopCamera()
- Stop camera preview and release the camera object
surfaceDestroyed
public void surfaceDestroyed(SurfaceHolder holder)
release
public void release()
- Release all the resources that view is using, this view will become
invalid after this call.
convertImageFormat
public static ECOLOR_FORMAT convertImageFormat(int imageFormat)
- Convert Android image format value to metaio image format
- Parameters:
imageFormat
- Android image format
- Returns:
- metaio SDK's internal image format
resetBuffers
public void resetBuffers()
- Create preview callback manager, this must be called inside
onSurfaceChanged so that correct preview image resolution us used to
allocate buffers
enablePreviewCallback
public void enablePreviewCallback(boolean enable)
- Enable/disable preview callback for optical tracking
- Parameters:
enable
- true to enable, false to disable
onPreviewFrame
public void onPreviewFrame(byte[] frameData,
Camera camera)
doneWithFrame
public void doneWithFrame(int index)
setPictureCallback
public void setPictureCallback(IMetaioSDKCallback callback,
String filepath,
int width,
int height)
- Set picture callback, effective immediately the callback must resume
camera preview.
The closest supported picture resolution is used.
- Parameters:
callback
- Callback to receive notification when picture is readyfilepath
- File to writewidth
- Width of the pictureheight
- Height of the picture
onAutoFocus
public void onAutoFocus(boolean success,
Camera camera)
startTorch
public void startTorch()
- Start torch mode if supported by the device
- See Also:
stopTorch
stopTorch
public void stopTorch()
- Stop torch mode
- See Also:
startTorch
onPictureTaken
public void onPictureTaken(byte[] data,
Camera camera)
onPause
public void onPause()
onResume
public void onResume()
onError
public void onError(int error,
Camera camera)