ETRI IVCL 1.0.0
Acceleration SW Platform for Ondevice
Classes | Macros | Functions
sift.cl File Reference

Classes

struct  Feature
 Detected features. More...
 

Macros

#define SIFT_IMG_BORDER   5
 
#define SIFT_MAX_INTERP_STEPS   5
 
#define SIFT_ORI_HIST_BINS   36
 
#define SIFT_ORI_SIG_FCTR   1.5f
 
#define SIFT_ORI_RADIUS   3.f * SIFT_ORI_SIG_FCTR
 
#define SIFT_ORI_SMOOTH_PASSES   2
 
#define SIFT_ORI_PEAK_RATIO   0.8f
 
#define SIFT_DESCR_SCL_FCTR   3.f
 
#define SIFT_DESCR_MAG_THR   0.2f
 
#define SIFT_INT_DESCR_FCTR   512.f
 
#define CV_PI   3.1415926535897932384626433832795f
 
#define CV_2PI   6.283185307179586476925286766559f
 

Functions

void ocl_ludcmp (float *varam_a, int *varam_indx)
 
void ocl_lubksb (float *varam_a, const int *varam_indx, float *varam_b)
 
void ocl_LUvar_solve (float *varam_a, float *varam_x, float *varam_b)
 
void ocl_derivative (__global float *dog, int dog_width, int r, int c, float *dD)
 
void ocl_hessian (__global float *prev_dog, __global float *dog, __global float *next_dog, int dog_width, int r, int c, float *H)
 
bool __isExtremum (__global float *prev_dog, __global float *dog, __global float *next_dog, int dog_width, int r, int c)
 
bool __interpExtremum (__global float *prev_dog, __global float *dog, __global float *next_dog, int dog_width, int dog_height, struct Feature *feat, int idx, int r, int c, int intervals, float contrast_thres, int curvature_thres)
 
__kernel void scaleSpaceExtremaKernel (__global float *prev_dog, __global float *dog, __global float *next_dog, int dog_width, int dog_height, int idx, int intervals, float contrast_thres, int curvature_thres, __global struct Feature *feats, float prelim_contrast_thres, volatile __global int *atomic_cnt)
 
void ocl_oriHist (__global float *gaussian, int width, int height, float *hist, int r, int c, int rad, float sigma)
 
__kernel void calcFeatureOrisKernel (__global struct Feature *feats, __global float *gaussian_pyramid, __global int *gauss_size_accum, __global int *gauss_width, __global int *gauss_height, int layer_per_octave)
 
void ocl_descriptorHist (__global float *gauss_data, int gauss_width, int gauss_height, float *hist, int r, int c, float ori, float scl, int d, int n)
 
void ocl_normalizeDescriptor (float *descriptor, int cnt)
 
void ocl_hist2Descriptor (float *hist, __global struct Feature *feat, int d, int n)
 
__kernel void computeDescriptor (__global struct Feature *feats, __global float *gaussian_pyramid, __global int *gauss_size_accum, __global int *gauss_width, __global int *gauss_height, int layer_per_octave, int d, int n)
 

Macro Definition Documentation

◆ CV_2PI

#define CV_2PI   6.283185307179586476925286766559f

◆ CV_PI

#define CV_PI   3.1415926535897932384626433832795f

◆ SIFT_DESCR_MAG_THR

#define SIFT_DESCR_MAG_THR   0.2f

◆ SIFT_DESCR_SCL_FCTR

#define SIFT_DESCR_SCL_FCTR   3.f

◆ SIFT_IMG_BORDER

#define SIFT_IMG_BORDER   5

◆ SIFT_INT_DESCR_FCTR

#define SIFT_INT_DESCR_FCTR   512.f

◆ SIFT_MAX_INTERP_STEPS

#define SIFT_MAX_INTERP_STEPS   5

◆ SIFT_ORI_HIST_BINS

#define SIFT_ORI_HIST_BINS   36

◆ SIFT_ORI_PEAK_RATIO

#define SIFT_ORI_PEAK_RATIO   0.8f

◆ SIFT_ORI_RADIUS

#define SIFT_ORI_RADIUS   3.f * SIFT_ORI_SIG_FCTR

◆ SIFT_ORI_SIG_FCTR

#define SIFT_ORI_SIG_FCTR   1.5f

◆ SIFT_ORI_SMOOTH_PASSES

#define SIFT_ORI_SMOOTH_PASSES   2

Function Documentation

◆ __interpExtremum()

bool __interpExtremum ( __global float *  prev_dog,
__global float *  dog,
__global float *  next_dog,
int  dog_width,
int  dog_height,
struct Feature feat,
int  idx,
int  r,
int  c,
int  intervals,
float  contrast_thres,
int  curvature_thres 
)

Interpolates a scale-space extremum's location

Parameters
prev_dogprevious Dog image
dogcurrent Dog image
next_dognext Dog image
dog_widthwidth of current Dog image
dog_heightheight of current Dog image
featreturned feature
idxindex of intervals
rpixel's image row
cpixel's image col
intervalsnumber of intervals per octave
contrast_threslow threshold on feature contrast
curvature_thresthreshold on feature curvature
Returns
is a feature?

◆ __isExtremum()

bool __isExtremum ( __global float *  prev_dog,
__global float *  dog,
__global float *  next_dog,
int  dog_width,
int  r,
int  c 
)

