LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::maskImage Class Reference

This functor is used to mask color images with labeled or unlabeled masks. More...

#include <ltiMaskImage.h>

Inheritance diagram for lti::maskImage:
Inheritance graph
[legend]
Collaboration diagram for lti::maskImage:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class maskImage More...

Public Member Functions

 maskImage ()
 maskImage (const bool assumeLabeledMask, const bool enhanceRegionBorders=true)
 maskImage (const parameters &par)
 maskImage (const maskImage &other)
virtual ~maskImage ()
virtual const char * getTypeName () const
bool apply (const image &src, const channel8 &mask, const palette &colors, image &dest) const
bool apply (const image &src, const imatrix &mask, const palette &colors, image &dest) const
bool apply (const image &src, const channel8 &mask, image &dest) const
bool apply (const image &src, const imatrix &mask, image &dest) const
maskImagecopy (const maskImage &other)
maskImageoperator= (const maskImage &other)
virtual functorclone () const
const parametersgetParameters () const

Protected Member Functions

void combine (const rgbPixel &src, const rgbPixel &mask, rgbPixel &dest) const
int fixIdx (const int idx, const int palLastIdx) const
bool labeled (const image &src, const imatrix &mask, const palette &colors, image &dest) const
bool unlabeled (const image &src, const imatrix &mask, const palette &colors, image &dest) const
bool labeled (const image &src, const channel8 &mask, const palette &colors, image &dest) const
bool unlabeled (const image &src, const channel8 &mask, const palette &colors, image &dest) const

Detailed Description

This functor is used to mask color images with labeled or unlabeled masks.

You can give a color palette to indicate which colors should be used for each region. Using the alpha (or dummy) rgbPixel component in the palette entries you can specify the transparency degree of each region in the mask. This way, you can completely suppress regions (like background), leave regions complete untouched, or overlay colored patches.

Example

 #include <ltiKMeansSegmentation.h>
 #include <ltiMaskImage.h>
 #include <ltiViewer.h>
 #include <cstdio>
 ...
 
 lti::image img,masked;
 lti::imatrix mask;

 // let's assume, you load a colored image into img

 // simple segmentation 
 lti::kMeansSegmentation segmenter;
 segmenter.apply(img,mask);

 // get a masked image
 lti::maskImage masker(true); // assume labeled mask and enhance borders
 masker.apply(img,mask,masked);

 // show original image and masked one
 lti::viewer vieworig("Original");
 lti::viewer viewmask("Masked");

 vieworig.show(img);
 viewmask.show(masked);

 getchar(); // wait for ENTER key pressed

Constructor & Destructor Documentation

lti::maskImage::maskImage (  ) 

default constructor

lti::maskImage::maskImage ( const bool  assumeLabeledMask,
const bool  enhanceRegionBorders = true 
)

create a functor with the specified parameter attributes

lti::maskImage::maskImage ( const parameters par  ) 

Construct a functor using the given parameters.

lti::maskImage::maskImage ( const maskImage other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::maskImage::~maskImage (  )  [virtual]

destructor


Member Function Documentation

bool lti::maskImage::apply ( const image src,
const imatrix mask,
image dest 
) const

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
dest destination masked image.
Returns:
true if apply successful or false otherwise.
bool lti::maskImage::apply ( const image src,
const channel8 mask,
image dest 
) const

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
dest destination masked image.
Returns:
true if apply successful or false otherwise.
bool lti::maskImage::apply ( const image src,
const imatrix mask,
const palette colors,
image dest 
) const

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
colors color entries used to mask the image. The "dummy" entry of each pixel denotes the transparency of the color used: 0 means opaque and 255 totally transparent. The colors attribute of the parameters class will be ignored.
dest destination masked image.
Returns:
true if apply successful or false otherwise.
bool lti::maskImage::apply ( const image src,
const channel8 mask,
const palette colors,
image dest 
) const

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
colors color entries used to mask the image. The "dummy" entry of each pixel denotes the transparency of the color used: 0 means opaque and 255 totally transparent. The colors attribute of the parameters class will be ignored.
dest destination masked image.
Returns:
true if apply successful or false otherwise.
virtual functor* lti::maskImage::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

void lti::maskImage::combine ( const rgbPixel src,
const rgbPixel mask,
rgbPixel dest 
) const [inline, protected]

combine two pixels considering the transparency of the second one

maskImage& lti::maskImage::copy ( const maskImage other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

int lti::maskImage::fixIdx ( const int  idx,
const int  palLastIdx 
) const [inline, protected]

fix the index to fit into the colors

const parameters& lti::maskImage::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

virtual const char* lti::maskImage::getTypeName (  )  const [virtual]

returns the name of this type ("maskImage")

Reimplemented from lti::functor.

bool lti::maskImage::labeled ( const image src,
const channel8 mask,
const palette colors,
image dest 
) const [protected]

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
colors color entries used to mask the image. The "dummy" entry of each pixel denotes the transparency of the color used: 0 means opaque and 255 totally transparent. The colors attribute of the parameters class will be ignored.
dest destination masked image.
Returns:
true if apply successful or false otherwise.
bool lti::maskImage::labeled ( const image src,
const imatrix mask,
const palette colors,
image dest 
) const [protected]

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
colors color entries used to mask the image. The "dummy" entry of each pixel denotes the transparency of the color used: 0 means opaque and 255 totally transparent. The colors attribute of the parameters class will be ignored.
dest destination masked image.
Returns:
true if apply successful or false otherwise.
maskImage& lti::maskImage::operator= ( const maskImage other  ) 

alias for copy member

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

bool lti::maskImage::unlabeled ( const image src,
const channel8 mask,
const palette colors,
image dest 
) const [protected]

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
colors color entries used to mask the image. The "dummy" entry of each pixel denotes the transparency of the color used: 0 means opaque and 255 totally transparent. The colors attribute of the parameters class will be ignored.
dest destination masked image.
Returns:
true if apply successful or false otherwise.
bool lti::maskImage::unlabeled ( const image src,
const imatrix mask,
const palette colors,
image dest 
) const [protected]

Mask the src image using the given mask and colors for mask entries.

Parameters:
src image with the source data.
mask labeled or unlabeled mask
colors color entries used to mask the image. The "dummy" entry of each pixel denotes the transparency of the color used: 0 means opaque and 255 totally transparent. The colors attribute of the parameters class will be ignored.
dest destination masked image.
Returns:
true if apply successful or false otherwise.

The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:27:33 2010 for LTI-Lib by Doxygen 1.6.1