ImageSetOps.H File Reference

#include "Util/Types.H"
Include dependency graph for ImageSetOps.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ImageSet processing functions

Not all of these functions are templates, simply because alternate versions aren't currently needed.

template<class T_or_RGB >
bool isHomogeneous (const ImageSet< T_or_RGB > &x)
 Returns true if all images in the set are the same size.
template<class T_or_RGB >
bool isDyadic (const ImageSet< T_or_RGB > &pyr)
 Check whether the pyramid is dyadic.
template<class T >
Image< T > sum (const ImageSet< T > &x)
 Returns the sum of all the images in the set. Requires isHomogeneous().
template<class T >
Image< T > mean (const ImageSet< T > &x)
 Returns the sum of all the images in the set. Requires isHomogeneous().
template<class T >
Range< T > rangeOf (const ImageSet< T > &x)
 Returns the overall range of all images in the set.
template<class T >
ImageSet< T > takeSlice (const ImageSet< T > *sets, uint N, uint s)
 Make an ImageSet from the s'th level from each of the N input sets.
template<class T >
Image< T > makeImageArray (const ImageSet< T > &x, int Nx=-1, int grid_width=1, T grid_color=T(), int destX=-1, int destY=-1)
 Make a single image-array from the set (see concatArray() in Image_ShapeOps).
template<class T >
ImageSet< T > reduce (const ImageSet< T > &x, int octaves)
 Make a new ImageSet by downscaling the input by the given number of octaves.
template<class T >
ImageSet< T > rescale (const ImageSet< T > &x, const Dims &dims)
 Make a new ImageSet by rescaling each input image to the given dimensions.
ImageSet< float > orientedFilterSet (const Image< float > &lowPassedInput, float period, const float *angles, const uint numAngles)
 Generate a set of oriented filter outputs for a given set of orientations.
void splitPosNeg (const ImageSet< float > &x, ImageSet< float > &pos, ImageSet< float > &neg)
 split the positive and negative values for each image in x
ImageSet mathematical operators

This set of operators is obviously incomplete; more operators can be added as they are needed. There are three basic kinds of operators:

(1) ImageSet-scalar ops. These place no restrictions on the ImageSet.

(2) ImageSet-Image ops. These require the ImageSet to be homogeneous (all images the same size), and require the Image argument to be the same size as well.

(3) ImageSet-ImageSet ops. These require the two sets to have the same number of images, and for each pair of corresponding images to be the same size.

template<class T >
ImageSet< T > & operator-= (ImageSet< T > &x, const Image< T > &y)
 x -= y, for each image in x; requires isHomogeneous(x).
template<class T >
ImageSet< T > & operator+= (ImageSet< T > &x, const Image< T > &y)
 x += y, for each image in x; requires isHomogeneous(x).
template<class T >
ImageSet< T > & operator*= (ImageSet< T > &x, const Image< T > &y)
 x *= y, for each image in x; requires isHomogeneous(x).
template<class T >
ImageSet< T > & operator/= (ImageSet< T > &x, const Image< T > &y)
 x /= y, for each image in x; requires isHomogeneous(x).
template<class T >
ImageSet< T > & operator-= (ImageSet< T > &x, const T &v)
 x -= v, for each image in x
template<class T >
ImageSet< T > & operator+= (ImageSet< T > &x, const T &v)
 x += v, for each image in x
template<class T >
ImageSet< T > & operator*= (ImageSet< T > &x, const T &v)
 x *= v, for each image in x
template<class T >
ImageSet< T > & operator/= (ImageSet< T > &x, const T &v)
 x /= v, for each image in x
template<class T >
ImageSet< T > operator- (ImageSet< T > &x, const T &v)
 x - v, for each image in x
template<class T >
ImageSet< T > operator+ (ImageSet< T > &x, const T &v)
 x + v, for each image in x
template<class T >
ImageSet< T > operator* (ImageSet< T > &x, const T &v)
 x * v, for each image in x
template<class T >
ImageSet< T > operator/ (ImageSet< T > &x, const T &v)
 x / v, for each image in x
template<class T >
ImageSet< T > & operator-= (ImageSet< T > &x, const ImageSet< T > &y)
 x -= y, for each image in x with the respective image in y
template<class T >
ImageSet< T > & operator+= (ImageSet< T > &x, const ImageSet< T > &y)
 x += y, for each image in x with the respective image in y
