JeVoisBase  1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
SaliencySURF Class Reference

Simple salient region detection and identification using keypoint matching. More...

Inheritance diagram for SaliencySURF:
Collaboration diagram for SaliencySURF:

Public Member Functions

 SaliencySURF (std::string const &instance)
 Constructor. More...
 
virtual ~SaliencySURF ()
 Virtual destructor for safe inheritance. More...
 
void postInit () override
 Get started. More...
 
void postUninit () override
 Get stopped. More...
 
virtual void process (jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
 Processing function. More...
 
- Public Member Functions inherited from jevois::Module
 Module (std::string const &instance)
 
virtual ~Module ()
 
virtual void process (InputFrame &&inframe)
 
virtual void process (InputFrame &&inframe, GUIhelper &helper)
 
virtual void sendSerial (std::string const &str)
 
virtual void parseSerial (std::string const &str, std::shared_ptr< UserInterface > s)
 
virtual void supportedCommands (std::ostream &os)
 
- 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
 
Engineengine () const
 
bool initialized () const
 
const std::string & className () const
 
const std::string & instanceName () const
 
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor)
 
void unFreezeParam (std::string const &paramdescriptor)
 
void freezeAllParams ()
 
void unFreezeAllParams ()
 
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)
 
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
 
Engineengine () const
 
bool initialized () const
 
const std::string & className () const
 
const std::string & instanceName () const
 
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor)
 
void unFreezeParam (std::string const &paramdescriptor)
 
void freezeAllParams ()
 
void unFreezeAllParams ()
 
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)
 
void setPath (std::string const &path)
 
std::filesystem::path absolutePath (std::filesystem::path const &path="")
 
- Public Member Functions inherited from jevois::ParameterRegistry
virtual ~ParameterRegistry ()
 

Related Functions

(Note that these are not member functions.)

 JEVOIS_DECLARE_PARAMETER (inhsigma, float, "Sigma (pixels) used for inhibition of return", 32.0F, ParamCateg)
 Parameter. More...
 
 JEVOIS_DECLARE_PARAMETER (regions, size_t, "Number of salient regions", 2, ParamCateg)
 Parameter. More...
 
 JEVOIS_DECLARE_PARAMETER (rsiz, size_t, "Width and height (pixels) of salient regions", 64, ParamCateg)
 Parameter. More...
 
 JEVOIS_DECLARE_PARAMETER (save, bool, "Save regions when true, useful to create a training set. They will be saved to " PATHPREFIX, false, ParamCateg)
 Parameter. More...
 

Additional Inherited Members

- Protected Member Functions inherited from jevois::Component
virtual void preInit ()
 
virtual void preUninit ()
 
virtual void preInit ()
 
virtual void preUninit ()
 
- Protected Member Functions inherited from jevois::ParameterRegistry
void addParameter (ParameterBase *const param)
 
void removeParameter (ParameterBase *const param)
 
void callbackInitCall ()
 

Detailed Description

Simple salient region detection and identification using keypoint matching.

This module finds objects by matching keypoint descriptors between a current set of salient regions and a set of training images.

Here we use SURF keypoints and descriptors as provided by OpenCV. The algorithm is quite slow and consists of 3 phases:

  • detect keypoint locations,
  • compute keypoint descriptors,
  • and match descriptors from current image to training image descriptors.

Here, we alternate between computing keypoints and descriptors on one frame (or more, depending on how slow that gets), and doing the matching on the next frame. This module also provides an example of letting some computation happen even after we exit the process() function. Here, we keep detecting keypoints and computing descriptors even outside process().

Also see the ObjectDetect module for a related algorithm (without attention).

Training

Simply add images of the objects you want to detect into JEVOIS:/modules/JeVois/SaliencySURF/images/ on your JeVois microSD card.

Those will be processed when the module starts.

The names of recognized objects returned by this module are simply the file names of the pictures you have added in that directory. No additional training procedure is needed.

Beware that the more images you add, the slower the algorithm will run, and the higher your chances of confusions among several of your objects.

This module provides parameters that allow you to determine how strict a match should be. With stricter matching, you may sometimes miss an object (i.e., it was there, but was not detected by the algorithm). With looser matching, you may get more false alarms (i.e., there was something else in the camera's view, but it was matched as one of your objects). If you are experiencing difficulties getting any matches, try to loosen the settings, for example:

setpar goodpts 5 ... 100
setpar distthresh 0.5
Author
Laurent Itti
Display Name:
Saliency SURF
Videomapping:
YUYV 320 288 30.0 YUYV 320 240 30.0 JeVois SaliencySURF
Email:
itti@usc.edu
Address:
University of Southern California, HNB-07A, 3641 Watt Way, Los Angeles, CA 90089-2520, USA
Main URL:
http://jevois.org
Support URL:
http://jevois.org/doc
Other URL:
http://iLab.usc.edu
License:
GPL v3
Distribution:
Unrestricted
Restrictions:
None

Definition at line 105 of file SaliencySURF.C.

Constructor & Destructor Documentation

◆ SaliencySURF()

SaliencySURF::SaliencySURF ( std::string const &  instance)
inline

Constructor.

Definition at line 111 of file SaliencySURF.C.

◆ ~SaliencySURF()

virtual SaliencySURF::~SaliencySURF ( )
inlinevirtual

Virtual destructor for safe inheritance.

Definition at line 120 of file SaliencySURF.C.

Member Function Documentation

◆ postInit()

void SaliencySURF::postInit ( )
inlineoverridevirtual

Get started.

Reimplemented from jevois::Component.

Definition at line 126 of file SaliencySURF.C.

References jevois::async(), and LINFO.

◆ postUninit()

void SaliencySURF::postUninit ( )
inlineoverridevirtual

◆ process()

Friends And Related Function Documentation

◆ JEVOIS_DECLARE_PARAMETER() [1/4]

JEVOIS_DECLARE_PARAMETER ( inhsigma  ,
float  ,
"Sigma (pixels) used for inhibition of return"  ,
32.  0F,
ParamCateg   
)
related

Parameter.

◆ JEVOIS_DECLARE_PARAMETER() [2/4]

JEVOIS_DECLARE_PARAMETER ( regions  ,
size_t  ,
"Number of salient regions"  ,
,
ParamCateg   
)
related

Parameter.

◆ JEVOIS_DECLARE_PARAMETER() [3/4]

JEVOIS_DECLARE_PARAMETER ( rsiz  ,
size_t  ,
"Width and height (pixels) of salient regions"  ,
64  ,
ParamCateg   
)
related

Parameter.

◆ JEVOIS_DECLARE_PARAMETER() [4/4]

JEVOIS_DECLARE_PARAMETER ( save  ,
bool  ,
"Save regions when  true,
useful to create a training set. They will be saved to "  PATHPREFIX,
false  ,
ParamCateg   
)
related

Parameter.


The documentation for this class was generated from the following file: