Creating Histograms

This document introduces how to create a histogram.

Purpose

This document describes the various APIs used to create a Histogram.

Introduction

You can request histograms for image capture, video capture and viewfinder separately or you can combine viewfinder functionality with image or video capture. Histograms provide information about the exposure of light on a captured frame.

The key classes are described in Histogram Overview .

Creating a Histogram

You can create instance of a histogram class from the following class objects:

  • snapshot

  • image capture

  • video capture

  • version2 direct viewfinder

  • client viewfinder

This provides better handling of histogram features by tying it closely to the given object.

Note :

Client is not allowed to create object of this class directly.

Setup and Configuration Requirements

The following are the setup and configuration requirements you need to follow before Histogram implementation:

  • Licensees need to provide the implementation of CcameraV2Histogram and MCameraV2Histogram class for the camera v2 histogram.

  • Clients need to provide the interfaces: McaptureImageObserver , McaptureVideoObserver , MdirectViewFinderObserver and MclientViewFinderObserver to receive notifications about direct histogram display or client histogram data availability.

Note :

McameraObserver2::HandleEvent will not be used with this class.

Basic Procedure for Creating Histograms

The high level steps to create a histogram are shown here:

  • Create a new camera histogram object using CCamera::CCameraV2Histogram class. This class allows the client to get histogram data in a specified format for an image. For example, luminance based histogram, average colour value histogram and so on.

  • This class maps the exported call to a method of mixin class MCameraV2Histogram , which provides the camera version 2 histogram functionality.

  • Pass a pointer to object of type MCameraV2Histogram to the CCameraV2Histogram object by the owning camera during the construction phase.

  • Obtain this pointer using a call to Ccamera::CustomInterface() with UID value KECamMCameraHistogramUid .

  • List the type of histograms supported by the camera using GetSupportedHistogramsL() API.

  • Check if direct histogram is supported using GetDirectHistogramSupportInfoL() API.

  • Create a request to prepare a direct or client based histogram using PrepareDirectHistogramL() or CCameraV2Histogram::PrepareClientHistogramL() APIs appropriately.

Example

The following example illustrates the sequence for creating a histogram:

  1. The following creates the new camera histogram object.

             
              
             
             CCamera* camera;//exists beforehand
    CCamera::CCameraClientViewFinder* clientVF;//exists beforehand
    MCameraObserver* observer2;//exists beforehand
    clientVF  = CCamera::CCameraClientViewFinder::NewL(*camera, *clientVFObserver);    
    CCamera::CCameraV2Histogram* histogram_CVF = clientVF->CreateHistogramHandleL();
            
  2. Find out about the supported set of values.

             
              
             
             TUint supportedHistogramType=0;
    histogram_CVF->GetSupportedHistogramsL(supportedHistogramType);
            

    Get the information about direct histograms.

             
              
             
             TBool directHistogramSupported = EFalse;
    histogram_CVF->GetDirectHistogramSupportInfoL(directHistogramSupported);
            
  3. Prepare the selected or available histogram.

    • direct access

                 
                  
                 
                 Camera::CCameraV2Histogram::TDirectHistogramParameters histogramParameters;
      histogram_CVF->PrepareDirectHistogramL(histogramParameters);
                
    • non direct access

                 
                  
                 
                 CCamera::CCameraV2Histogram::THistogramType histogramType = CCamera::CCameraV2Histogram::Eluminance;
      histogram_CVF->PrepareClientHistogramL(histogramType);