Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | List of all members
BIAS::clfTVL1Flow Class Reference

TVL1 optical flow opencl implementation. More...

#include <OpenCLFramework/Algorithm/clfTVL1Flow.hh>

Public Member Functions

void AddImage (BIAS::Image< unsigned char > image)
 call this for every new image every image must be same size, width and height multiples of 16. More...
 
 clfTVL1Flow (clfContext *ctx)
 constructor, requires valid gpu context More...
 
void Compute ()
 compute optical flow between images compute optical flow between the last two added images, does nothing if only one or no images have been added. More...
 
void GetColorCoded (BIAS::Image< float > &image)
 get flow vectors in color coding converts the flow vectors to colors, where direction represents a color in a hsv hue circle. More...
 
void GetUVW (BIAS::Image< float > &image)
 get flow vectors (direction u,v) stores flow vectors with direction (u,v) in images first 2 color channels. More...
 
void SetNumberOfIterations (unsigned int iternumber)
 
void SetSmoothness (const float &smoothness)
 
virtual ~clfTVL1Flow ()
 

Protected Member Functions

void ComputeFlow_ (unsigned int level)
 
void CreatePyramid_ (std::vector< clfImage2D * > &pyramid)
 
clfImage2DnewImage_ (unsigned int w, unsigned int h, bool clear=false)
 
void Upsample_ (clfImage2D *src, clfImage2D *dst, float scale=1.0f)
 
void Warp_ (unsigned int level)
 

Detailed Description

TVL1 optical flow opencl implementation.

"A duality based approach for realtime TV-L1 optical flow" by Zach et.al. (see file header for bibtex) Implementation in OpenCL

Author
fkellner 08/11

Definition at line 62 of file clfTVL1Flow.hh.

Constructor & Destructor Documentation

clfTVL1Flow::clfTVL1Flow ( clfContext ctx)

constructor, requires valid gpu context

Todo:
create constructor with parameters for algorithm (defaults are good though)

Definition at line 34 of file clfTVL1Flow.cpp.

References BIAS::clfFilter< InputStorageType, OutputStorageType >::Build(), BIAS::clfContext::GetDeviceInfo(), and clfDeviceInfo::maxComputeUnits.

clfTVL1Flow::~clfTVL1Flow ( )
virtual

Definition at line 79 of file clfTVL1Flow.cpp.

Member Function Documentation

void clfTVL1Flow::AddImage ( BIAS::Image< unsigned char >  image)

call this for every new image every image must be same size, width and height multiples of 16.

image pyramid will go down until width or height are no multiples of 16, meaning that a 1024x768 image will be downsampled 4 times (64x48)

Definition at line 133 of file clfTVL1Flow.cpp.

References BIAS::ImageBase::GetColorModel(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageData(), BIAS::ImageBase::GetWidth(), and BIAS::clfImage2D::WriteToImage().

void clfTVL1Flow::Compute ( )

compute optical flow between images compute optical flow between the last two added images, does nothing if only one or no images have been added.

Definition at line 224 of file clfTVL1Flow.cpp.

void clfTVL1Flow::ComputeFlow_ ( unsigned int  level)
protected
void clfTVL1Flow::CreatePyramid_ ( std::vector< clfImage2D * > &  pyramid)
protected

Definition at line 213 of file clfTVL1Flow.cpp.

void clfTVL1Flow::GetColorCoded ( BIAS::Image< float > &  image)

get flow vectors in color coding converts the flow vectors to colors, where direction represents a color in a hsv hue circle.

length of the vectors scales saturation and value. note that the resulting image has 4 channels!

Definition at line 122 of file clfTVL1Flow.cpp.

void clfTVL1Flow::GetUVW ( BIAS::Image< float > &  image)

get flow vectors (direction u,v) stores flow vectors with direction (u,v) in images first 2 color channels.

note that the resulting image has 4 channels!

Definition at line 118 of file clfTVL1Flow.cpp.

clfImage2D * clfTVL1Flow::newImage_ ( unsigned int  w,
unsigned int  h,
bool  clear = false 
)
protected

Definition at line 203 of file clfTVL1Flow.cpp.

References BIAS::clfImage2D::Allocate().

void clfTVL1Flow::SetNumberOfIterations ( unsigned int  iternumber)

Definition at line 108 of file clfTVL1Flow.cpp.

void clfTVL1Flow::SetSmoothness ( const float &  smoothness)

Definition at line 113 of file clfTVL1Flow.cpp.

void clfTVL1Flow::Upsample_ ( clfImage2D src,
clfImage2D dst,
float  scale = 1.0f 
)
protected

Definition at line 219 of file clfTVL1Flow.cpp.

void clfTVL1Flow::Warp_ ( unsigned int  level)
protected

Definition at line 265 of file clfTVL1Flow.cpp.

References BIAS::clfImage2D::GetImageDim().


The documentation for this class was generated from the following files: