CDImageConv<TPixel>

Class Description

This DIVA image class contains a image functions related to image filtering. CDImageConv is a templated class derived from CDVisImage and the template takes a single argument specifying the pixel type (TPixel).


Constructors/Destructor

CDImageConv (void)

Default constructor. The image parameters are uninitialized and the instance is unusable until an image array is assigned.
CDImageConv
    (int width, int height,
     int nbands = 1,
     int imopts = evisimoptDefault,
     BYTE *pbData = 0)

CDImageConv
    (SIZE size,
     int nbands = 1,
     int imopts = evisimoptDefault,
     BYTE *pbData = 0)

CDImageConv
    (const RECT& rect,
     int nbands = 1,
     int imopts = evisimoptDefault,
     BYTE *pbData = 0)

CDImageConv
    (const CVisShape& shape,
     int imopts = evisimoptDefault,
     BYTE *pbData = 0)

Construct an image with the specified dimensions, number of bands, and options.

If pbData is zero, allocate the memory needed. If pbData is not zero, use the memory it points to.
CDImageConv
    (CVisMemBlock& memblock,
     int width, int height,
     int nbands = 1,
     int imopts = evisimoptDefault)

CDImageConv
    (CVisMemBlock& memblock,
     SIZE size,
     int nbands = 1,
     int imopts = evisimoptDefault)

CDImageConv
    (CVisMemBlock& memblock,
     const RECT& rect,
     int nbands = 1,
     int imopts = evisimoptDefault)

CDImageConv
    (CVisMemBlock& memblock,
     const CVisShape& shape,
     int imopts = evisimoptDefault)

Construct an image with the specified dimensions, number of bands, and options.

No new memory is allocated. The image points to the memblock supplied.
CDImageConv
    (const CDImageConv<TPixel>& imageSrc)

Construct an image from another image.
 
Argument Description
width width of image
height height of image
rect reference to a RECT structure
shape reference to a CVisShape instance specifying image properties
memblock reference to a MemBlock instance
imageSrc reference to an Image instance
nbands number of bands in image
imopts EVisImOpt image options. Options can be OR'ed.
Top

Methods

Convolution functions

CDImageConv<TPixel>::Conv2D

void Conv2D(CDImageConv<float>& imageFilter)
Convolve the image with the convolution kernel represented by the image.

void Conv2D(const CVisSequence<float>& seqFilters, EDivaFilterCombine edivafiltercombine)

Convolve the image with a sequence of convolution kernels each represented by an image.

The functions try to use IPL convolution otherwise it use Conv2DReal. The border is handled according to the border mode member variable, see Border Mode Functions.
 
Argument description
imageFilter reference to an image representing the convolution kernel
seqFilters reference to an image sequence representing the convolution kernels
edivafiltercombine EDivaFilterCombine enumerated constant indicating how to combine the results

Top

CDImageConv<TPixel>::Conv2DReal

void Conv2DReal(CDImageConv<float>& imageFilter);
Convolves the image with the convolution kernel represented by the image. The border is handled according to the border mode member variable, see Border Mode Functions.
 
Argument description
imageFilter reference to image representing the convolution kernel
Top

CDImageConv<TPixel>::MeanFilter

 void MeanFilter(int nCols, int nRows)
Perform a mean or average filtering in a nRows x nCols window.
 
Argument Description
nRows, nCols rows and columns of window
Top

CDImageConv<TPixel>::FixedFilter

void FixedFilter(EDivaFixedFilter edivafixedfilter)
Convolves the image with a predefined filter
 
Argument Description
edivafixedfilter EDivaFixedFilter enumerated constant specifying the predefined filters
Top

Cross correlation functions

CDImageConv<TPixel>::Corr2D

void Corr2D(CDImageConv<float>& imageDest, const CDImageConv<float>& imageMask, CDImageConv<float>* pimageSqr = NULL)

void Corr2D(CDImageConv<float>& imageDest, const CDImageConv<float>& imageMask, const CDImageConv<float>& imageCares, CDImageConv<float>* pimageSqr = NULL)

void Corr2D(CDImageConv<float>& imageDest, const CDImageConv<float>& imageMask, const float flDontCare = FLT_MIN, CDImageConv<float>* pimageSqr = NULL)

Computes the cross correlation between the image and the mask. In the special case of constant intensity, i.e. the standard deviation of the pixels in a window is zero, the output pixel is assigned the value FLT_EPSILON.
 
