Public Member Functions | |
RetinaAdapter (OptionManager &mgr, const std::string &descrName="RetinaAdapter", const std::string &tagName="RetinaAdapter") | |
Constructor. | |
virtual | ~RetinaAdapter () |
Destructor. | |
Protected Member Functions | |
SIMCALLBACK_DECLARE (RetinaAdapter, SimEventInputFrame) | |
Callback for when a new input frame is available. | |
SIMCALLBACK_DECLARE (RetinaAdapter, SimEventSaccadeStatusEye) | |
Callback for when a new eye movement is available. | |
SIMCALLBACK_DECLARE (RetinaAdapter, SimEventSaveOutput) | |
Callback for every time we should save our outputs. | |
virtual void | start1 () |
Overridden so we can load our clip mask file, if any. | |
Image< PixRGB< byte > > | getOutput (const Image< PixRGB< byte > > &inp, const Point2D< int > &eyepos, const bool inBlink) |
Compute a new output. | |
virtual void | postInputFrame (SimEventQueue &q, InputFrame &ifr) |
virtual Image< PixRGB< byte > > | transform (const Image< PixRGB< byte > > &image)=0 |
Transform the image after it has already been shifted, cropped, foveated, etc. | |
virtual Rectangle | getRawInputRectangle (const Dims &indims, const Dims &outdims) const |
Get a rectangle delineating the raw input image area. | |
Point2D< int > | getRawToRetinalOffset () const |
Get raw to retinal offset. | |
virtual void | save1 (const ModelComponentSaveInfo &sinfo) |
Save our internals. | |
Protected Attributes | |
OModelParam< std::string > | itsClipMaskFname |
filename of a clipmask image to load; or empty string for no clipmask | |
OModelParam< int > | itsRawInpRectBorder |
Border for our raw input rectangle, in pixels. | |
OModelParam< Point2D< int > > | itsInitialEyePosition |
Initial eye position (to foveate first frame). | |
OModelParam< bool > | itsEnablePyramidCaches |
Whether to allow pyramid caches in the InputFrame objects that we create. | |
OModelParam< int > | itsFoveaRadius |
Radius of our fovea. | |
OModelParam< bool > | itsSaveInput |
Save our raw input? | |
OModelParam< bool > | itsSaveOutput |
Save our output image? | |
OModelParam< std::string > | itsFramingImageName |
Image file to use for input framing. | |
OModelParam< Point2D< int > > | itsFramingImagePos |
Offset to apply for input framing. | |
OModelParam< uint > | itsFoveateInputDepth |
Pyramid depth to use when foveating the input, or 0 for no foveation. | |
OModelParam< bool > | itsShiftInput |
shift input to eye position? | |
OModelParam< PixRGB< byte > > | itsShiftInputBGcol |
background color to use when shifting input to eye position | |
OModelParam< Dims > | itsInputFOV |
crop input to a given FOV? | |
OModelParam< bool > | itsSavePyr |
Save our internal pyramid? | |
OModelParam< bool > | itsBlankBlink |
Blank out visual inputs during blinks? | |
OModelParam< std::string > | itsRetMaskFname |
filename of a retinal mask image to load; or empty string for no mask | |
OModelParam< bool > | itsFlipHoriz |
flip input image horizontally? | |
OModelParam< bool > | itsFlipVertic |
flip input image vertically? | |
Image< byte > | itsClipMask |
mask to eliminate parts of scene | |
Point2D< int > | itsEyePos |
current eye position | |
bool | itsEyeBlinkStatus |
are we in blink? | |
Image< PixRGB< byte > > | itsRawInput |
copy of input in case we want to save it | |
Image< PixRGB< byte > > | itsOutput |
copy of output in case we want to save it | |
Image< PixRGB< byte > > | itsFramingImage |
image used for framing | |
Point2D< int > | itsRetinalShift |
Image< byte > | itsRetMask |
ImageSet< PixRGB< byte > > | itsMultiRetina |
Definition at line 81 of file Retina.H.
RetinaAdapter::RetinaAdapter | ( | OptionManager & | mgr, | |
const std::string & | descrName = "RetinaAdapter" , |
|||
const std::string & | tagName = "RetinaAdapter" | |||
) |
Image< PixRGB< byte > > RetinaAdapter::getOutput | ( | const Image< PixRGB< byte > > & | inp, | |
const Point2D< int > & | eyepos, | |||
const bool | inBlink | |||
) | [protected] |
Compute a new output.
Do not overload this in derived classes, instead overload transform() below.
Definition at line 286 of file Retina.C.
References buildPyrGaussian(), Image< T >::clear(), drawDisk(), flipHoriz(), flipVertic(), foveate(), Image< T >::getDims(), Image< T >::getHeight(), OModelParam< T >::getVal(), Image< T >::getWidth(), Point2D< T >::i, Image< T >::initialized(), inplacePaste(), Image< T >::isSameSize(), Point2D< T >::isValid(), itsBlankBlink, itsFlipHoriz, itsFlipVertic, itsFoveaRadius, itsFoveateInputDepth, itsFramingImage, itsFramingImagePos, itsInputFOV, itsOutput, itsShiftInput, itsShiftInputBGcol, shiftClean(), transform(), and ZEROS.
Rectangle RetinaAdapter::getRawInputRectangle | ( | const Dims & | indims, | |
const Dims & | outdims | |||
) | const [protected, virtual] |
Get a rectangle delineating the raw input image area.
As the raw input may be embedded into a background, shifted, cropped by a field of view, etc., this function allows users to recover the boundaries of the original frames. Note that the rectangle will be possibly cropped to fit within the dims of the Retina's output. A border may be specified that will be used to shrink (if positive) or enlarge (if negative) the returned rectangle (and will be applied before the rectangle is cropped to dims). The default implementation in the base class is to just return a rectangle at (0,0) with dims of the raw input.
Reimplemented in RetinaCT.
Definition at line 216 of file Retina.C.
References Rectangle::getOverlap(), OModelParam< T >::getVal(), Dims::h(), Point2D< T >::i, itsFramingImagePos, itsRawInpRectBorder, Rectangle::tlbrI(), and Dims::w().
Referenced by postInputFrame().
Point2D< int > RetinaAdapter::getRawToRetinalOffset | ( | ) | const [protected] |
Get raw to retinal offset.
Definition at line 228 of file Retina.C.
References OModelParam< T >::getVal(), and itsFramingImagePos.
Referenced by postInputFrame(), and RetinaCT::postInputFrame().
void RetinaAdapter::postInputFrame | ( | SimEventQueue & | q, | |
InputFrame & | ifr | |||
) | [protected, virtual] |
post our input frame with a SimEventRetinaImage message. Derived classes may want to post messages derived from SimEventRetinaImage
Reimplemented in RetinaCT.
Definition at line 207 of file Retina.C.
References Image< T >::getDims(), getRawInputRectangle(), getRawToRetinalOffset(), itsRawInput, and SimEventQueue::post().
void RetinaAdapter::save1 | ( | const ModelComponentSaveInfo & | sinfo | ) | [protected, virtual] |
Save our internals.
Depending on our ModelParam settings, we can save our raw input frames (with name prefix "RETIN-"), and/or our foveated output images (prefix "RETOUT-"), and/or our pyramid frames (with name prefix "RET<level>-").
Reimplemented from ModelComponent.
Definition at line 264 of file Retina.C.
References OModelParam< T >::getVal(), Image< T >::initialized(), itsOutput, itsRawInput, itsSaveInput, itsSaveOutput, itsSavePyr, sformat(), ImageSet< T >::size(), and SRC_POS.
RetinaAdapter::SIMCALLBACK_DECLARE | ( | RetinaAdapter | , | |
SimEventSaveOutput | ||||
) | [protected] |
Callback for every time we should save our outputs.
RetinaAdapter::SIMCALLBACK_DECLARE | ( | RetinaAdapter | , | |
SimEventSaccadeStatusEye | ||||
) | [protected] |
Callback for when a new eye movement is available.
RetinaAdapter::SIMCALLBACK_DECLARE | ( | RetinaAdapter | , | |
SimEventInputFrame | ||||
) | [protected] |
Callback for when a new input frame is available.
void RetinaAdapter::start1 | ( | ) | [protected, virtual] |
Overridden so we can load our clip mask file, if any.
Reimplemented from SimModule.
Reimplemented in RetinaCT.
Definition at line 232 of file Retina.C.
References Image< T >::getHeight(), OModelParam< T >::getVal(), Image< T >::getWidth(), itsClipMask, itsClipMaskFname, itsFramingImage, itsFramingImageName, itsRetMaskFname, Raster::ReadGray(), and Raster::ReadRGB().
virtual Image<PixRGB<byte> > RetinaAdapter::transform | ( | const Image< PixRGB< byte > > & | image | ) | [protected, pure virtual] |
Transform the image after it has already been shifted, cropped, foveated, etc.
Implemented in RetinaStd, and RetinaCT.
Referenced by getOutput().
OModelParam<bool> RetinaAdapter::itsBlankBlink [protected] |
Blank out visual inputs during blinks?
Definition at line 147 of file Retina.H.
Referenced by getOutput().
Image<byte> RetinaAdapter::itsClipMask [protected] |
OModelParam<std::string> RetinaAdapter::itsClipMaskFname [protected] |
OModelParam<bool> RetinaAdapter::itsEnablePyramidCaches [protected] |
Whether to allow pyramid caches in the InputFrame objects that we create.
bool RetinaAdapter::itsEyeBlinkStatus [protected] |
Point2D<int> RetinaAdapter::itsEyePos [protected] |
OModelParam<bool> RetinaAdapter::itsFlipHoriz [protected] |
OModelParam<bool> RetinaAdapter::itsFlipVertic [protected] |
OModelParam<int> RetinaAdapter::itsFoveaRadius [protected] |
OModelParam<uint> RetinaAdapter::itsFoveateInputDepth [protected] |
Pyramid depth to use when foveating the input, or 0 for no foveation.
Definition at line 132 of file Retina.H.
Referenced by getOutput().
Image< PixRGB<byte> > RetinaAdapter::itsFramingImage [protected] |
image used for framing
Definition at line 199 of file Retina.H.
Referenced by getOutput(), and start1().
OModelParam<std::string> RetinaAdapter::itsFramingImageName [protected] |
OModelParam<Point2D<int> > RetinaAdapter::itsFramingImagePos [protected] |
Offset to apply for input framing.
Definition at line 129 of file Retina.H.
Referenced by getOutput(), getRawInputRectangle(), and getRawToRetinalOffset().
OModelParam<Point2D<int> > RetinaAdapter::itsInitialEyePosition [protected] |
OModelParam<Dims> RetinaAdapter::itsInputFOV [protected] |
Image<PixRGB<byte> > RetinaAdapter::itsOutput [protected] |
copy of output in case we want to save it
Definition at line 197 of file Retina.H.
Referenced by getOutput(), and save1().
OModelParam<int> RetinaAdapter::itsRawInpRectBorder [protected] |
Border for our raw input rectangle, in pixels.
Definition at line 105 of file Retina.H.
Referenced by getRawInputRectangle().
Image<PixRGB<byte> > RetinaAdapter::itsRawInput [protected] |
copy of input in case we want to save it
Definition at line 196 of file Retina.H.
Referenced by postInputFrame(), RetinaCT::postInputFrame(), and save1().
OModelParam<std::string> RetinaAdapter::itsRetMaskFname [protected] |
OModelParam<bool> RetinaAdapter::itsSaveInput [protected] |
OModelParam<bool> RetinaAdapter::itsSaveOutput [protected] |
OModelParam<bool> RetinaAdapter::itsSavePyr [protected] |
OModelParam<bool> RetinaAdapter::itsShiftInput [protected] |
OModelParam< PixRGB<byte> > RetinaAdapter::itsShiftInputBGcol [protected] |
background color to use when shifting input to eye position
Definition at line 138 of file Retina.H.
Referenced by getOutput().