Basic Image AlgorithmS Library
2.8.0
|
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) |
clfImage2D * | newImage_ (unsigned int w, unsigned int h, bool clear=false) |
void | Upsample_ (clfImage2D *src, clfImage2D *dst, float scale=1.0f) |
void | Warp_ (unsigned int level) |
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
Definition at line 62 of file clfTVL1Flow.hh.
clfTVL1Flow::clfTVL1Flow | ( | clfContext * | ctx | ) |
constructor, requires valid gpu context
Definition at line 34 of file clfTVL1Flow.cpp.
References BIAS::clfFilter< InputStorageType, OutputStorageType >::Build(), BIAS::clfContext::GetDeviceInfo(), and clfDeviceInfo::maxComputeUnits.
|
virtual |
Definition at line 79 of file clfTVL1Flow.cpp.
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.
|
protected |
Definition at line 298 of file clfTVL1Flow.cpp.
References BIAS::clfImage2D::CopyToBiasImage(), BIAS::clfImage2D::CopyToImage(), and BIAS::clfImage2D::GetImageDim().
|
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.
|
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.
|
protected |
Definition at line 219 of file clfTVL1Flow.cpp.
|
protected |
Definition at line 265 of file clfTVL1Flow.cpp.
References BIAS::clfImage2D::GetImageDim().