Background Processing for Ecam

This topic describes how to capture an image using standalone background processing in Ecam.

Before you start you should understand the Onboard Camera Overview topic.

The Ecam API has been extended for background processing by having it as a standalone process. In order to use standalone background processing you need to implement the MCameraObserver2, MPreImageCaptureControlObserver, MCaptureImageObserver interfaces and use with the CCamera API.


  1. To prepare image capturing using the CCamera API
    1. call CCameraPreImageCaptureControl::GetSupportedProcessingOptionsL(Tint&) to get support for processing specified by TECamProcessingTypes.

    2. pass the EECamBackgroundProcessing option instead of the SetImageProcessingOptions value within the TPrepareImageParameters values to the required processing option specified in TECamProcessingOptions for the background processing.

    3. call CCameraPreImageCaptureControl::PrepareImageCapture(const CCameraPreImageCaptureControl:: TPrepareImageParameters&, MCaptureImageObserver&) to perform setup and allocation of memory for the image capture operation. This implementation creates a new CCameraImageCapture() object which internally implements the MCameraImageCapture() interface. If an error occurs while preparing an image, call CCameraPreImageCaptureControl::PrepareImageComplete(CCameraPreImageCaptureControl*, TInt) to pass the aErrorCode value to CCamera.

  2. Call CCameraImageCapture::CaptureImage() to capture an image. This implements MCameraImageCapture().

  3. Call CCameraPostImageCaptureControl::CreateL(CCameraImageCapture*, TPostCaptureControlId) if you wish to capture another image. The CCameraPostImageCaptureControl object from the previous capture is preserved. This callback function creates a CCameraPostImageCaptureControl object for every individual image captured.

  4. Call MCaptureImageObserver::IndividualImageControlHandle(CCameraImageCapture&, TPostCaptureControlId) to destroy the individual captured image.

  5. Call CCameraPostImageCaptureControl::~CCameraPostImageCaptureControl() to destroy any captured image objects created by CCameraPostImageCaptureControl::CreateL().

  6. Call CCameraImageCapture::PauseProcessing(TUint) to pause any processing options associated with the relevant image capture function. Note: You can call PauseProcessing() for any processing options used during image capture.

  7. Call CCameraImageCapture::ResumeProcessingL(TUint) to resume any processing options associated with the relevant image capture function. Note: You can call ResumeProcessingL() for any processing options used during image capture.

  8. Call CCameraPostImageCaptureControl::GetImageStateL(TImageState&) to retrieve the image state of the individual image given by the CCameraPostImageCaptureControl object.

Example

The following example shows you how to capture an image using standalone background processing in Ecam:



CCamera* camera; 
MCameraObserver2* observer2; 
camera = CCamera::New2L(*observer2, 0);
MPreImageCaptureControlObserver* preImageCaptureControlObserver;
CCamera::CCameraPreImageCaptureControl* preImgCapture = CCamera::CCameraPreImageCaptureControl::NewL(*camera, preImageCaptureControlObserver));
TInt supportedProcessingOptions;
preImgCapture->GetSupportedProcessingOptionsL(supportedProcessingOptions); // provides supported image processing options
CCamera::CCameraPreImageCaptureControl::TPrepareImageParameters prepareImageParameters;
prepareImageParameters::iImageProcessingOptions = EECamBackgroundProcessing;
...
...
// Capture image
...
...
TUint processingOptions = EECamBackgroundProcessing;
imgCapture->PauseProcessing(processingOptions); // Pauses any background processing associated with this image capture
imgCapture->ResumeProcessingL(processingOptions); // Resumes any background processing associated with this image capture

 //  Retrieve the information for any stage of captured image. 
TImageState imgState;
postImgCapture->GetImageStateL(imgState); // Retrieves the stage of any processing on the current image


Related concepts