Direct Feed Channel. More...
#include <Channels/DirectFeedChannel.H>
Public Member Functions | |
DirectFeedChannel (OptionManager &mgr, int id=-1) | |
Constructor. | |
virtual | ~DirectFeedChannel () |
Destructor. | |
virtual void | reset1 () |
Reset SingleChannel. | |
virtual void | readFrom (const ParamMap &pmap) |
Read params from the ParamMap. | |
virtual void | writeTo (ParamMap &pmap) const |
Write params to the ParamMap. | |
void | clampCoeffs (const double cmin, const double cmax) |
Clamp the weighting coefficients to the specified range. | |
double | absSumCoeffs () const |
Return the sum of the absolute values of the weighting coefficients. | |
void | setCoeff (const uint idx, const double val) |
set coefficient idx to val | |
double | getCoeff (const uint idx) const |
returns coefficient idx | |
void | normalizeCoeffs (const double div) |
Normalize the weighting coefficients by dividing by div. | |
void | initializeCoeffs (const uint numCoeffs, const double val=1.0) |
initialize the coefficients to value val | |
virtual bool | outputAvailable () const |
Query whether the channel is ready to give yield valid output. | |
virtual Dims | getMapDims () const |
Return the dimensions of the output image. | |
virtual uint | numSubmaps () const |
Return the number of feature maps represented by this channel. | |
virtual Image< float > | getSubmap (const uint index) const |
Get the feature map at the given index. | |
virtual std::string | getSubmapName (const uint index) const |
Get the name/description of the feature map at the given index. | |
virtual void | getFeatures (const Point2D< int > &locn, std::vector< float > &mean) const |
not implemented | |
virtual void | getFeaturesBatch (std::vector< Point2D< int > * > *locn, std::vector< std::vector< float > > *mean, int *count) const |
not implemented | |
virtual Image< float > | getOutput () |
The output will be the size of the feature map level in the pyramid. | |
virtual void | killCaches () |
erase all internal caches | |
void | inputPyramid (const ImageSet< float > &pyramid, const SimTime &t) |
Send an already computed pyramid as input to the channel. | |
Protected Member Functions | |
virtual void | start1 () |
This is called from within start() before the subcomponents start. | |
virtual void | doInput (const InputFrame &inframe) |
the actual input routine | |
virtual void | computeOutput () |
computed the output of the channel | |
virtual Image< float > | applyMaxNorm (Image< float > &map) |
applies the max norm to map depending on itsNormType | |
Protected Attributes | |
OModelParam< uint > | itsMapLevel |
the level at which the saliency map lives | |
OModelParam< MaxNormType > | itsNormType |
the kind of normalization to be applied | |
OModelParam< bool > | itsUseOlderVersion |
OModelParam< float > | itsOutputRangeMin |
OModelParam< float > | itsOutputRangeMax |
Direct Feed Channel.
Definition at line 49 of file DirectFeedChannel.H.
DirectFeedChannel::DirectFeedChannel | ( | OptionManager & | mgr, | |
int | id = -1 | |||
) |
Constructor.
id | if given, becomes part of the name of the channel |
Definition at line 49 of file DirectFeedChannel.C.
References ModelComponent::setDescriptiveName(), ModelComponent::setTagName(), and toStr().
DirectFeedChannel::~DirectFeedChannel | ( | ) | [virtual] |
Destructor.
Definition at line 67 of file DirectFeedChannel.C.
double DirectFeedChannel::absSumCoeffs | ( | ) | const |
Return the sum of the absolute values of the weighting coefficients.
Definition at line 128 of file DirectFeedChannel.C.
applies the max norm to map depending on itsNormType
Definition at line 267 of file DirectFeedChannel.C.
References ASSERT, OModelParam< T >::getVal(), Image< T >::initialized(), itsNormType, and maxNormalize().
Referenced by computeOutput().
void DirectFeedChannel::clampCoeffs | ( | const double | cmin, | |
const double | cmax | |||
) |
Clamp the weighting coefficients to the specified range.
Definition at line 120 of file DirectFeedChannel.C.
References clampValue(), and killCaches().
void DirectFeedChannel::computeOutput | ( | ) | [protected, virtual] |
computed the output of the channel
Definition at line 251 of file DirectFeedChannel.C.
References applyMaxNorm(), ASSERT, getMapDims(), rescale(), ImageSet< T >::size(), and ZEROS.
Referenced by getOutput().
void DirectFeedChannel::doInput | ( | const InputFrame & | inframe | ) | [protected, virtual] |
the actual input routine
Only colimg or bwimg ar needed to obtain the dimensions. After each call of doinput, inputPyramid must be called.
Implements ChannelBase.
Definition at line 181 of file DirectFeedChannel.C.
References ChannelBase::getInputDims(), OModelParam< T >::getVal(), Image< T >::initialized(), itsMapLevel, SimTime::msecs(), and toStr().
double DirectFeedChannel::getCoeff | ( | const uint | idx | ) | const |
returns coefficient idx
Definition at line 155 of file DirectFeedChannel.C.
References ASSERT, and numSubmaps().
void DirectFeedChannel::getFeatures | ( | const Point2D< int > & | locn, | |
std::vector< float > & | mean | |||
) | const [virtual] |
virtual void DirectFeedChannel::getFeaturesBatch | ( | std::vector< Point2D< int > * > * | locn, | |
std::vector< std::vector< float > > * | mean, | |||
int * | count | |||
) | const [virtual] |
not implemented
Implements ChannelBase.
Dims DirectFeedChannel::getMapDims | ( | ) | const [virtual] |
Return the dimensions of the output image.
Implements ChannelBase.
Definition at line 212 of file DirectFeedChannel.C.
Referenced by computeOutput().
Image< float > DirectFeedChannel::getOutput | ( | ) | [virtual] |
The output will be the size of the feature map level in the pyramid.
(I.e., the size of the output is given by getMapDims().
Implements ChannelBase.
Definition at line 242 of file DirectFeedChannel.C.
References ASSERT, computeOutput(), and Image< T >::initialized().
Referenced by MultiDirectFeedChannel::combineOutputs().
Get the feature map at the given index.
This function is intended to be implemented by subclasses so that it recurses into any nested channels, mapping nested submaps into a linear sequence of indices.
Implements ChannelBase.
Definition at line 220 of file DirectFeedChannel.C.
References ASSERT, and numSubmaps().
std::string DirectFeedChannel::getSubmapName | ( | const uint | index | ) | const [virtual] |
Get the name/description of the feature map at the given index.
This function is intended to be implemented by subclasses so that it recurses into any nested channels, mapping nested submaps into a linear sequence of indices. The output of this function is intended only to be human-readable (e.g. for labeling image displays), and does not have to follow any particular parseable syntax.
Implements ChannelBase.
Definition at line 227 of file DirectFeedChannel.C.
References ASSERT, ModelComponent::descriptiveName(), numSubmaps(), and sformat().
void DirectFeedChannel::initializeCoeffs | ( | const uint | numCoeffs, | |
const double | val = 1.0 | |||
) |
initialize the coefficients to value val
Definition at line 162 of file DirectFeedChannel.C.
Referenced by inputPyramid(), and setCoeff().
Send an already computed pyramid as input to the channel.
Must be called after each call of input.
Definition at line 169 of file DirectFeedChannel.C.
References ASSERT, initializeCoeffs(), SimTime::msecs(), and ImageSet< T >::size().
Referenced by MultiDirectFeedChannel::inputPyramid().
void DirectFeedChannel::killCaches | ( | ) | [virtual] |
erase all internal caches
Reimplemented from ChannelBase.
Definition at line 277 of file DirectFeedChannel.C.
References Image< T >::freeMem(), and SimTime::SECS().
Referenced by clampCoeffs(), normalizeCoeffs(), and setCoeff().
void DirectFeedChannel::normalizeCoeffs | ( | const double | div | ) |
Normalize the weighting coefficients by dividing by div.
Definition at line 137 of file DirectFeedChannel.C.
References killCaches().
uint DirectFeedChannel::numSubmaps | ( | ) | const [virtual] |
Return the number of feature maps represented by this channel.
Implements ChannelBase.
Definition at line 216 of file DirectFeedChannel.C.
References ImageSet< T >::size().
Referenced by getCoeff(), getSubmap(), getSubmapName(), and setCoeff().
bool DirectFeedChannel::outputAvailable | ( | ) | const [virtual] |
Query whether the channel is ready to give yield valid output.
In some cases (e.g. with motion channels), it may take several input frames before the channel is fully initialized.
Implements ChannelBase.
Definition at line 204 of file DirectFeedChannel.C.
References SimTime::msecs().
void DirectFeedChannel::readFrom | ( | const ParamMap & | pmap | ) | [virtual] |
Read params from the ParamMap.
Reimplemented from ChannelBase.
Definition at line 106 of file DirectFeedChannel.C.
void DirectFeedChannel::reset1 | ( | ) | [virtual] |
Reset SingleChannel.
See the base function in ModelComponent.H for info.
Reimplemented from ChannelBase.
Definition at line 93 of file DirectFeedChannel.C.
References Image< T >::freeMem(), ImageSet< T >::reset(), SimTime::SECS(), and SimTime::ZERO().
void DirectFeedChannel::setCoeff | ( | const uint | idx, | |
const double | val | |||
) |
set coefficient idx to val
Definition at line 145 of file DirectFeedChannel.C.
References ASSERT, initializeCoeffs(), ImageSet< T >::isEmpty(), killCaches(), and numSubmaps().
void DirectFeedChannel::start1 | ( | ) | [protected, virtual] |
This is called from within start() before the subcomponents start.
Reimplemented from ModelComponent.
Definition at line 71 of file DirectFeedChannel.C.
References OModelParam< T >::getVal(), itsNormType, OModelParam< T >::setVal(), and VCXNORM_MAXNORM.
void DirectFeedChannel::writeTo | ( | ParamMap & | pmap | ) | const [virtual] |
Write params to the ParamMap.
Reimplemented from ChannelBase.
Definition at line 113 of file DirectFeedChannel.C.
OModelParam<uint> DirectFeedChannel::itsMapLevel [protected] |
the level at which the saliency map lives
Definition at line 149 of file DirectFeedChannel.H.
Referenced by doInput().
OModelParam<MaxNormType> DirectFeedChannel::itsNormType [protected] |
the kind of normalization to be applied
Definition at line 152 of file DirectFeedChannel.H.
Referenced by applyMaxNorm(), and start1().