IM: Convolution Operations

IM - An Imaging Tool

Convolution Operations
[Image Processing]


Detailed Description

See im_process_loc.h


Functions

int imProcessConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel)
int imProcessConvolveRep (const imImage *src_image, imImage *dst_image, const imImage *kernel, int count)
int imProcessCompassConvolve (const imImage *src_image, imImage *dst_image, imImage *kernel)
void imProcessRotateKernel (imImage *kernel)
int imProcessDiffOfGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev1, float stddev2)
int imProcessDiffOfGaussianConvolveRep (const imImage *src_image, imImage *dst_image, float stddev1, float stddev2)
int imProcessLapOfGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev)
int imProcessMeanConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int imProcessGaussianConvolveRep (const imImage *src_image, imImage *dst_image, float stddev)
int imProcessGaussianConvolve (const imImage *src_image, imImage *dst_image, float stddev)
int imProcessSobelConvolve (const imImage *src_image, imImage *dst_image)
void imProcessZeroCrossing (const imImage *src_image, imImage *dst_image)
void imProcessCanny (const imImage *src_image, imImage *dst_image, float stddev)
int imGaussianStdDev2Repetitions (float stddev)
int imGaussianStdDev2KernelSize (float stddev)

Function Documentation

int imProcessConvolve const imImage src_image,
imImage dst_image,
const imImage kernel
 

Base Convolution with a kernel.
Kernel can be IM_INT or IM_FLOAT, but always IM_GRAY. Use kernel size odd for better results.
Supports all data types. The border is mirrored.
Returns zero if the counter aborted. Most of the convolutions use this function.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] 
im.ProcessConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessConvolveRep const imImage src_image,
imImage dst_image,
const imImage kernel,
int  count
 

Repeats the convolution a number of times.
Returns zero if the counter aborted.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessConvolveRep(src_image: imImage, dst_image: imImage, kernel: imImage, count: number) -> counter: boolean [in Lua 5] 
im.ProcessConvolveRepNew(image: imImage, kernel: imImage, count: number) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessCompassConvolve const imImage src_image,
imImage dst_image,
imImage kernel
 

Convolve with a kernel rotating it 8 times and getting the absolute maximum value.
Kernel must be square.
The rotation is implemented only for kernel sizes 3x3, 5x5 and 7x7.
Supports all data types except IM_CFLOAT. Returns zero if the counter aborted.
If the kernel image attribute "Description" exists it is used by the counter.

im.ProcessCompassConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] 
im.ProcessCompassConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 

void imProcessRotateKernel imImage kernel  ) 
 

Utility function to rotate a kernel one time.

im.ProcessRotateKernel(kernel: imImage) [in Lua 5] 

int imProcessDiffOfGaussianConvolve const imImage src_image,
imImage dst_image,
float  stddev1,
float  stddev2
 

Difference(Gaussian1, Gaussian2).
Supports all data types, but if source is IM_BYTE or IM_USHORT destiny image must be of type IM_INT.

im.ProcessDiffOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev1: number, stddev2: number) -> counter: boolean [in Lua 5] 
im.ProcessDiffOfGaussianConvolveNew(image: imImage, stddev1: number, stddev2: number) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessDiffOfGaussianConvolveRep const imImage src_image,
imImage dst_image,
float  stddev1,
float  stddev2
 

Difference(Gaussian1, Gaussian2) using gaussian repetitions.
Supports all data types, but if source is IM_BYTE or IM_USHORT destiny image must be of type IM_INT.

im.ProcessDiffOfGaussianConvolveRep(src_image: imImage, dst_image: imImage, stddev1: number, stddev2: number) -> counter: boolean [in Lua 5] 
im.ProcessDiffOfGaussianConvolveRepNew(image: imImage, stddev1: number, stddev2: number) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessLapOfGaussianConvolve const imImage src_image,
imImage dst_image,
float  stddev
 

Convolution with a laplacian of a gaussian kernel.
Supports all data types, but if source is IM_BYTE or IM_USHORT destiny image must be of type IM_INT.

im.ProcessLapOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5] 
im.ProcessLapOfGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessMeanConvolve const imImage src_image,
imImage dst_image,
int  kernel_size
 

Convolution with a kernel full of "1"s inside a circle.
Supports all data types.

im.ProcessMeanConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] 
im.ProcessMeanConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessGaussianConvolveRep const imImage src_image,
imImage dst_image,
float  stddev
 

Convolution with a gaussian kernel. The gaussian in obtained by repetition of a base 3x3 IM_INT kernel.
Supports all data types.

im.ProcessGaussianConvolveRep(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5] 
im.ProcessGaussianConvolveRepNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessGaussianConvolve const imImage src_image,
imImage dst_image,
float  stddev
 

Convolution with a float gaussian kernel.
Supports all data types.

im.ProcessGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5] 
im.ProcessGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] 

int imProcessSobelConvolve const imImage src_image,
imImage dst_image
 

Magnitude of the sobel convolution.
Supports all data types except IM_CFLOAT.

im.ProcessSobelConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] 
im.ProcessSobelConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 

void imProcessZeroCrossing const imImage src_image,
imImage dst_image
 

Finds the zero crossings of IM_INT and IM_FLOAT images. Crossings are marked with non zero values indicating the intensity of the edge. It is usually used after a second derivative, laplace.
Extracted from XITE, Copyright 1991, Blab, UiO
http://www.ifi.uio.no/~blab/Software/Xite/

im.ProcessZeroCrossing(src_image: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessZeroCrossingNew(image: imImage) -> new_image: imImage [in Lua 5] 

void imProcessCanny const imImage src_image,
imImage dst_image,
float  stddev
 

First part of the Canny edge detector. Includes the gaussian filtering and the nonmax suppression.
After using this you could apply a Hysteresis Threshold, see imProcessHysteresisThreshold.
Image must be IM_BYTE/IM_GRAY.
Implementation from the book:

    J. R. Parker
    "Algoritms for Image Processing and Computer Vision"
    WILEY
 

im.ProcessCanny(src_image: imImage, dst_image: imImage, stddev: number) [in Lua 5] 
im.ProcessCannyNew(image: imImage, stddev: number) -> new_image: imImage [in Lua 5] 

int imGaussianStdDev2Repetitions float  stddev  ) 
 

Calculates the number of 3x3 gaussian repetitions given the standard deviation.

im.GaussianStdDev2Repetitions(stddev: number) -> count: number [in Lua 5] 

int imGaussianStdDev2KernelSize float  stddev  ) 
 

Calculates the kernel size given the standard deviation.

im.GaussianStdDev2KernelSize(stddev: number) -> kernel_size: number [in Lua 5]