template<class T >
ImageSet< T > & operator*= (ImageSet< T > &x, const ImageSet< T > &y)
 x *= y, for each image in x with the respective image in y
template<class T >
ImageSet< T > & operator/= (ImageSet< T > &x, const ImageSet< T > &y)
 x /= y, for each image in x with the respective image in y
template<class T >
ImageSet< T > clampedDiff (const ImageSet< T > &b, const ImageSet< T > &c)
 clampedDiff(b,c) for each image
In-place ImageSet modification functions

Any functions which modify an ImageSet in-place should adhere to the following conventions:

(1) The to-be-modified ImageSet should be passed by non-const reference as the first argument to the function.

(2) The function should be named with a "do" prefix, to distinguish it from functions that work by returning a new result instead of modifying an argument in place.

Not all of these functions are templates, simply because alternate versions aren't currently needed.

template<class T >
void doRectify (ImageSet< T > &x)
 x = rectify(x), for each image in x
template<class T >
void doLowThresh (ImageSet< T > &x, const T threshold, const T newval=T())
 For each image in x, replace values < threshold with newval.
template<class T >
void doLowThreshAbs (ImageSet< T > &x, const T threshold, const T newval=T())
 For each image in x, replace values whose abs is < threshold with newval.
template<class T >
void doSqrt (ImageSet< T > &x)
 For each image in x, take the square root at every pixel.
template<class T >
void doSquared (ImageSet< T > &x)
 For each image in x, take the square at every pixel.
void doMeanNormalize (ImageSet< float > &x)
 Subtract the overall mean from each image.
void doOneNormalize (ImageSet< float > &x)
 Normalize so overall max value is 1.0.
void doEnergyNorm (ImageSet< float > &x)
 Divide image by the local image energy, then subtract overall mean.
void doApplyBiases (ImageSet< float > &x, const float *biases)
 Multiply each image by the corresponding bias.
void doAddWeighted (ImageSet< float > &x, const ImageSet< float > &y, float v)
 x += v * y, for each image in x and y, respectively
void doClear (ImageSet< float > &x, float v)
 x = v, for each image in x

Detailed Description

Free functions operating on sets of images

Definition in file ImageSetOps.H.


Function Documentation

template<class T >
ImageSet<T> clampedDiff ( const ImageSet< T > &  b,
const ImageSet< T > &  c 
) [inline]

clampedDiff(b,c) for each image

Definition at line 424 of file ImageSetOps.C.

References ASSERT, clampedDiff(), and ImageSet< T >::size().

Referenced by clampedDiff(), ImageCacheAvg< T >::clampedDiffMean(), and OrientationChannel::doInteractions().

void doAddWeighted ( ImageSet< float > &  x,
const ImageSet< float > &  y,
float  v 
)

x += v * y, for each image in x and y, respectively

Definition at line 517 of file ImageSetOps.C.

References ASSERT, and ImageSet< T >::size().

void doApplyBiases ( ImageSet< float > &  x,
const float *  biases 
)

Multiply each image by the corresponding bias.

Definition at line 508 of file ImageSetOps.C.

References ImageSet< T >::size().

void doClear ( ImageSet< float > &  x,
float  v 
)

x = v, for each image in x

Definition at line 525 of file ImageSetOps.C.

References ImageSet< T >::clear(), and ImageSet< T >::size().

void doEnergyNorm ( ImageSet< float > &  x  ) 

Divide image by the local image energy, then subtract overall mean.

Definition at line 499 of file ImageSetOps.C.

References energyNorm(), and ImageSet< T >::size().

Referenced by ContourChannel::doInput().

template<class T >
void doLowThresh ( ImageSet< T > &  x,
const T  threshold,
const T  newval = T() 
) [inline]

For each image in x, replace values < threshold with newval.

Definition at line 451 of file ImageSetOps.C.

References inplaceLowThresh(), and ImageSet< T >::size().

Referenced by SingleChannel::computePyramid(), SingleSvChannel::computePyramid(), OrientationChannel::doInteractions(), and SingleChannel::setClipPyramid().

template<class T >
void doLowThreshAbs ( ImageSet< T > &  x,
const T  threshold,
const T  newval = T() 
) [inline]

For each image in x, replace values whose abs is < threshold with newval.

Definition at line 459 of file ImageSetOps.C.

References inplaceLowThreshAbs(), and ImageSet< T >::size().

Referenced by SingleChannel::computePyramid(), and SingleSvChannel::computePyramid().

void doMeanNormalize ( ImageSet< float > &  x  ) 

