Modules | Functions

Convolution Operations
[Image Processing]

Collaboration diagram for Convolution Operations:

Modules

 Kernel Generators

Functions

int imProcessConvolve (const imImage *src_image, imImage *dst_image, const imImage *kernel)
int imProcessConvolveSep (const imImage *src_image, imImage *dst_image, const imImage *kernel)
int imProcessConvolveDual (const imImage *src_image, imImage *dst_image, const imImage *kernel1, const imImage *kernel2)
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, double stddev1, double stddev2)
int imProcessLapOfGaussianConvolve (const imImage *src_image, imImage *dst_image, double stddev)
int imProcessMeanConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int imProcessGaussianConvolve (const imImage *src_image, imImage *dst_image, double stddev)
int imProcessBarlettConvolve (const imImage *src_image, imImage *dst_image, int kernel_size)
int imProcessSobelConvolve (const imImage *src_image, imImage *dst_image)
int imProcessPrewittConvolve (const imImage *src_image, imImage *dst_image)
int imProcessSplineEdgeConvolve (const imImage *src_image, imImage *dst_image)
int imProcessZeroCrossing (const imImage *src_image, imImage *dst_image)
int imProcessCanny (const imImage *src_image, imImage *dst_image, double stddev)
int imGaussianStdDev2KernelSize (double stddev)
double imGaussianKernelSize2StdDev (int kernel_size)
int imProcessUnsharp (const imImage *src_image, imImage *dst_image, double stddev, double amount, double threshold)
int imProcessSharp (const imImage *src_image, imImage *dst_image, double amount, double threshold)
int imProcessSharpKernel (const imImage *src_image, const imImage *kernel, imImage *dst_image, double amount, double threshold)

Detailed Description

See im_process_loc.h

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.

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 imProcessConvolveSep ( const imImage src_image,
imImage dst_image,
const imImage kernel 
)

Base convolution when the kernel is separable. Only the first line and the first column will be used.
Returns zero if the counter aborted.

im.ProcessConvolveSep(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] 
im.ProcessConvolveSepNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 
int imProcessConvolveDual ( const imImage src_image,
imImage dst_image,
const imImage kernel1,
const imImage kernel2 
)

Base Convolution with two kernels. The result is the magnitude of the result of each convolution.
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.

im.ProcessConvolveDual(src_image: imImage, dst_image: imImage, kernel1, kernel2: imImage) -> counter: boolean [in Lua 5] 
im.ProcessConvolveDualNew(image: imImage, kernel1, kernel2: 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.

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 complex. Returns zero if the counter aborted.

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,
double  stddev1,
double  stddev2 
)

Difference(Gaussian1, Gaussian2).
Supports all data types, but if source is IM_BYTE or IM_USHORT target image must be of type IM_INT. Returns zero if the counter aborted.

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 imProcessLapOfGaussianConvolve ( const imImage src_image,
imImage dst_image,
double  stddev 
)

Convolution with a laplacian of a gaussian kernel.
Supports all data types, but if source is IM_BYTE or IM_USHORT target image must be of type IM_INT. Returns zero if the counter aborted.

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. Returns zero if the counter aborted.

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 imProcessGaussianConvolve ( const imImage src_image,
imImage dst_image,
double  stddev 
)

Convolution with a gaussian kernel with floating point values.
If sdtdev is negative its magnitude will be used as the kernel size.
Supports all data types. Returns zero if the counter aborted.

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 imProcessBarlettConvolve ( const imImage src_image,
imImage dst_image,
int  kernel_size 
)

Convolution with a barlett kernel.
Supports all data types. Returns zero if the counter aborted.

im.ProcessBarlettConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] 
im.ProcessBarlettConvolveNew(image: imImage, kernel_size: 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. Returns zero if the counter aborted.

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] 
int imProcessPrewittConvolve ( const imImage src_image,
imImage dst_image 
)

Magnitude of the prewitt convolution.
Supports all data types. Returns zero if the counter aborted.

im.ProcessPrewittConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] 
im.ProcessPrewittConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 
int imProcessSplineEdgeConvolve ( const imImage src_image,
imImage dst_image 
)

Spline edge dectection.
Supports all data types. Returns zero if the counter aborted.

im.ProcessSplineEdgeConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] 
im.ProcessSplineEdgeConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 
int imProcessZeroCrossing ( const imImage src_image,
imImage dst_image 
)

Finds the zero crossings of IM_SHORT, IM_INT, IM_FLOAT and IM_DOUBLE 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/ Returns zero if the counter aborted.

im.ProcessZeroCrossing(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] 
im.ProcessZeroCrossingNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 
int imProcessCanny ( const imImage src_image,
imImage dst_image,
double  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.
Returns zero if the counter aborted. Implementation from the book:

    J. R. Parker
    "Algorithms for Image Processing and Computer Vision"
    WILEY
 
im.ProcessCanny(src_image: imImage, dst_image: imImage, stddev: number)-> counter: boolean [in Lua 5] 
im.ProcessCannyNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] 
int imGaussianStdDev2KernelSize ( double  stddev  ) 

Calculates the kernel size given the standard deviation.
If sdtdev is negative its magnitude will be used as the kernel size.

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

Calculates the standard deviation given the kernel size.

im.GaussianKernelSize2StdDev(kernel_size: number) -> stddev: number [in Lua 5] 
int imProcessUnsharp ( const imImage src_image,
imImage dst_image,
double  stddev,
double  amount,
double  threshold 
)

Edge enhancement using Unsharp mask. stddev control the gaussian filter, amount controls how much the edges will enhance the image (0<amount<1), and threshold controls which edges will be considered, it compares to twice of the absolute size of the edge. Although very similar to imProcessSharp, produces better results.

im.ProcessUnsharp(src_image: imImage, dst_image: imImage, stddev: number, amount: number, threshold: number) [in Lua 5] 
im.ProcessUnsharpNew(image: imImage, stddev: number, amount: number, threshold: number) -> new_image: imImage [in Lua 5] 
int imProcessSharp ( const imImage src_image,
imImage dst_image,
double  amount,
double  threshold 
)

Edge enhancement using Laplacian8 mask. amount controls how much the edges will enhance the image (0<amount<1), and threshold controls which edges will be considered, it compares to twice of the absolute size of the edge. Returns zero if the counter aborted.

im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5] 
im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5] 
int imProcessSharpKernel ( const imImage src_image,
const imImage kernel,
imImage dst_image,
double  amount,
double  threshold 
)

Edge enhancement using a given kernel. If kernel has all positive values, then the unsharp technique is used, else sharp is used. amount controls how much the edges will enhance the image (0<amount<1), and threshold controls which edges will be considered, it compares to twice of the absolute size of the edge. Returns zero if the counter aborted.

im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5] 
im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5]