#include "Util/Promotions.H"
Go to the source code of this file.
Functions | |
template<class T > | |
Image< byte > | segmentObject (const Image< T > &src, const Point2D< int > ¢er) |
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< byte > | contour2D (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< byte > | segmentObjectClean (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_or_RGB > | |
Image< T_or_RGB > | createMask (const Image< T_or_RGB > &fg, const Image< bool > mask, const T_or_RGB transparent=T_or_RGB()) |
Create a mask of an object and transparent pixels in desired area. | |
template<class T_or_RGB > | |
Image< T_or_RGB > | mosaic (const Image< T_or_RGB > &fg, const Image< T_or_RGB > *bg, const T_or_RGB *transvalues, const uint Nimages) |
template<class T_or_RGB > | |
Image< T_or_RGB > | alphaBlend (const Image< T_or_RGB > &fg, const Image< T_or_RGB > &bg, const double alpha=0.8, const T_or_RGB transparent=T_or_RGB()) |
apply a translucent layer (also called alpha blending) | |
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 | |
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 | |
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) |
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. |
Transformations on Image
Definition in file Transforms.H.
Image<T_or_RGB> alphaBlend | ( | const Image< T_or_RGB > & | fg, | |
const Image< T_or_RGB > & | bg, | |||
const double | alpha = 0.8 , |
|||
const T_or_RGB | transparent = T_or_RGB() | |||
) | [inline] |
apply a translucent layer (also called alpha blending)
Definition at line 1446 of file Transforms.C.
References ASSERT, Image< T >::begin(), Image< T >::end(), Image< T >::getDims(), Image< T >::isSameSize(), and NO_INIT.
Referenced by SimulationViewerEyeRegion::getTraj().
3/4-chamfer distance transform; object = non 0
Definition at line 257 of file Transforms.C.
References ASSERT, Image< T >::begin(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getWidth(), Dims::h(), Image< T >::initialized(), min(), and Dims::w().
Referenced by VisualBufferStd::findMostInterestingTarget(), highlightRegions(), VisualBufferStd::input(), TaskRelevanceMapKillN::integrate(), WinnerTakeAllGreedy::integrate(), and main().
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() | |||
) | [inline] |
Composite of the non-transparent pixels of fg on top of bg.
Definition at line 1358 of file Transforms.C.
References ASSERT, Image< T >::begin(), Image< T >::end(), Image< T >::getDims(), Image< T >::isSameSize(), and NO_INIT.
Referenced by SimulationViewerStd::drawMegaCombo(), SimulationViewerEyeHand::getTraj(), SimulationViewerHand::getTraj(), SimulationViewerEyeMvtNeuro::getTraj(), SimulationViewerStd::getTraj(), SimulationViewerEyeRegion::getTraj(), and SimulationViewerEyeMvt::getTraj().
Image<byte> contour2D | ( | const Image< T > & | src, | |
const byte | onval = 255 , |
|||
const byte | offval = 0 | |||
) | [inline] |
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 >::getDims(), Image< T >::getHeight(), Image< T >::getWidth(), Image< T >::initialized(), and NO_INIT.
Referenced by SimulationViewerNerdCam::drawMaskOutline(), SimulationViewerStd::drawMaskOutline(), and SimulationViewerCompress::getTraj().
int countParticles | ( | const Image< T > & | src, | |
const T | thresh | |||
) | [inline] |
How many particles >= thresh ?
Definition at line 1650 of file Transforms.C.
References fill(), flood(), Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), and Point2D< T >::i.
Image<T_or_RGB> createMask | ( | const Image< T_or_RGB > & | fg, | |
const Image< bool > | mask, | |||
const T_or_RGB | transparent = T_or_RGB() | |||
) | [inline] |
Create a mask of an object and transparent pixels in desired area.
Definition at line 1382 of file Transforms.C.
References ASSERT, Image< T >::begin(), Image< T >::end(), Image< T >::getDims(), Image< T >::isSameSize(), and NO_INIT.
Image<typename promote_trait<T, float>::TP> dct | ( | const Image< T > & | src, | |
const int | offx, | |||
const int | offy, | |||
const int | size | |||
) | [inline] |
Computes 2D discrete cosine transform.
of square image patch size*size at offset (offx, offy)
Definition at line 525 of file Transforms.C.
References ASSERT, Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), Image< T >::initialized(), log(), NO_INIT, and Image< T >::setVal().
Referenced by infoMeasure().
Image<float> distDegrade | ( | const Image< T > & | src, | |
const Point2D< int > & | foa, | |||
const float | area | |||
) | [inline] |
degrades a binary image mask s.t. it decays away from the FOA
Definition at line 1230 of file Transforms.C.
References Image< T >::begin(), exp(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getWidth(), Point2D< T >::i, and ZEROS.
int flood | ( | const Image< T > & | src, | |
Image< T > & | dest, | |||
const Point2D< int > & | seed, | |||
const T | thresh, | |||
const T | val | |||
) | [inline] |
Floods object >= thresh with val from seed and returns area.
Definition at line 1579 of file Transforms.C.
References ASSERT, Image< T >::beginw(), Image< T >::coordsOk(), Image< T >::getDims(), Image< T >::getSize(), Image< T >::getVal(), Image< T >::getWidth(), Point2D< T >::i, Image< T >::initialized(), Image< T >::resize(), and Image< T >::setVal().
Referenced by countParticles(), drawDiskCheckTarget(), VisualBufferStd::findMostInterestingTarget(), CINNICstatsRun::pointAndFlood(), segmentLandmark(), and segmentObject().
int floodClean | ( | const Image< T > & | src, | |
Image< T > & | dest, | |||
const Point2D< int > & | seed, | |||
const T | thresh, | |||
const T | val, | |||
int | numdirs = 8 | |||
) | [inline] |
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.
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 |
Definition at line 1110 of file Transforms.C.
References ASSERT, Image< T >::coordsOk(), Image< T >::getDims(), Image< T >::getVal(), Image< T >::initialized(), Image< T >::resize(), Image< T >::setVal(), and ZEROS.
Referenced by segmentObjectClean().
int floodCleanBB | ( | const Image< T > & | src, | |
Image< T > & | dest, | |||
const Point2D< int > & | seed, | |||
const T | thresh, | |||
const T | val, | |||
Rectangle & | bbox | |||
) | [inline] |
same as floodClean, only finds the bounding box of the region in addition
Definition at line 1166 of file Transforms.C.
References ASSERT, Image< T >::coordsOk(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), Point2D< T >::i, Image< T >::initialized(), Image< T >::resize(), Image< T >::setVal(), Rectangle::tlbrI(), and ZEROS.
Referenced by BitObject::reset().
Image<T> highThresh | ( | const Image< T > & | src, | |
const T | thresh, | |||
const T | val | |||
) | [inline] |
set all values >= thresh to val in src and return the result
Definition at line 1312 of file Transforms.C.
References ASSERT, and Image< T >::initialized().
Referenced by EntropyChannel::doInput().
FFT-based information measure.
Definition at line 867 of file Transforms.C.
References Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), and NO_INIT.
float infoFFT | ( | const Image< T > & | src, | |
const float | eps, | |||
const Rectangle & | rect | |||
) | [inline] |
FFT-based information measure.
Definition at line 856 of file Transforms.C.
References getMinMax(), and infoFFT().
Referenced by infoFFT().
void inplaceAddBGnoise | ( | Image< T > & | dst, | |
const float | range | |||
) | [inline] |
Add background noise to image.
Range should be max value for any image of the type to which we add noise
Definition at line 1673 of file Transforms.C.
References inplaceAddBGnoise2().
Referenced by RawVisualCortex::combineOutputs(), BeoSubSaliency::computeCMAP(), computeCMAP(), ObjDetChannel::doInput(), SingleChannel::postProcessMap(), and BeobotBrainMT::threadCompute().
void inplaceAddBGnoise2 | ( | Image< T > & | dst, | |
const float | range | |||
) | [inline] |
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 1683 of file Transforms.C.
References ASSERT, Image< T >::beginw(), Image< T >::getHeight(), Image< T >::getWidth(), Image< T >::initialized(), min(), and randomDouble().
Referenced by inplaceAddBGnoise().
void inplacePasteGabor | ( | Image< T > & | dst, | |
const Image< T > & | gabor, | |||
const Point2D< int > & | pos, | |||
const T | background | |||
) | [inline] |
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
background | This is the color of the image background |
Definition at line 1546 of file Transforms.C.
References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::getHeight(), Image< T >::getWidth(), and Point2D< T >::i.
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.
Definition at line 1015 of file Transforms.C.
References ASSERT, Image< T >::begin(), binaryReverse(), Image< T >::end(), Image< T >::getSize(), Image< T >::initialized(), Image< T >::isSameSize(), mean(), and sum().
Image<byte> makeBinary | ( | const Image< T > & | src, | |
const T & | threshold, | |||
const byte | lowVal = byte(0) , |
|||
const byte | highVal = byte(255) | |||
) | [inline] |
make a binary version of the source image
src | source image | |
threshold | the threshold used for binarization | |
lowVal | value for all points <= threshold | |
highVal | value for all points > threshold |
Definition at line 1472 of file Transforms.C.
References Image< T >::begin(), Image< T >::getDims(), and NO_INIT.
Referenced by VisualBufferStd::findMostInterestingTarget(), and main().
Image<byte> makeBinary2 | ( | const Image< T > & | src, | |
const T & | lowThresh, | |||
const T & | highThresh, | |||
const byte | lowVal = byte(0) , |
|||
const byte | highVal = byte(255) | |||
) | [inline] |
make a binary version of the source image
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 1485 of file Transforms.C.
References Image< T >::begin(), Image< T >::getDims(), and NO_INIT.
Image<T_or_RGB> mosaic | ( | const Image< T_or_RGB > & | fg, | |
const Image< T_or_RGB > * | bg, | |||
const T_or_RGB * | transvalues, | |||
const uint | Nimages | |||
) | [inline] |
Mosaic mapping of transparent pixels of fg into multiple bg's Equivalent to several simultaneous composite operations
Definition at line 1408 of file Transforms.C.
References ASSERT, Image< T >::begin(), Image< T >::end(), Image< T >::getDims(), Image< T >::isSameSize(), and NO_INIT.
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 | |||
) | [inline] |
paste foreground into background image at location as the upper-left corner in the background frame
transparent | pixels with this value are not replaced in background |
Definition at line 1502 of file Transforms.C.
References Image< T >::begin(), Image< T >::beginw(), Image< T >::getHeight(), Image< T >::getWidth(), and Point2D< T >::i.
Referenced by VisualEventSet::drawTokens(), TestImages::generateScene(), BitObject::getObjectMask(), VisualBufferStd::input(), and main().
Image<T_or_RGB> replaceVals | ( | const Image< T_or_RGB > & | src, | |
const T_or_RGB | from, | |||
const T_or_RGB | to | |||
) | [inline] |
replace all values "from" with "to" and leave all other values in place
Definition at line 1343 of file Transforms.C.
References Image< T >::begin(), Image< T >::getDims(), and NO_INIT.
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 | |||
) | [inline] |
replace all values "from" with "to" and all other values with "other"
Definition at line 1328 of file Transforms.C.
References Image< T >::begin(), Image< T >::getDims(), and NO_INIT.
Referenced by VisualEventSet::drawTokens(), extractBitObjects(), and BitObject::getObjectMask().
Image<T> saliencyChamfer34 | ( | const Image< T > & | src, | |
const T | dmax = 255 | |||
) | [inline] |
3/4-chamfer saliency distance transform; object = non 0
* reset borders */
Definition at line 376 of file Transforms.C.
References ASSERT, Image< T >::beginw(), Image< T >::getDims(), Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getWidth(), Dims::h(), Image< T >::initialized(), and Dims::w().
Image<T_or_RGB> scaleBlock | ( | const Image< T_or_RGB > & | src, | |
const Dims | newDims | |||
) | [inline] |
scale up an image using blocks
Referenced by POMDP::makeObservation().
int segmentLandmark | ( | const Image< T > & | src, | |
const Point2D< int > & | seed, | |||
Image< byte > & | target, | |||
double & | activity, | |||
double & | standout, | |||
float & | area_percentage | |||
) | [inline] |
Segment landmark using an adaptive thresholding & region growing method.
Returns an image that masks the landmark
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 |
Definition at line 101 of file Transforms.C.
References area(), ASSERT, flood(), Image< T >::getSize(), Image< T >::getVal(), Point2D< T >::i, Image< T >::initialized(), and sum().
Referenced by findPeaks(), goodness_map(), and maxNormalizeLandmark().
Image<byte> segmentObject | ( | const Image< T > & | src, | |
const Point2D< int > & | center | |||
) | [inline] |
Segment object using an adaptive thresholding & region growing method.
Returns an image that masks the object (see Itti et al, J Neuroimaging, 2001)
Definition at line 64 of file Transforms.C.
References area(), ASSERT, flood(), Image< T >::getSize(), Image< T >::getVal(), Point2D< T >::i, and Image< T >::initialized().
Image<byte> segmentObjectClean | ( | const Image< T > & | src, | |
const Point2D< int > & | seed, | |||
int | numdirs = 8 | |||
) | [inline] |
same as segmentObject, only with floodClean and different parameters
Definition at line 1259 of file Transforms.C.
References area(), ASSERT, floodClean(), Image< T >::getSize(), Image< T >::getVal(), Point2D< T >::i, and Image< T >::initialized().