Subtract the overall mean from each image.

Definition at line 482 of file ImageSetOps.C.

References mean().

Referenced by ContourChannel::doInput().

void doOneNormalize ( ImageSet< float > &  x  ) 

Normalize so overall max value is 1.0.

Definition at line 488 of file ImageSetOps.C.

References Range< T >::max(), rangeOf(), and ImageSet< T >::size().

Referenced by ContourChannel::doInput().

template<class T >
void doRectify ( ImageSet< T > &  x  )  [inline]

x = rectify(x), for each image in x

Definition at line 443 of file ImageSetOps.C.

References inplaceRectify(), and ImageSet< T >::size().

Referenced by SingleChannel::computePyramid(), SingleSvChannel::computePyramid(), and ContourChannel::doInput().

template<class T >
void doSqrt ( ImageSet< T > &  x  )  [inline]

For each image in x, take the square root at every pixel.

Definition at line 467 of file ImageSetOps.C.

References ImageSet< T >::size(), and sqrt().

Referenced by DirectionChannel::computePyramid().

template<class T >
void doSquared ( ImageSet< T > &  x  )  [inline]

For each image in x, take the square at every pixel.

Definition at line 475 of file ImageSetOps.C.

References ImageSet< T >::size(), and squared().

template<class T_or_RGB >
bool isDyadic ( const ImageSet< T_or_RGB > &  pyr  )  [inline]

Check whether the pyramid is dyadic.

A dyadic pyramid is one in which each level is one half the width and one half the height of the preceding level. NOTE that this function is defined here, in ImageSetOps.H, rather than in Pyramid_Ops.H, in order to avoid a cyclic dependency between those two modules. ImageSetOps needs isDyadic() in order to implement makeImageArray().

Referenced by makeImageArray(), SingleChannel::storePyramid(), and SingleOpponentChannel::storePyramid2().

template<class T_or_RGB >
bool isHomogeneous ( const ImageSet< T_or_RGB > &  x  )  [inline]

Returns true if all images in the set are the same size.

Also returns true for the empty set.

Referenced by operator*=(), operator+=(), operator-=(), operator/=(), and sum().

template<class T >
Image<T> makeImageArray ( const ImageSet< T > &  x,
int  Nx = -1,
int  grid_width = 1,
grid_color = T(),
int  destX = -1,
int  destY = -1 
) [inline]

Make a single image-array from the set (see concatArray() in Image_ShapeOps).

Parameters:
Nx Number of columns; if negative, the result will be roughly square.
grid_width Pixel width of grid separators to be overlaid on image.
grid_color Color in which to draw grid.
destX Width to which each image is reshaped; if negative, reshape to size of first image.
destY Height to which each image is reshaped; if negative, reshape to size of first image.

Definition at line 148 of file ImageSetOps.C.

References concatArray(), isDyadic(), ImageSet< T >::size(), sqrt(), and zoomXY().

Referenced by ContourChannel::doInput().

template<class T >
Image<T> mean ( const ImageSet< T > &  x  )  [inline]
template<class T >
ImageSet<T> operator* ( ImageSet< T > &  x,
const T &  v 
) [inline]

x * v, for each image in x

Definition at line 360 of file ImageSetOps.C.

template<class T >
ImageSet<T>& operator*= ( ImageSet< T > &  x,
const ImageSet< T > &  y 
) [inline]

x *= y, for each image in x with the respective image in y

Definition at line 400 of file ImageSetOps.C.

References ASSERT, and ImageSet< T >::size().

template<class T >
ImageSet<T>& operator*= ( ImageSet< T > &  x,
const T &  v 
) [inline]

x *= v, for each image in x

Definition at line 324 of file ImageSetOps.C.

References ImageSet< T >::size().

template<class T >
ImageSet<T>& operator*= ( ImageSet< T > &  x,
const Image< T > &  y 
) [inline]

x *= y, for each image in x; requires isHomogeneous(x).

Definition at line 280 of file ImageSetOps.C.

References ASSERT, isHomogeneous(), and ImageSet< T >::size().

template<class T >
ImageSet<T> operator+ ( ImageSet< T > &  x,
const T &  v 
) [inline]

x + v, for each image in x

Definition at line 352 of file ImageSetOps.C.

template<class T >
ImageSet<T>& operator+= ( ImageSet< T > &  x,
const ImageSet< T > &  y 
) [inline]

x += y, for each image in x with the respective image in y