Determines whether a pixel is a scale-space extremum

Parameters
prev_dogprevious Dog image
dogcurrent Dog image
next_dognext Dog image
dog_widthwidth of current Dog image
rpixel's image row
cpixel's image col
Returns
is a extremum?

◆ calcFeatureOrisKernel()

__kernel void calcFeatureOrisKernel ( __global struct Feature feats,
__global float *  gaussian_pyramid,
__global int *  gauss_size_accum,
__global int *  gauss_width,
__global int *  gauss_height,
int  layer_per_octave 
)

Computes a canonical orientation for each image feature

Parameters
featsfeature vector
gaussian_pyramidgaussian pyramid
gauss_size_accumgaussian accumulated total size OpenCL buffer
gauss_widthgaussian width OpenCL buffer
gauss_heightgaussian height OpenCL buffer
layer_per_octavenumber of layers per octave

◆ computeDescriptor()

__kernel void computeDescriptor ( __global struct Feature feats,
__global float *  gaussian_pyramid,
__global int *  gauss_size_accum,
__global int *  gauss_width,
__global int *  gauss_height,
int  layer_per_octave,
int  d,
int  n 
)

Computes feature descriptors (OpenCL)

Parameters
featsfeature vector
gaussian_pyramidGaussian pyramid
gauss_size_accumgaussian accumulated total size OpenCL buffer
gauss_widthgaussian width OpenCL buffer
gauss_heightgaussian height OpenCL buffer
layer_per_octavenumber of layers per octave in Gaussian pyramid
dwidth of 2d hist
nnumber of bins for descriptor

◆ ocl_derivative()

void ocl_derivative ( __global float *  dog,
int  dog_width,
int  r,
int  c,
float *  dD 
)

Calculate partial derivatives

Parameters
dogDog pyramid
dog_widthwidth of current Dog image
rpixel's image row
cpixel's image col
dDarray of partial derivatives

◆ ocl_descriptorHist()

void ocl_descriptorHist ( __global float *  gauss_data,
int  gauss_width,
int  gauss_height,
float *  hist,
int  r,
int  c,
float  ori,
float  scl,
int  d,
int  n 
)

Computes the 2D array of orientation histograms

Parameters
gauss_datagaussian image
gauss_widththe gaussian image width
gauss_heightthe gaussian image height
histreturned dxdxn hist vector
rpixel's image row
cpixel's image column
oriorientation
sclscl scale relative to image
dwidth of 2d hist
nnumber of bins for descriptor

◆ ocl_hessian()

void ocl_hessian ( __global float *  prev_dog,
__global float *  dog,
__global float *  next_dog,
int  dog_width,
int  r,
int  c,
float *  H 
)

Calculate 3D Hessian matrix

Parameters
prev_dogprevious Dog image
dogcurrent Dog image
next_dognext Dog image
dog_widthwidth of current Dog image
dog_heightheight of current Dog image
rpixel's image row
cpixel's image col
Harray of Hessian matrix

◆ ocl_hist2Descriptor()

void ocl_hist2Descriptor ( float *  hist,
__global struct Feature feat,
int  d,
int  n 
)

Converts 2d hist into 1d descriptor

Parameters
hist2d histogram
featfeature point
dwidth of 2d hist
nnumber of bins for descriptor

◆ ocl_lubksb()

void ocl_lubksb ( float *  varam_a,
const int *  varam_indx,
float *  varam_b 
)

Backsubstitution for LU

◆ ocl_ludcmp()

void ocl_ludcmp ( float *  varam_a,
int *  varam_indx 
)

LU decomposition of a matrix

◆ ocl_LUvar_solve()

void ocl_LUvar_solve ( float *  varam_a,
float *  varam_x,
float *  varam_b 
)

Solve the least-squares solution using LU decomposition

◆ ocl_normalizeDescriptor()

void ocl_normalizeDescriptor ( float *  descriptor,
int  cnt 
)

Normalize descriptor to length 1

Parameters
descriptordescriptor vector
cntdescriptor size

◆ ocl_oriHist()

void ocl_oriHist ( __global float *  gaussian,
int  width,
int  height,
float *  hist,
int  r,
int  c,
int  rad,
float  sigma 
)

Compute gradient orientation histogram

Parameters
gaussiangaussian image
widththe image width
heightthe image height
histreturned hist
rpixel's image row
cpixel's image column
radradius of selected region
sigmasigma for gaussian smoothing

◆ scaleSpaceExtremaKernel()

__kernel void scaleSpaceExtremaKernel ( __global float *  prev_dog,
__global float *  dog,
__global float *  next_dog,
int  dog_width,
int  dog_height,
int  idx,
int  intervals,
float  contrast_thres,
int  curvature_thres,
__global struct Feature feats,
float  prelim_contrast_thres,
volatile __global int *  atomic_cnt 
)

Detects features at extrema in DoG scale space

Parameters
prev_dogprevious Dog image
dogcurrent Dog image
next_dognext Dog image
dog_widthwidth of current Dog image
dog_heightheight of current Dog image
idxindex of intervals
intervalsnumber of intervals per octave
contrast_threslow threshold on feature contrast
curvature_threshigh threshold on feature ratio of principal curvatures
featsreturned feature vectors
prelim_contrast_thres0.5f * (float)contrast_thres / intervals
atomic_cntreturned keypoints