Argument description
imageDest destination image containing the computed correlation
imageMask the mask, which is correlated to the image
pimagesqr pointer to a float image containing the squared values of the current image (minor increase in speed by adding this image)
imageCares image of same size as imageMask, which indicates the cares (opposite of don't cares) in the mask. 1 indicate a care and 0 indicate don't care
flDontCare elements in the mask with this value is assigned as don't cares


Predefined filters

CDImageConv<TPixel>::GenFilterSobel

void GenFilterSobel(CVisSequence<float>& seqFilters)
Generates a 3x3 Sobel filter. (note:  remember to clear list before calling this function, unless you want to combine filters)
 
Argument Description
seqFilters reference to the sequence containing the filters
Top

CVisConvClass<TPixel>::GenFilterLaplace4n

void GenFilterLaplace4n(CVisSequence<float>& seqFilters)
Generates a 3x3 Laplacian filter (4 neighbour pixels). (note:  remember to clear list before calling this function, unless you want to combine filters)
 
Argument Description
seqFilters reference to the sequence containing the filters
Top

CVisConvClass<TPixel>::GenFilterLaplace8n

void GenFilterLaplace4n(CVisSequence<float>& seqFilters)
Generates a 3x3 Laplacian filter (8 neighbour pixels). (note:  remember to clear list before calling this function, unless you want to combine filters)
 
Argument Description
seqFilters reference to the sequence containing the filters
Top

CVisConvClass<TPixel>::GenFilterPrewitt

void GenFilterPrewitt(CVisSequence<float>& seqFilters)
Generates a 3x3 Prewitt filter. (note:  remember to clear list before calling this function, unless you want to combine filters)
 
Argument Description
seqFilters reference to the sequence containing the filters
Top

CVisConvClass<TPixel>::GenFilterMean

void GenFilterMean(CVisSequence<float>& seqFilters, int nX,int nY)
Generates a custom sized mean filter. (note:  remember to clear list before calling this function, unless you want to combine filters)
 
Argument Description
seqFilters reference to the sequence containing the filters
nX width of filter kernel
nY height of filter kernel
Top

CVisConvClass<TPixel>::GenFilterGauss

void GenFilterGauss(CVisSequence<float>& seqFilters, int nX, int nY, double dStd = -1)
Generates a custom sized mean filter. If the standard deviation is not specified is set to dStd = (min(nX,nY)-1)/2. (note:  remember to clear list before calling this function, unless you want to combine filters)
 
Argument Description
seqFilters reference to the sequence containing the filters
nX width of filter kernel
nY height of filter kernel
dStd Standard deviation
Top

CVisConvClass<TPixel>::GenFilterLoG

void GenFilterLoG(CVisSequence<float>& seqFilters, int nX,int nY, double dStd)
Generates a custom sized LoG (Laplacian of Gauss)  filter. (note:  remember to clear list before calling this function, unless you want to combine filters)
 
Argument Description
seqFilters reference to the sequence containing the filters
nX width of filter kernel
nY height of filter kernel
dStd standard deviation
Top

Enumerated Constants

EDivaFixedFilter 

Fixed filters.
 
Constant  Description
edivafixedfilterLAPLACIAN3x3 3x3 Laplacian
edivafixedfilterLAPLACIAN5x5 5x5 Laplacian
edivafixedfilterGAUSSIAN3x3 3x3 Gaussian
edivafixedfilterGAUSSIAN5x5 5x5 Gaussian
edivafixedfilterHIGHPASS3x3 3x3 High pass
edivafixedfilterHIGHPASS5x5 5x5 High pass
edivafixedfilterSHARPEN3x3 3x3 Sharpen
edivafixedfilterSobel 3x3 Sobel

Top
 

EDivaFilterCombine 

The way in which the results of applying each kernel should be comnibed.
 
Constant  Description
edivafiltercombineSUM Sum the result
edivafiltercombineSUMSQ Sum the squares the result
edivafiltercombineSUMSQROOT Sum the squares the result and then takes the sqaure root
edivafiltercombineMAX Takes the maximum of the results
edivafiltercombineMIN Takes the minimum of the results

Top


Copyright, 1998
Section for Image Analysis
Department of Mathematical Modelling
Technical University of Denmark
DK-2800 Lyngby

Authors: Rune Fisker & Lars Gunder Knudsen
Last updated: 03-05-1999