Definition at line 388 of file ImageSetOps.C.

References ASSERT, and ImageSet< T >::size().

template<class T >
ImageSet<T>& operator+= ( ImageSet< T > &  x,
const T &  v 
) [inline]

x += v, for each image in x

Definition at line 314 of file ImageSetOps.C.

References ImageSet< T >::size().

template<class T >
ImageSet<T>& operator+= ( ImageSet< T > &  x,
const Image< T > &  y 
) [inline]

x += y, for each image in x; requires isHomogeneous(x).

Definition at line 268 of file ImageSetOps.C.

References ASSERT, isHomogeneous(), and ImageSet< T >::size().

template<class T >
ImageSet<T> operator- ( ImageSet< T > &  x,
const T &  v 
) [inline]

x - v, for each image in x

Definition at line 344 of file ImageSetOps.C.

template<class T >
ImageSet<T>& operator-= ( ImageSet< T > &  x,
const ImageSet< T > &  y 
) [inline]

x -= y, for each image in x with the respective image in y

Definition at line 376 of file ImageSetOps.C.

References ASSERT, and ImageSet< T >::size().

template<class T >
ImageSet<T>& operator-= ( ImageSet< T > &  x,
const T &  v 
) [inline]

x -= v, for each image in x

Definition at line 304 of file ImageSetOps.C.

References ImageSet< T >::size().

template<class T >
ImageSet<T>& operator-= ( ImageSet< T > &  x,
const Image< T > &  y 
) [inline]

x -= y, for each image in x; requires isHomogeneous(x).

Definition at line 256 of file ImageSetOps.C.

References ASSERT, isHomogeneous(), and ImageSet< T >::size().

template<class T >
ImageSet<T> operator/ ( ImageSet< T > &  x,
const T &  v 
) [inline]

x / v, for each image in x

Definition at line 368 of file ImageSetOps.C.

template<class T >
ImageSet<T>& operator/= ( ImageSet< T > &  x,
const ImageSet< T > &  y 
) [inline]

x /= y, for each image in x with the respective image in y

Definition at line 412 of file ImageSetOps.C.

References ASSERT, and ImageSet< T >::size().

template<class T >
ImageSet<T>& operator/= ( ImageSet< T > &  x,
const T &  v 
) [inline]

x /= v, for each image in x

Definition at line 334 of file ImageSetOps.C.

References ImageSet< T >::size().

template<class T >
ImageSet<T>& operator/= ( ImageSet< T > &  x,
const Image< T > &  y 
) [inline]

x /= y, for each image in x; requires isHomogeneous(x).

Definition at line 292 of file ImageSetOps.C.

References ASSERT, isHomogeneous(), and ImageSet< T >::size().

ImageSet<float> orientedFilterSet ( const Image< float > &  lowPassedInput,
float  period,
const float *  angles,
const uint  numAngles 
)

Generate a set of oriented filter outputs for a given set of orientations.

Caller is responsible for passing input in the form of (image - lowPass(image))

Definition at line 223 of file ImageSetOps.C.

References orientedFilter().

Referenced by ContourChannel::doInput().

template<class T >
Range<T> rangeOf ( const ImageSet< T > &  x  )  [inline]

Returns the overall range of all images in the set.

Definition at line 120 of file ImageSetOps.C.

References Range< T >::merge(), rangeOf(), and ImageSet< T >::size().

Referenced by buildPyrRetinexLog(), doOneNormalize(), normalizeFloat(), and rangeOf().

template<class T >
ImageSet<T> reduce ( const ImageSet< T > &  x,
int  octaves 
) [inline]

Make a new ImageSet by downscaling the input by the given number of octaves.

Definition at line 192 of file ImageSetOps.C.

References decXY(), lowPass3(), and ImageSet< T >::size().

Referenced by ContourChannel::doInput().

template<class T >
ImageSet<T> rescale ( const ImageSet< T > &  x,
const Dims dims 
) [inline]

Make a new ImageSet by rescaling each input image to the given dimensions.

Definition at line 210 of file ImageSetOps.C.

References rescale(), and ImageSet< T >::size().

