Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Transforms.H File Reference


Detailed Description

Transformations on Image

Definition in file Transforms.H.

#include "Util/Promotions.H"

Include dependency graph for Transforms.H:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class T>
Image< bytesegmentObject (const Image< T > &src, const Point2D< int > &center)
 Segment object using an adaptive thresholding & region growing method.
template<class T>
int segmentLandmark (const Image< T > &src, const Point2D< int > &seed, Image< byte > &target, double &activity, double &standout, float &area_percentage)
 Segment landmark using an adaptive thresholding & region growing method.
template<class T>
Image< bytecontour2D (const Image< T > &src, const byte onval=255, const byte offval=0)
 Compute 2D 4-neighbor contours of binary objects in image.
template<class T>
Image< T > chamfer34 (const Image< T > &src, const T dmax=255)
 3/4-chamfer distance transform; object = non 0
template<class T>
Image< T > saliencyChamfer34 (const Image< T > &src, const T dmax=255)
 3/4-chamfer saliency distance transform; object = non 0
template<class T>
Image< typename promote_trait<
T, float >::TP > 
dct (const Image< T > &src, const int offx, const int offy, const int size)
 Computes 2D discrete cosine transform.
template<class T>
float infoFFT (const Image< T > &src, const float eps, const Rectangle &rect)
 FFT-based information measure.
template<class T>
Image< float > infoFFT (const Image< T > &src, const float eps)
 FFT-based information measure.
double learningCoeff (const Image< float > &featureMap, const Image< byte > &targetDMap, const bool softmask=false, const int in_thresh=20, const int out_thresh=255)
 Examine local maxes in/out of targets and compute a learning weight.
template<class T_or_RGB>
Image< T_or_RGB > scaleBlock (const Image< T_or_RGB > &src, const Dims newDims)
 scale up an image using blocks
template<class T>
int floodClean (const Image< T > &src, Image< T > &dest, const Point2D< int > &seed, const T thresh, const T val, int numdirs=8)
 Floods object >= thresh with val from seed and returns area.
template<class T>
int floodCleanBB (const Image< T > &src, Image< T > &dest, const Point2D< int > &seed, const T thresh, const T val, Rectangle &bbox)
 same as floodClean, only finds the bounding box of the region in addition
template<class T>
Image< bytesegmentObjectClean (const Image< T > &src, const Point2D< int > &seed, int numdirs=8)
 same as segmentObject, only with floodClean and different parameters
template<class T>
Image< float > distDegrade (const Image< T > &src, const Point2D< int > &foa, const float area)
 degrades a binary image mask s.t. it decays away from the FOA
template<class T>
Image< T > highThresh (const Image< T > &src, const T thresh, const T val)
 set all values >= thresh to val in src and return the result
template<class T_or_RGB>
Image< T_or_RGB > replaceVals (const Image< T_or_RGB > &src, const T_or_RGB from, const T_or_RGB to, const T_or_RGB other)
 replace all values "from" with "to" and all other values with "other"
template<class T_or_RGB>
Image< T_or_RGB > replaceVals (const Image< T_or_RGB > &src, const T_or_RGB from, const T_or_RGB to)
 replace all values "from" with "to" and leave all other values in place
template<class T_or_RGB>
Image< T_or_RGB > composite (const Image< T_or_RGB > &fg, const Image< T_or_RGB > &bg, const T_or_RGB transparent=T_or_RGB())
 Composite of the non-transparent pixels of fg on top of bg.
template<class T>
Image< bytemakeBinary (const Image< T > &src, const T &threshold, const byte lowVal=byte(0), const byte highVal=byte(255))
 make a binary version of the source image
template<class T>
Image< bytemakeBinary2 (const Image< T > &src, const T &lowThresh, const T &highThresh, const byte lowVal=byte(0), const byte highVal=byte(255))
 make a binary version of the source image
template<class T_or_RGB>
void pasteImage (Image< T_or_RGB > &background, const Image< T_or_RGB > &foreground, const T_or_RGB &transparent, const Point2D< int > location, float opacity=1.0F)
 paste foreground into background image at (location)
template<class T>
void inplacePasteGabor (Image< T > &dst, const Image< T > &gabor, const Point2D< int > &pos, const T background)
 Paste a gabor into an image area. Account for overlap.
template<class T>
int flood (const Image< T > &src, Image< T > &dest, const Point2D< int > &seed, const T thresh, const T val)
 Floods object >= thresh with val from seed and returns area.
template<class T>
int countParticles (const Image< T > &src, const T thresh)
 How many particles >= thresh ?
template<class T>
void inplaceAddBGnoise (Image< T > &dst, const float range)
 Add background noise to image.
template<class T>
void inplaceAddBGnoise2 (Image< T > &dst, const float range)
 Add background noise to image.


Function Documentation

template<class T>
Image<T> chamfer34 const Image< T > &  src,
const T  dmax = 255
 

3/4-chamfer distance transform; object = non 0

