JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Simple wrapper class around Rob Peter's C-optimized, fixed-point-math visual saliency code. More...
#include <jevoisbase/Components/Saliency/Saliency.H>
Classes | |
struct | visitor_data |
Public Member Functions | |
Saliency (std::string const &instance) | |
Constructor. | |
virtual | ~Saliency () |
Destructor. | |
void | process (jevois::RawImage const &input, bool do_gist) |
Process a raw YUYV image. Results are stored in the Saliency class. | |
void | process (cv::Mat const &input, bool do_gist) |
Process an RGB image. Results are stored in the Saliency class. | |
void | waitUntilDoneWithInput () const |
Wait until process() is done using the input image. | |
void | getSaliencyMax (int &x, int &y, intg32 &value) |
Get location and value of max point in the saliency map. | |
void | inhibitionOfReturn (int const x, int const y, float const sigma) |
Inhibit the saliency map around a point, sigma is in pixels at the sacle of the map. | |
Public Member Functions inherited from jevois::Component | |
Component (std::string const &instance) | |
virtual | ~Component () |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
Public Member Functions inherited from jevois::ParameterRegistry | |
virtual | ~ParameterRegistry () |
Public Attributes | |
struct env_image | salmap |
The saliency map. | |
struct env_image | intens |
struct env_image | color |
struct env_image | ori |
struct env_image | flicker |
struct env_image | motion |
unsigned char * | gist |
Gist vector has 1152 entries, 72 feature maps * 16 values/map. | |
size_t const | gist_size |
Related Symbols | |
(Note that these are not member symbols.) | |
JEVOIS_DECLARE_PARAMETER (cweight, byte, "Color channel weight", 255, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (iweight, byte, "Intensity channel weight", 255, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (oweight, byte, "Orientation channel weight", 255, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (fweight, byte, "Flicker channel weight", 255, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (mweight, byte, "Motion channel weight", 255, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (centermin, size_t, "Lowest (finest) of the 3 center scales", 2, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (deltamin, size_t, "Lowest (finest) of the 2 center-surround delta scales", 3, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (smscale, size_t, "Scale of the saliency map", 4, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (mthresh, byte, "Motion threshold", 0, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (fthresh, byte, "Flicker threshold", 0, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (msflick, bool, "Use multiscale flicker computation", false, ParamCateg) | |
Parameter. | |
void | drawMap (jevois::RawImage &img, env_image const *fmap, unsigned int xoff, unsigned int yoff, unsigned int scale) |
Draw a saliency map or feature map in a YUYV image. | |
void | drawMap (jevois::RawImage &img, env_image const *fmap, unsigned int xoff, unsigned int yoff, unsigned int scale, unsigned int bitshift) |
Draw a saliency map or feature map in a YUYV image, applying some right bitshift to values. | |
void | drawGist (jevois::RawImage &img, unsigned char const *gist, size_t gistsize, unsigned int xoff, unsigned int yoff, unsigned int width, unsigned int scale) |
Draw a gist vector in a YUYV image as a rectangle of width width*scale and correct height. | |
Additional Inherited Members | |
Protected Member Functions inherited from jevois::Component | |
virtual void | preInit () |
virtual void | postInit () |
virtual void | preUninit () |
virtual void | postUninit () |
virtual void | preInit () |
virtual void | postInit () |
virtual void | preUninit () |
virtual void | postUninit () |
Protected Member Functions inherited from jevois::ParameterRegistry | |
void | addParameter (ParameterBase *const param) |
void | removeParameter (ParameterBase *const param) |
void | callbackInitCall () |
Simple wrapper class around Rob Peter's C-optimized, fixed-point-math visual saliency code.
This component implements a visual saliency detector using the algorithm from Itti et al., IEEE Trans PAMI,
Note that the Saliency component here imposes some restrictions on the saliency computations:
See the research paper at http://ilab.usc.edu/publications/doc/Itti_etal98pami.pdf
Definition at line 95 of file Saliency.H.
Saliency::Saliency | ( | std::string const & | instance | ) |
Constructor.
Definition at line 81 of file Saliency.C.
References color, env_img_initializer, env_init_integer_math(), env_motion_channel_init(), env_params_set_defaults(), env_pyr_init(), Saliency::visitor_data::envp, flicker, gist, Saliency::visitor_data::gist, gist_size, Saliency::visitor_data::gist_size, intens, motion, ori, and salmap.
|
virtual |
Destructor.
Definition at line 106 of file Saliency.C.
References env_img_make_empty(), env_motion_channel_destroy(), env_pyr_make_empty(), and gist.
void Saliency::getSaliencyMax | ( | int & | x, |
int & | y, | ||
intg32 & | value | ||
) |
Get location and value of max point in the saliency map.
Definition at line 672 of file Saliency.C.
References env_image::dims, env_dims::h, LFATAL, env_image::pixels, salmap, and env_dims::w.
void Saliency::inhibitionOfReturn | ( | int const | x, |
int const | y, | ||
float const | sigma | ||
) |
Inhibit the saliency map around a point, sigma is in pixels at the sacle of the map.
Definition at line 686 of file Saliency.C.
References env_image::dims, env_dims::h, LFATAL, env_image::pixels, salmap, and env_dims::w.
void Saliency::process | ( | cv::Mat const & | input, |
bool | do_gist | ||
) |
Process an RGB image. Results are stored in the Saliency class.
Definition at line 225 of file Saliency.C.
References jevois::async(), env_params::chan_c_weight, env_params::chan_f_weight, env_params::chan_i_weight, env_params::chan_m_weight, env_params::chan_o_weight, color, env_params::cs_lev_min, env_image::dims, ENV_ASSERT, env_c_luminance_from_byte(), env_chan_color(), env_chan_flicker(), env_chan_intensity(), env_chan_msflicker(), env_img_init(), env_img_make_empty(), env_img_swap(), env_max_pyr_depth(), env_pyr_build_lowpass_5(), env_pyr_copy_src_dst(), env_pyr_init(), env_pyr_make_empty(), env_pyr_swap(), env_total_weight(), flicker, env_dims::h, intens, JEVOIS_WAIT_GET_FUTURE, motion, env_params::multiscale_flicker, env_math::nbits, ori, salmap, env_motion_channel::unshifted_prev, env_dims::w, and WEIGHT_SCALEBITS.
void Saliency::process | ( | jevois::RawImage const & | input, |
bool | do_gist | ||
) |
Process a raw YUYV image. Results are stored in the Saliency class.
Definition at line 339 of file Saliency.C.
References jevois::async(), env_params::chan_c_weight, env_params::chan_f_weight, env_params::chan_i_weight, env_params::chan_m_weight, env_params::chan_o_weight, jevois::Profiler::checkpoint(), color, convertYUYVtoRGBYL(), env_params::cs_lev_min, env_image::dims, ENV_ASSERT, env_chan_flicker(), env_chan_intensity(), env_chan_msflicker(), env_img_init(), env_img_initializer, env_img_make_empty(), env_img_swap(), env_max_normalize_inplace(), env_max_pyr_depth(), env_pyr_build_lowpass_5(), env_pyr_copy_src_dst(), env_pyr_init(), env_pyr_make_empty(), env_pyr_swap(), env_total_weight(), flicker, env_dims::h, jevois::RawImage::height, intens, INTMAXNORMMAX, INTMAXNORMMIN, env_params::maxnorm_type, motion, env_params::multiscale_flicker, env_math::nbits, ori, jevois::RawImage::pixels(), env_params::range_thresh, salmap, jevois::Profiler::start(), jevois::Profiler::stop(), env_motion_channel::unshifted_prev, env_dims::w, WEIGHT_SCALEBITS, and jevois::RawImage::width.
void Saliency::waitUntilDoneWithInput | ( | ) | const |
Wait until process() is done using the input image.
This assumes that you are running process() in a different thread and here just want to wait until the initial processing that uses the input image is complete, so you can return that input image to the camera driver.
Definition at line 217 of file Saliency.C.
|
related |
Draw a gist vector in a YUYV image as a rectangle of width width*scale and correct height.
Definition at line 771 of file Saliency.C.
References jevois::RawImage::pixelsw(), and jevois::RawImage::width.
|
related |
Draw a saliency map or feature map in a YUYV image.
Definition at line 709 of file Saliency.C.
References env_image::dims, jevois::rawimage::drawRect(), h, env_dims::h, env_image::pixels, jevois::RawImage::pixelsw(), env_dims::w, and jevois::RawImage::width.
|
related |
Draw a saliency map or feature map in a YUYV image, applying some right bitshift to values.
Definition at line 740 of file Saliency.C.
References env_image::dims, jevois::rawimage::drawRect(), h, env_dims::h, env_image::pixels, jevois::RawImage::pixelsw(), env_dims::w, and jevois::RawImage::width.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
struct env_image Saliency::color |
Definition at line 127 of file Saliency.H.
Referenced by process(), process(), and Saliency().
struct env_image Saliency::flicker |
Definition at line 129 of file Saliency.H.
Referenced by process(), process(), and Saliency().
unsigned char* Saliency::gist |
Gist vector has 1152 entries, 72 feature maps * 16 values/map.
The 16 values are in raster order. If a feature weight is zero, the corresponding gist values are all zero. The feature maps are in order:
red/green (6*16), blue/yellow (6*16), intens (6*16), ori (6*4*16), flicker (6*16), motion (6*4*16)
so the offsets are: red/green: offset 0 len 6*16 blue/yellow: offset 1*6*16 len 6*16 intens: offset 2*6*16 len 6*16 ori0: offset 3*6*16 len 6*16 ori1: offset 4*6*16 len 6*16 ori2: offset 5*6*16 len 6*16 ori3: offset 6*6*16 len 6*16 flicker: offset 7*6*16 len 6*16 motion0: offset 8*6*16 len 6*16 motion1: offset 9*6*16 len 6*16 motion2: offset 10*6*16 len 6*16 motion3: offset 11*6*16 len 6*16
Definition at line 151 of file Saliency.H.
Referenced by Saliency(), and ~Saliency().
size_t const Saliency::gist_size |
Definition at line 152 of file Saliency.H.
Referenced by Saliency().
struct env_image Saliency::intens |
Definition at line 126 of file Saliency.H.
Referenced by process(), process(), and Saliency().
struct env_image Saliency::motion |
Definition at line 130 of file Saliency.H.
Referenced by process(), process(), and Saliency().
struct env_image Saliency::ori |
Definition at line 128 of file Saliency.H.
Referenced by process(), process(), and Saliency().
struct env_image Saliency::salmap |
The saliency map.
Definition at line 118 of file Saliency.H.
Referenced by getSaliencyMax(), inhibitionOfReturn(), process(), process(), and Saliency().