Home > class_c_camus.html

Home > Research Areas > Projects > Nokia CV > Documentation > class_c_camus.html

This class implements Camus algorithm for estimation of optical flow from a series of bitmaps. More...

#include <ncvCamus.h>

List of all members.


Public Types

enum TCamusOptsSize { ESmall, EMedium, ELarge }
Size alternatives to be used with runtime adjustable options of the Camus algorithm. More...

Public Member Functions


virtual IMPORT_C
~CCamus ()
Destructor.
IMPORT_C void GetOpticalFlow (COpticalFlow &aOpticalFlow, CNokiaCVImage &aImage, const TInt aCamusOpts=KDefaultCamusOpts)
Calculate optical flow for an image.
IMPORT_C void GetOpticalFlow (COpticalFlow &aOpticalFlow, const TInt aCamusOpts=KDefaultCamusOpts)
Recalculate optical flow for the previously added image.

Static Public Member Functions

static IMPORT_C CCamus * NewL (CNokiaCVImage &aImage, const TInt aHistorySize=KDefaultCamusHistorySize)
Factory method for creating an instance.

Static Protected Member Functions

static TInt GridSize (const TInt aCamusOpts)
Extract the size of the search grid.
static TInt FilterSize (const TInt aCamusOpts)
Extract the size of the match box filter.
static TInt Granularity (const TInt aCamusOpts)
Extract the granularity for pixel-wise matching.

Friends


class
COpticalFlow


Detailed Description

This class implements Camus algorithm for estimation of optical flow from a series of bitmaps.

This class creates an COpticalFlow object that contains an estimation of the motion vector (x and y motion in pixels) for each pixel of the input frame. Use the methods of COpticalFlow to extract higher level information such as estimated camera rotation/movement.

The algorithm is highly parameterizable.

Features of the algorithm and some hints:

  • Maximum estimated motion is 1 or 2 pixels/frame, so it is typically reasonable to use small bitmaps (e.g. 16x12 pixels).
  • History of several frames is used to achieve sub pixel accuracy
  • Based on template matching
  • Uses grayscale images
  • Large motions are hard so having a good frame rate is essential since the per-frame motion is inversely proportional to the frame rate
  • Small bitmaps are preferred (especially when estimation of quick movements is required) for two reasons
    1. fast to compute -> higher frame rate
    2. one pixel is represents larger objects (and motion) in world

How to use (2 simplified examples):

  COpticalFlow* iOpticalFlow = COpticalFlow::NewL(iFirstFrame->Size());
  CNokiaCVImage* iCamus = CCamus::NewL(*iFirstFrame, 5);
  iCamus->GetOpticalFlow(*iOpticalFlow, *iSecondFrame, CAMUS_SETCAMUSOPTS(CCamus::EMedium, CCamus::EMedium, 3));
  CEgoMovement mean = iOpticalFlow->Mean();
   ....

Another example

  // initialization
  CNokiaCVImage* iCamus = CCamus::NewL(*iNewFrame, 7); // history: 7
  COpticalFlow* iOpticalFlow = COpticalFlow::NewL(TSize(iImageSize.iWidth, iImageSize.iHeight));
  // for each frame
  TInt opts = 0;
  opts = CAMUS_SETGRIDSIZE(opts, CCamus::EMedium);
  opts = CAMUS_SETFILTERSIZE(opts, CCamus::ESmall);
  opts = CAMUS_SETGRANULARITY(opts, 2);
  iCamus->GetOpticalFlow(*iOpticalFlow, *iNewFrame, opts);

See also the demo applications for more examples.

Be careful to down-scale the bitmaps properly. Using straight-forward subsampling will cause poor results

Definition at line 121 of file ncvCamus.h.


Member Enumeration Documentation

Size alternatives to be used with runtime adjustable options of the Camus algorithm.

Valid values are:

  • ESmall
  • EMedium
  • ELarge
    Note:
    Symbian TClass.
Enumerator:
ESmall
EMedium
ELarge

Definition at line 134 of file ncvCamus.h.


Member Function Documentation

static IMPORT_C CCamus* CCamus::NewL ( CNokiaCVImage & aImage,
const TInt aHistorySize = KDefaultCamusHistorySize
) [static]

Factory method for creating an instance.

Parameters:
aImage Initialization image.
aHistorySize Maximum number of reference images to keep in memory.
Note:
All images used with an instance must be of the same, nonzero size as the initialization image.

aHistorySize must be an integer larger than 1.

Returns:
CCamus*
Note:
the function can leave (NewL).

IMPORT_C void CCamus::GetOpticalFlow ( COpticalFlow & aOpticalFlow,
CNokiaCVImage & aImage,
const TInt aCamusOpts = KDefaultCamusOpts
)

Calculate optical flow for an image.

Parameters:
aOpticalFlow COpticalFlow to store the optical flow.
aImage Image for which to deduce the optical flow.
aCamusOpts Runtime parameters for tuning performance vs. accuracy.
Note:
aOpticalFlow must be of the same size as the images used with the instance.

aCamusOpts can be created with CAMUS_* macros.

See also:
CAMUS_SETGRIDSIZE

CAMUS_SETFILTERSIZE

CAMUS_SETGRANULARITY

IMPORT_C void CCamus::GetOpticalFlow ( COpticalFlow & aOpticalFlow,
const TInt aCamusOpts = KDefaultCamusOpts
)

Recalculate optical flow for the previously added image.

See also:
GetOpticalFlow(COpticalFlow& aOpticalFlow, CNokiaCVImage& aImage, const TInt aCamusOpts) for parameters.

static TInt CCamus::GridSize ( const TInt aCamusOpts ) [static, protected]

Extract the size of the search grid.

Parameters:
aCamusOpts Runtime parameters for the Camus algorithm.
Returns:
Size of a search grid.

static TInt CCamus::FilterSize ( const TInt aCamusOpts ) [static, protected]

Extract the size of the match box filter.

See also:
GridSize(const TInt aCamusOpts) for parameters.
Returns:
Size of a match box filter.

static TInt CCamus::Granularity ( const TInt aCamusOpts ) [static, protected]

Extract the granularity for pixel-wise matching.

See also:
GridSize(const TInt aCamusOpts) for parameters.
Returns:
Granularity.


The documentation for this class was generated from the following file:
Generated on Tue Jul 10 22:58:37 2007 for NokiaComputerVisionLibrary by doxygen 1.5.2
Terms Of Use | Privacy Policy | Copyright © 2009 Nokia. All rights reserved.