imopv.h File Reference


Detailed Description

This module provides image operations such as convolution.

Some operations are optimized to exploit possible SIMD instructions. This requires image data to be properly aligned, along with the image stride.

The function vl_imconvcol_vf() can be used to compute separable convolutions. The function vl_imconvcoltri_vf() is an optimized version that works with triangular kernels.

Author:
Andrea Vedaldi

Definition in file imopv.h.

#include "generic.h"

Go to the source code of this file.


Defines

Image convolution flags
#define VL_PAD_BY_ZERO   (0x0 << 0)
 Pad with zeroes.
#define VL_PAD_BY_CONTINUITY   (0x1 << 0)
 Pad by continuity.
#define VL_PAD_MASK   (0x3)
 Padding field selector.
#define VL_TRANSPOSE   (0x1 << 2)
 Transpose result.

Functions

Image convolution
VL_EXPORT void vl_imconvcol_vf (float *dst, int dst_stride, float const *src, int src_width, int src_height, int src_stride, float const *filt, int filt_begin, int filt_end, int step, unsigned int flags)
 Convolve image along columns.
VL_EXPORT void vl_imconvcol_vd (double *dst, int dst_stride, double const *src, int src_width, int src_height, int src_stride, double const *filt, int filt_begin, int filt_end, int step, unsigned int flags)
VL_EXPORT void vl_imconvcoltri_vf (float *dst, int dst_stride, float const *src, int src_width, int src_height, int src_stride, int filt_size, int step, unsigned int flags)
 Convolve image along columns by a triangular kernel.
VL_EXPORT void vl_imconvcoltri_vd (double *dst, int dst_stride, double const *src, int src_width, int src_height, int src_stride, int filt_size, int step, unsigned int flags)

Function Documentation

vl_imconvcol_vd ( double *  dst,
int  dst_stride,
double const *  src,
int  src_width,
int  src_height,
int  src_stride,
double const *  filt,
int  filt_begin,
int  filt_end,
int  step,
unsigned int  flags 
)

vl_imconvcol_vf ( float *  dst,
int  dst_stride,
float const *  src,
int  src_width,
int  src_height,
int  src_stride,
float const *  filt,
int  filt_begin,
int  filt_end,
int  step,
unsigned int  flags 
)

Parameters:
dst destination image.
dst_stride width of the destination image including padding.
src source image.
src_width width of the source image.
src_height height of the source image.
src_stride width of the source image including padding.
filt filter kernel.
filt_begin coordinate of the first filter element.
filt_end coordinate of the last filter element.
step sub-sampling step.
flags operation modes.
The function convolves the column of the image src by the filter filt and saves the result to the image dst. The size of dst must be equal to the size of src. Formally, this results in the calculation

\[ \mathrm{dst} [x,y] = \sum_{p=y-\mathrm{filt\_end}}^{y-\mathrm{filt\_begin}} \mathrm{src}[x,y] \mathrm{filt}[y - p - \mathrm{filt\_begin}] \]

The function subsamples the image along the columns according to the parameter step. Setting step to 1 (one) computes the elements $\mathrm{dst}[x,y]$ for all pairs (x,0), (x,1), (x,2) and so on. Setting step two 2 (two) computes only (x,0), (x,2) and so on (in this case the height of the destination image is floor(src_height/step)+1).

Calling twice the function can be used to compute 2-D separable convolutions. Use the flag VL_TRANSPOSE to transpose the result (in this case dst has transposed dimension as well).

The function allows the support of the filter to be any range. Usually the support is filt_end = -filt_begin.

The convolution operation may pick up values outside the image boundary. To cope with this edge cases, the function either pads the image by zero (VL_PAD_BY_ZERO) or with the values at the boundary (VL_PAD_BY_CONTINUITY).

Referenced by _vl_dhog_with_gaussian_window().

vl_imconvcoltri_vd ( double *  dst,
int  dst_stride,
double const *  src,
int  src_width,
int  src_height,
int  src_stride,
int  filt_size,
int  step,
unsigned int  flags 
)

vl_imconvcoltri_vf ( float *  dst,
int  dst_stride,
float const *  src,
int  src_width,
int  src_height,
int  src_stride,
int  filt_size,
int  step,
unsigned int  flags 
)

Parameters:
dst destination image.
dst_stride width of the destination image including padding.
src source image.
src_width width of the source image.
src_height height of the source image.
src_stride width of the source image including padding.
filt_size half length of the filter support.
step sub-sampling step.
flags operation modes.
The function convolves the column of the image src by a triangular filter whose support is 2*filt_size pixels long. The minimum filter size is 1, which corresponds to a delta function.

The operation of the function is otherwise similar to vl_imconvocl().

Referenced by _vl_dhog_with_flat_window().