IntegerSimpleChannel is like SingleChannel, but avoids floating-point arithmetic. More...
#include <Channels/IntegerSimpleChannel.H>
Public Member Functions | |
IntegerSimpleChannel (OptionManager &mgr, const std::string &descrName, const std::string &tagName, const VisualFeature vs, rutz::shared_ptr< PyrBuilder< int > > pyr, nub::ref< IntegerMathEngine > eng) | |
Constructor. See ChannelBase.H. | |
virtual | ~IntegerSimpleChannel () |
destructor | |
virtual void | reset1 () |
Reset IntegerSimpleChannel. | |
virtual void | readFrom (const ParamMap &pmap) |
Read params from the ParamMap. | |
virtual void | writeTo (ParamMap &pmap) const |
Write params to the ParamMap. | |
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< int > | getSubmapInt (const uint index) const |
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 std::string | getSubmapNameShort (const uint index) const |
Get the name/description of the feature map at the given index, short version. | |
virtual void | getFeatures (const Point2D< int > &locn, std::vector< float > &mean) const |
virtual void | getFeaturesBatch (std::vector< Point2D< int > * > *locn, std::vector< std::vector< float > > *mean, int *count) const |
virtual Image< int > | getOutputInt () |
virtual Image< float > | getOutput () |
This is just a caching wrapper around combineSubMaps(). | |
virtual void | saveResults (const nub::ref< FrameOstream > &ofs) |
Save our various maps using an FrameOstream. | |
LevelSpec | getLevelSpec () const |
get our the LevelSpec | |
virtual void | killCaches () |
IntegerSimpleChannel implements this to clear its cached output. | |
virtual Image< float > | getRawCSmap (const uint idx) const |
get raw CS map; part of getSubmap() | |
virtual Image< int > | getRawCSmapInt (const uint idx) const |
get raw CS map; part of getSubmap() | |
void | setTakeAbs (bool val) |
void | setNormalizeOutput (bool val) |
const ImageSet< int > & | intgPyramid () |
int | getMinPyrLevel () const |
int | getMaxPyrLevel () const |
void | setPyrBuilder (rutz::shared_ptr< PyrBuilder< int > > pbuild) |
Install a new PyrBuilder object. | |
Protected Member Functions | |
virtual void | doInputInt (const IntegerInput &inp, const SimTime &t, PyramidCache< int > *cache, const Image< byte > &clipMask) |
virtual void | start1 () |
get us started (see ModelComponent.H) | |
virtual void | stop2 () |
get us stopped (see ModelComponent.H) | |
uint | csToIndex (uint centerlev, uint surroundlev) const |
shortcut to the csToIndex function of itsLevelSpec: | |
Protected Attributes | |
NModelParam< bool > | itsTakeAbs |
NModelParam< bool > | itsNormalizeOutput |
NModelParam< bool > | itsScaleNoiseToMax |
NModelParam< int > | itsLowThresh |
NModelParam< bool > | itsRectifyPyramid |
OModelParam< bool > | itsUseRandom |
OModelParam< LevelSpec > | itsLevelSpec |
OModelParam< MaxNormType > | itsNormType |
OModelParam< int > | itsQlen |
OModelParam< bool > | itsUseOlderVersion |
OModelParam< bool > | itsSaveRawMaps |
Save our raw pyramid levels? | |
OModelParam< bool > | itsSaveFeatureMaps |
Save our center-surround feature maps? | |
OModelParam< bool > | itsSaveOutputMap |
Save our output map? | |
OModelParam< int > | itsOutputRangeMin |
Set a fixed range of values for the raw output. | |
OModelParam< int > | itsOutputRangeMax |
IntegerSimpleChannel is like SingleChannel, but avoids floating-point arithmetic.
Definition at line 54 of file IntegerSimpleChannel.H.
IntegerSimpleChannel::IntegerSimpleChannel | ( | OptionManager & | mgr, | |
const std::string & | descrName, | |||
const std::string & | tagName, | |||
const VisualFeature | vs, | |||
rutz::shared_ptr< PyrBuilder< int > > | pyr, | |||
nub::ref< IntegerMathEngine > | eng | |||
) |
Constructor. See ChannelBase.H.
mgr | our ModelManager (see ModelManager.H) | |
descrName | descriptive name for human usage | |
tagName | name for ParamMap usage | |
vs | The VisualFeature implemented by the channel | |
pyr | The type of pyramid that should be used. |
Definition at line 67 of file IntegerSimpleChannel.C.
IntegerSimpleChannel::~IntegerSimpleChannel | ( | ) | [virtual] |
destructor
Definition at line 99 of file IntegerSimpleChannel.C.
shortcut to the csToIndex function of itsLevelSpec:
If you overload this, make sure you call IntegerSimpleChannel::stop1() at the beginning of your overload
Definition at line 468 of file IntegerSimpleChannel.C.
References LevelSpec::csToIndex(), and OModelParam< T >::getVal().
LevelSpec IntegerSimpleChannel::getLevelSpec | ( | ) | const |
get our the LevelSpec
Definition at line 392 of file IntegerSimpleChannel.C.
References OModelParam< T >::getVal().
Dims IntegerSimpleChannel::getMapDims | ( | ) | const [virtual] |
Return the dimensions of the output image.
Implements ChannelBase.
Definition at line 187 of file IntegerSimpleChannel.C.
References ChannelBase::getInputDims(), OModelParam< T >::getVal(), and LevelSpec::mapLevel().
virtual Image<float> IntegerSimpleChannel::getOutput | ( | ) | [inline, virtual] |
This is just a caching wrapper around combineSubMaps().
Implements ChannelBase.
Definition at line 104 of file IntegerSimpleChannel.H.
Referenced by saveResults().
get raw CS map; part of getSubmap()
Reimplemented from ChannelBase.
Definition at line 121 of file IntegerSimpleChannel.H.
References getRawCSmapInt().
get raw CS map; part of getSubmap()
Implements IntegerChannel.
Definition at line 269 of file IntegerSimpleChannel.C.
References ASSERT, getMinMax(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), LevelSpec::indexOK(), LevelSpec::indexToCS(), ImageSet< T >::isEmpty(), MYLOGVERB, and ModelComponent::tagName().
Referenced by getRawCSmap().
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 87 of file IntegerSimpleChannel.H.
std::string IntegerSimpleChannel::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 295 of file IntegerSimpleChannel.C.
References ASSERT, ModelComponent::descriptiveName(), OModelParam< T >::getVal(), LevelSpec::indexOK(), LevelSpec::indexToCS(), and sformat().
std::string IntegerSimpleChannel::getSubmapNameShort | ( | const uint | index | ) | const [virtual] |
Get the name/description of the feature map at the given index, short version.
Implements ChannelBase.
Definition at line 308 of file IntegerSimpleChannel.C.
References ASSERT, OModelParam< T >::getVal(), LevelSpec::indexOK(), LevelSpec::indexToCS(), sformat(), and ModelComponent::tagName().
void IntegerSimpleChannel::killCaches | ( | ) | [virtual] |
IntegerSimpleChannel implements this to clear its cached output.
Reimplemented from ChannelBase.
Definition at line 335 of file IntegerSimpleChannel.C.
References Image< T >::freeMem(), OModelParam< T >::getVal(), LevelSpec::maxIndex(), and ModelComponent::started().
Referenced by reset1(), and setPyrBuilder().
uint IntegerSimpleChannel::numSubmaps | ( | ) | const [virtual] |
Return the number of feature maps represented by this channel.
Implements ChannelBase.
Definition at line 197 of file IntegerSimpleChannel.C.
References OModelParam< T >::getVal(), and LevelSpec::maxIndex().
Referenced by saveResults().
bool IntegerSimpleChannel::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 179 of file IntegerSimpleChannel.C.
References Image< T >::initialized(), and ImageSet< T >::isEmpty().
void IntegerSimpleChannel::readFrom | ( | const ParamMap & | pmap | ) | [virtual] |
Read params from the ParamMap.
Reimplemented from ChannelBase.
Definition at line 155 of file IntegerSimpleChannel.C.
References ChannelFacetMap::readFacetsFrom(), and ModelComponent::started().
void IntegerSimpleChannel::reset1 | ( | ) | [virtual] |
Reset IntegerSimpleChannel.
See the base function in ModelComponent.H for info.
Reimplemented from ChannelBase.
Reimplemented in IntegerFlickerChannel.
Definition at line 141 of file IntegerSimpleChannel.C.
References ImageSet< T >::clear(), killCaches(), and rutz::shared_ptr< T >::reset().
void IntegerSimpleChannel::saveResults | ( | const nub::ref< FrameOstream > & | ofs | ) | [virtual] |
Save our various maps using an FrameOstream.
Depending on our ModelParam settings, we can save raw pyramid levels (with name prefix "SR<tagname>-<level>-"), center-surround feature maps ("SF<tagname>-<ctr>-<surr>-"), and output map ("SO<tagname>-")
Reimplemented from ChannelBase.
Definition at line 476 of file IntegerSimpleChannel.C.
References ModelComponent::descriptiveName(), FLOAT_NORM_0_255, getOutput(), OModelParam< T >::getVal(), LevelSpec::indexToCS(), ImageSet< T >::isEmpty(), itsSaveFeatureMaps, itsSaveOutputMap, itsSaveRawMaps, numSubmaps(), sformat(), ImageSet< T >::size(), SRC_POS, and ModelComponent::tagName().
void IntegerSimpleChannel::setPyrBuilder | ( | rutz::shared_ptr< PyrBuilder< int > > | pbuild | ) |
Install a new PyrBuilder object.
Definition at line 518 of file IntegerSimpleChannel.C.
References ASSERT, and killCaches().
void IntegerSimpleChannel::start1 | ( | ) | [protected, virtual] |
get us started (see ModelComponent.H)
If you overload this, make sure you call IntegerSimpleChannel::start1() at the beginning of your overload
Reimplemented from ModelComponent.
Reimplemented in IntegerDirectionChannel.
Definition at line 105 of file IntegerSimpleChannel.C.
References rutz::shared_ptr< T >::get(), OModelParam< T >::getVal(), itsOutputRangeMin, LevelSpec::maxIndex(), OModelParam< T >::setVal(), and VCXNORM_MAXNORM.
void IntegerSimpleChannel::stop2 | ( | ) | [protected, virtual] |
get us stopped (see ModelComponent.H)
If you overload this, make sure you call IntegerSimpleChannel::start1() at the beginning of your overload
Reimplemented from ModelComponent.
Definition at line 134 of file IntegerSimpleChannel.C.
void IntegerSimpleChannel::writeTo | ( | ParamMap & | pmap | ) | const [virtual] |
Write params to the ParamMap.
Reimplemented from ChannelBase.
Definition at line 167 of file IntegerSimpleChannel.C.
References ModelComponent::started(), and ChannelFacetMap::writeFacetsTo().
OModelParam<int> IntegerSimpleChannel::itsOutputRangeMin [protected] |
Set a fixed range of values for the raw output.
By default, the range is set to [MAXNORMMIN .. MAXNORMMAX] at construction. If non-zero values are provided here, in getOutput() we will cumulate our various submaps, apply the provided range, apply spatial competition for salience, apply our total weight, and return the result. If a range [0.0 .. 0.0] is provided here, only spatial competition and weights will be applied, but the first step of applying the range will be skipped. This must be called before start().
Definition at line 182 of file IntegerSimpleChannel.H.
Referenced by start1().
OModelParam<bool> IntegerSimpleChannel::itsSaveFeatureMaps [protected] |
Save our center-surround feature maps?
Definition at line 168 of file IntegerSimpleChannel.H.
Referenced by saveResults().
OModelParam<bool> IntegerSimpleChannel::itsSaveOutputMap [protected] |
Save our output map?
Definition at line 171 of file IntegerSimpleChannel.H.
Referenced by saveResults().
OModelParam<bool> IntegerSimpleChannel::itsSaveRawMaps [protected] |
Save our raw pyramid levels?
Definition at line 165 of file IntegerSimpleChannel.H.
Referenced by saveResults().