Referenced by addNoise(), DescriptorVec::buildRawDV(), CINNICstatsRun::checkSize(), SoxChannel::combineOutputs(), SubmapAlgorithmBiased::compute(), SimulationViewerStats::computeAGStats(), SimulationViewerStats::computeLAMStats(), DirectFeedChannel::computeOutput(), MbariResultViewer::displayImage(), ObjDetChannel::doInput(), ForegroundDetectionChannel::doInput(), ContourChannel::doInput(), SimulationViewerNerdCam::drawMegaCombo(), contourRun::dumpEnergySigmoid(), TemplateMatchChannel::findBestMatch(), PyrFoveator::foveate(), TestImages::generateScene(), VisualObject::getKeypointImage(), VisualObject::getKeypointImage2(), SceneGenerator::getLabelMeScene(), DPM::getModelImage(), GetSaliency::getSubMaps(), VisualBufferStd::input(), TaskRelevanceMapSocial::inputFrame(), TaskRelevanceMapTigs2::inputFrame(), TaskRelevanceMapTigs2::integrate(), TaskRelevanceMapGistClassify::integrate(), TaskRelevanceMapTigs::integrate(), main(), maxNormalizeFancy(), maxNormalizeFancyFast(), SingleChannel::postProcessMap(), CINNICstatsRun::preProcess(), XMLInput::readFrame(), GameOfLifeInput::readFrame(), InputMbariFrameSeries::readRGB(), rescale(), SimulationViewerNerdCam::saveResults(), SingleSvChannel::setClipPyramid(), BeobotBrainMT::threadCompute(), OptimalGainsFinder::visitComplexChannel(), OptimalGainsFinder::visitSingleChannel(), and warp3Dmap().

void splitPosNeg ( const ImageSet< float > &  x,
ImageSet< float > &  pos,
ImageSet< float > &  neg 
)

split the positive and negative values for each image in x

Definition at line 240 of file ImageSetOps.C.

References ImageSet< T >::size(), and splitPosNeg().

Referenced by splitPosNeg().

template<class T >
Image<T> sum ( const ImageSet< T > &  x  )  [inline]

Returns the sum of all the images in the set. Requires isHomogeneous().

Definition at line 95 of file ImageSetOps.C.

References ASSERT, isHomogeneous(), ImageSet< T >::size(), and ZEROS.

Referenced by DirectFeedChannel::absSumCoeffs(), lobot::PointMatrix::average(), lobot::LRFData::average_distance(), HMM< T >::backward(), c_intg_x_filter_clean_fewbits(), c_intg_x_filter_clean_manybits(), c_intg_x_filter_clean_small_fewbits(), c_intg_x_filter_clean_small_manybits(), c_intg_y_filter_clean_fewbits(), c_intg_y_filter_clean_manybits(), c_intg_y_filter_clean_small_fewbits(), c_intg_y_filter_clean_small_manybits(), PGH::cmpHist(), TaskRelevanceMapGistClassify::computeGistDist(), GistEstimatorFFT::computeGistFeatureVector(), VisualObject::computeKeypoints(), convolveCleanZero(), convolveHmax(), BitObject::doesIntersect(), dogFilterHmax(), VarianceChannel::doInput(), Gist_Navigation::evolve(), filterAtLocation(), filterAtLocationBatch(), HMM< T >::forward(), getCentroidFirstLast(), Histogram::getChiSqDiff(), Histogram::getDistance(), getEdgeScaleSpacePixel(), getLikelyhoodImage(), getMaskedMinMaxAvg(), SpectralResidualChannel::getOutput(), learningCoeff(), lowPassPixel(), main(), mean(), multiScaleBatchFilter(), ComplexChannel::numSubmaps(), IntegerComplexChannel::numSubmaps(), SimEventShapeEstimatorOutput::objectArea(), randomDoubleFromNormal(), SalientRegionSegmenter::SalientRegionSegmenter(), ScaleSpace::ScaleSpace(), segmentLandmark(), BitObject::setMaxMinAvgIntensity(), ObjRec::start2(), stdev(), sumXY(), HippocampusI::updateParticleObservation(), HippocampusI::updateParticleSlamObservation(), WeightFinder::visitComplexChannel(), WeightFinder::visitSingleChannel(), and HmaxFL::windowedPatchDistance().

template<class T >
ImageSet<T> takeSlice ( const ImageSet< T > *  sets,
uint  N,
uint  s 
) [inline]

Make an ImageSet from the s'th level from each of the N input sets.

This is useful, for example, in transforming an array of ImageSets from multiple-scales-per-set/one-orientation-per-set into the reverse, multiple-orientations-per-set/one-scale-per-set.

Definition at line 134 of file ImageSetOps.C.

Referenced by ContourChannel::doInput().

Generated on Sun May 8 08:12:44 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3