Definition at line 257 of file Transforms.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getWidth(), Dims::h(), i, Image< T >::initialized(), rutz::min(), Dims::w(), and w.

Referenced by VisualBufferStd::findMostInterestingTarget(), foveate(), highlightRegions(), VisualBufferStd::input(), TaskRelevanceMapKillN::integrate(), WinnerTakeAllGreedy::integrate(), main(), BeoSubCanny::runCanny(), and runCanny().

template<class T_or_RGB>
Image<T_or_RGB> composite const Image< T_or_RGB > &  fg,
const Image< T_or_RGB > &  bg,
const T_or_RGB  transparent = T_or_RGB()
 

Composite of the non-transparent pixels of fg on top of bg.

Definition at line 1360 of file Transforms.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::end(), Image< T >::getDims(), Image< T >::isSameSize(), NO_INIT, and lobot::stop().

Referenced by SimulationViewerStd::drawMegaCombo(), SimulationViewerEyeMvt::getTraj(), and SimulationViewerStd::getTraj().

template<class T>
Image<byte> contour2D const Image< T > &  src,
const byte  onval = 255,
const byte  offval = 0
 

Compute 2D 4-neighbor contours of binary objects in image.

Points on the contour will be given value onval, and points not on the contour will have offval.

Definition at line 210 of file Transforms.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getWidth(), h, i, Image< T >::initialized(), NO_INIT, w, and z.

Referenced by SimulationViewerNerdCam::drawMaskOutline(), SimulationViewerStd::drawMaskOutline(), SimulationViewerCompress::getTraj(), and Image_xx_contour2D_xx_1().

template<class T>
int countParticles const Image< T > &  src,
const T  thresh
 

How many particles >= thresh ?

Definition at line 1562 of file Transforms.C.

References fill(), flood(), Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), Point2D< T >::i, Point2D< T >::j, LFATAL, and p.

template<class T>
Image<typename promote_trait<T, float>::TP> dct const Image< T > &  src,
const int  offx,
const int  offy,
const int  size
 

Computes 2D discrete cosine transform.

of square image patch size*size at offset (offx, offy)

Definition at line 527 of file Transforms.C.

References ASSERT, cols, lobot::cos(), e, Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), i, Image< T >::initialized(), l, log(), n, N, NO_INIT, p, rows, s, Image< T >::setVal(), lobot::sin(), and x.

Referenced by infoMeasure().

template<class T>
Image<float> distDegrade const Image< T > &  src,
const Point2D< int > &  foa,
const float  area
 

degrades a binary image mask s.t. it decays away from the FOA

template<class T>
int flood const Image< T > &  src,
Image< T > &  dest,
const Point2D< int > &  seed,
const T  thresh,
const T  val
 

Floods object >= thresh with val from seed and returns area.

template<class T>
int floodClean const Image< T > &  src,
Image< T > &  dest,
const Point2D< int > &  seed,
const T  thresh,
const T  val,
int  numdirs = 8
 

Floods object >= thresh with val from seed and returns area.

a clean version of Image::flood - problems solved: correct boundary checking, allow for thresh = 0.

Parameters:
dest if dest is not initialized, it will be initialized to ZEROS. ATTENTION: If you want to have the old behavior of dest being initialized to src, you have to this explicitely before calling floodClean

template<class T>
int floodCleanBB const Image< T > &  src,
Image< T > &  dest,
const Point2D< int > &  seed,
const T  thresh,
const T  val,
Rectangle bbox
 

same as floodClean, only finds the bounding box of the region in addition

template<class T>
Image<T> highThresh const Image< T > &  src,
const T  thresh,
const T  val
 

set all values >= thresh to val in src and return the result

Definition at line 1314 of file Transforms.C.

References ASSERT, Image< T >::beginw(), Image< T >::endw(), Image< T >::initialized(), and lobot::stop().

Referenced by EntropyChannel::doInput(), and main().

template<class T>
Image<float> infoFFT const Image< T > &  src,
const float  eps
 

FFT-based information measure.

Definition at line 869 of file Transforms.C.

References data, Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), Dims::h(), i, NO_INIT, Image< T >::setVal(), lobot::sin(), and Dims::w().

template<class T>
float infoFFT const Image< T > &  src,
const float  eps,
const Rectangle rect
 

FFT-based information measure.

Definition at line 858 of file Transforms.C.

References crop(), getMinMax(), and infoFFT().

template<class T>
void inplaceAddBGnoise Image< T > &  dst,
const float  range
 

Add background noise to image.

Range should be max value for any image of the type to which we add noise

Definition at line 1585 of file Transforms.C.

References inplaceAddBGnoise2().

Referenced by RawVisualCortex::combineOutputs(), BeoSubSaliency::computeCMAP(), computeCMAP(), main(), RegSaliency::postChannel(), SingleChannel::postProcessMap(), and BeobotBrainMT::threadCompute().

template<class T>
void inplaceAddBGnoise2 Image< T > &  dst,
const float  range
 

