CDImageBasic<TPixel>

Class Description

This DIVA image class contains a number of basic image analysis functions. CDImageBasic is a templated image class derived from VisSDK image class CVisImage. The template takes a single argument specifying the pixel type (TPixel).

Constructors/Destructor

CDImageBasic (void)

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

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

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

CDImageBasic
    (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.
CVisBasic
    (CVisMemBlock& memblock,
     int width, int height,
     int nbands = 1,
     int imopts = evisimoptDefault)

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

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

CDImageBasic
    (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.
CDImageBasic
    (const CVisImage<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

Binarization

CDImageBasic<TPixel>::Threshold

void Threshold (TPixel tValue)

Performs a simple threshold, i.e. all pixel values with a value above the threshold is set to 1 and the rest is set to 0

 
Argument Description
tValue The threshold value
Top

CDImageBasic<TPixel>::ThresholdInv

void ThresholdInv (TPixel tValue)
Performs simple inverted threshold, i.e. corresponds to a simple threshold where the result is inverted.
 
Argument Description
tValue The threshold value

CDImageBasic<TPixel>::ThresholdSoft

void ThresholdSoft(TPixel tValue)
Performs soft threshold, i.e. all pixels that have a value, which is below the threshold, is set to the threshold value.
 
Argument Description
tValue The threshold value

Top

CDImageBasic<TPixel>::ThresholdSoftInv

void ThresholdSoftInv(TPixel tValue)
Performs soft inverted threshold, i.e. all pixels which have a value, which is above or equal to the threshold, is set to the threshold value.
 
Argument Description
tValue The threshold value


Blob Operations

CDImageBasic<TPixel>::BlobFirstMoment

void BlobFirstMoment(CVisDVector& vXC, CVisDVector& vYC)

Calculates the first order moment (center of gravity) for labeled blobs.

 
Argument Description
vXC x-coordinate for first order moment
vYC y-coordinate for first order moment

CDImageBasic<TPixel>::BlobRemoveBorder

void BlobRemoveBorder(int nDist)

Removes labeled blobs closer to the border that a given distance.

 
Argument Description
nDist distance to the border

Top

CDImageBasic<TPixel>::Label

void Label()

Labels a binary image using 4 neighbourhood.

Graphics

CDImageBasic<TPixel>::DrawLine

void DrawLine(int x1 ,int y1 ,int x2 ,int y2, TPixel tVal)
Draws a line into the image.
 
Argument Description
x1, y1, x2 ,y2 draw line from (x1,y1) to (x2,y2)
tVal pixel value

CDImageBasic<TPixel>::DrawRect

void DrawRect(CRect rFrame, TPixel tVal)
Draws a rectangle into the image.
 
Argument Description
rFrame rectangle
tVal pixel value

Top

CDImageBasic<TPixel>::DIB2Image

bool DIB2Image(LPVOID pDIB);

Creates a image from the Bitmap DIB and returns true if succesfull.

 
Argument Description
pDIB pointer tio the DIB

Top

CDImageBasic<TPixel>::Image2DIB

LPVOID Image2DIB(int &nSizeDIB)

Returns a pointer to the Bitmap DIB created from the image.

 
Argument Description
nSizeDIB Reference to the size of the created DIB
Top

Math Functions

CDImageBasic<TPixel>::Log()

void Sqr()
Takes log to each pixel.
Top

CDImageBasic<TPixel>::Sqr()

void Sqr()
Squares each pixel.
Top

CDImageBasic<TPixel>::Sqrt()

void Sqr()
Takes the squares root of each pixel.
Top

Miscellaneous

CDImageBasic<TPixel>::EnlargePyr

void EnlargePyr(int nFactor)

Enlarges the image.

 
Argument Description
nFactor the factor to enlarge the width and height of the image

CDImageBasic<TPixel>::FlipHorizontal

void FlipHorizontal ()

CDImageBasic<TPixel>::FlipVertical

void FlipHorizontal ()
Flips the image vertical or horizontal, respectivly.

Top
 

CDImageBasic<TPixel>::ReducePyr

void ReducePyr(int nFactor)

Reduces the image.

 
Argument Description
nFactor the factor to reduce the width and height of the image
Top

Overload operators

CDImageBasic<TPixel>::operator+

CDImageBasic<TPixel>& operator+(const CDImageBasic<TPixel>& refimage)

CDImageBasic<TPixel>& operator+(const double dbl)

Returns an image that is the sum of  the current image and  refimage or the scalar dbl.
 
Argument Description
refimage reference to image
dbl double-precision value

CDImageBasic<TPixel>::operator+=

CDImageBasic<TPixel>& operator+=(const CDImageBasic<TPixel>& refimage)

CDImageBasic<TPixel>& operator+=(const double dbl)

Adds the elements of refimage or the scalar dbl to the elements of the current image.
 
Argument Description
refimage reference to image
dbl double-precision value

 

CDImageBasic<TPixel>::operator-=

CDImageBasic<TPixel>& operator-=(const CDImageBasic<TPixel>& refimage)

CDImageBasic<TPixel>& operator-=(const double dbl)

Subtracts the elements of refimage or the scalar dbl from the elements of the current image.
 
Argument Description
refimage reference to image
dbl double-precision value

Top

CDImageBasic<TPixel>::operator*=

CDImageBasic<TPixel>& operator*=(const CDImageBasic<TPixel>& refimage)

CDImageBasic<TPixel>& operator*=(const double dbl)

Mulitiplies the elements of the current image by the corresponding elements of the refimage, or by dbl.
 
Argument Description
refimage reference to image
dbl double-precision value

CDImageBasic<TPixel>::operator/=

CDImageBasic<TPixel>& operator/=(const CDImageBasic<TPixel>& refimage)

CDImageBasic<TPixel>& operator/=(const double dbl)

Divides the elements of the current image by the corresponding elements of the refimage, or by dbl.
 
Argument Description
refimage reference to image
dbl double-precision value

Top


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

Author: Rune Fisker and Jørgen Folm-Hansen

Last updated: 18-5-99