Add background noise to image.

Range should be max value for any image of the type to which we add noise similar to addBGnoise, but eliminates BNG.. constant

Definition at line 1595 of file Transforms.C.

References ASSERT, Image< T >::beginw(), Image< T >::getHeight(), Image< T >::getWidth(), h, i, Image< T >::initialized(), rutz::min(), randomDouble(), and w.

Referenced by inplaceAddBGnoise().

template<class T>
void inplacePasteGabor Image< T > &  dst,
const Image< T > &  gabor,
const Point2D< int > &  pos,
const T  background
 

Paste a gabor into an image area. Account for overlap.

this is a simple extention to paste, but it tests for gabor overlap and attempts rectify similar to solution for MakeSnake by taking the pixel value furthest from the background value

Parameters:
background This is the color of the image background

double learningCoeff const Image< float > &  featureMap,
const Image< byte > &  targetDMap,
const bool  softmask = false,
const int  in_thresh = 20,
const int  out_thresh = 255
 

Examine local maxes in/out of targets and compute a learning weight.

Valid ranges for in_thresh and out_thresh are 0..255, plus: use -1 for in_thresh to learn from the background only, or use -1 for out_thresh to learn from the target only.

template<class T>
Image<byte> makeBinary const Image< T > &  src,
const T &  threshold,
const byte  lowVal = byte(0),
const byte  highVal = byte(255)
 

make a binary version of the source image

Parameters:
src source image
threshold the threshold used for binarization
lowVal value for all points <= threshold
highVal value for all points > threshold

Definition at line 1384 of file Transforms.C.

References Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), Image< T >::getDims(), NO_INIT, and lobot::stop().

Referenced by VisualBufferStd::findMostInterestingTarget(), Image_xx_makeBinary_xx_1(), main(), and Raster_xx_img_gray_write_bw_read_gray_xx_1().

template<class T>
Image<byte> makeBinary2 const Image< T > &  src,
const T &  lowThresh,
const T &  highThresh,
const byte  lowVal = byte(0),
const byte  highVal = byte(255)
 

make a binary version of the source image

Parameters:
src source image
highThresh the threshold used for binarization
lowThresh the threshold used for binarization
lowVal value for all points <= threshold
highVal value for all points > threshold

Definition at line 1397 of file Transforms.C.

References Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), Image< T >::getDims(), NO_INIT, and lobot::stop().

template<class T_or_RGB>
void pasteImage Image< T_or_RGB > &  background,
const Image< T_or_RGB > &  foreground,
const T_or_RGB &  transparent,
const Point2D< int >  location,
float  opacity = 1.0F
 

paste foreground into background image at (location)

Parameters:
transparent pixels with this value are not replaced in background

template<class T_or_RGB>
Image<T_or_RGB> replaceVals const Image< T_or_RGB > &  src,
const T_or_RGB  from,
const T_or_RGB  to
 

replace all values "from" with "to" and leave all other values in place

Definition at line 1345 of file Transforms.C.

References Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), Image< T >::getDims(), and NO_INIT.

template<class T_or_RGB>
Image<T_or_RGB> replaceVals const Image< T_or_RGB > &  src,
const T_or_RGB  from,
const T_or_RGB  to,
const T_or_RGB  other
 

replace all values "from" with "to" and all other values with "other"

Definition at line 1330 of file Transforms.C.

References Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), Image< T >::getDims(), and NO_INIT.

template<class T>
Image<T> saliencyChamfer34 const Image< T > &  src,
const T  dmax
 

3/4-chamfer saliency distance transform; object = non 0

* reset borders */

Definition at line 375 of file Transforms.C.

References ASSERT, Image< T >::beginw(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getWidth(), Dims::h(), h, i, Image< T >::initialized(), Dims::w(), w, x, and y.

Referenced by V1::evolveCanny(), and V1::evolveSobel().

template<class T_or_RGB>
Image<T_or_RGB> scaleBlock const Image< T_or_RGB > &  src,
const Dims  newDims
 

scale up an image using blocks

template<class T>
int segmentLandmark const Image< T > &  src,
const Point2D< int > &  seed,
Image< byte > &  target,
double &  activity,
double &  standout,
float &  area_percentage
 

Segment landmark using an adaptive thresholding & region growing method.

Returns an image that masks the landmark

Parameters:
activity is a measure of mean activity in the landmark
standout is a measure of how much the landmark stands out from the rest of the image
area is the percentage area of landmark

template<class T>
Image<byte> segmentObject const Image< T > &  src,
const Point2D< int > &  center
 

Segment object using an adaptive thresholding & region growing method.

Returns an image that masks the object (see Itti et al, J Neuroimaging, 2001)

template<class T>
Image<byte> segmentObjectClean const Image< T > &  src,
const Point2D< int > &  seed,
int  numdirs = 8
 

same as segmentObject, only with floodClean and different parameters


Generated on Mon Nov 23 15:48:33 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4