JeVoisBase  1.0
JeVois Smart Embedded Machine Vision Toolkit Base Modules
DemoArUco Class Reference

Simple demo of ArUco augmented reality markers detection and decoding. More...

Inheritance diagram for DemoArUco:
Collaboration diagram for DemoArUco:

Public Member Functions

 DemoArUco (std::string const &instance)
 Constructor. More...
 
virtual ~DemoArUco ()
 Virtual destructor for safe inheritance. More...
 
virtual void process (jevois::InputFrame &&inframe) override
 Processing function, no video output. More...
 
void sendAllSerial (std::vector< int > ids, std::vector< std::vector< cv::Point2f > > corners, unsigned int w, unsigned int h)
 Send the serial messages. More...
 
virtual void process (jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
 Processing function with video output to USB. More...
 
- Public Member Functions inherited from jevois::Module
 Module (std::string const &instance)
 
virtual ~Module ()
 
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< ComponentgetSubComponent (std::string const &instance) const
 
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 &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)
 
void setPath (std::string const &path)
 
std::string absolutePath (std::string 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 &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)
 
void setPath (std::string const &path)
 
std::string absolutePath (std::string const &path="")
 
- Public Member Functions inherited from jevois::ParameterRegistry
virtual ~ParameterRegistry ()
 

Protected Attributes

std::shared_ptr< ArUcoitsArUco
 

Related Functions

(Note that these are not member functions.)

#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)
 Parameter. More...
 
#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)
 Parameter. More...
 
#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...)
 Parameter. More...
 

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 ()
 

Detailed Description

Simple demo of ArUco augmented reality markers detection and decoding.

Detect and decode patterns known as ArUco markers, which are small 2D barcodes often used in augmented reality and robotics.

ArUco markers are small 2D barcodes. Each ArUco marker corresponds to a number, encoded into a small grid of black and white pixels. The ArUco decoding algorithm is capable of locating, decoding, and of estimating the pose (location and orientation in space) of any ArUco markers in the camera's field of view.

ArUcos are very useful as tags for many robotics and augmented reality applications. For example, one may place an ArUco next to a robot's charging station, an elevator button, or an object that a robot should manipulate.

For more information about ArUco, see https://www.uco.es/investiga/grupos/ava/node/26

The implementation of ArUco used by JeVois is the one of OpenCV-Contrib, documented here: http://docs.opencv.org/3.2.0/d5/dae/tutorial_aruco_detection.html

ArUco markers can be created with several standard dictionaries. Different disctionaries give rise to different numbers of pixels in the markers, and to different numbers of possible symbols that can be created using the dictionary. The default dictionary used by JeVois is 4x4 with 50 symbols. Other dictionaries are also supported by setting the appropriate parameter over serial port or in a config file, up to 7x7 with 1000 symbols.

Creating and printing markers

We have created the 50 markers available in the default dictionary (4x4_50) as PNG images that you can download and print, at http://jevois.org/data/ArUco/

To make your own, for example, using another dictionary, see the documentation of the ArUco component of JeVoisBase.

Serial Messages

This module can send the following messages over serial port (make sure you set the serout parameter to designate the serial port to which you want to send these messages, see the documentation for serout under Command-line interface user guide).

  • When serstyle is 0:
      ArUco ID
    where
    • ID is the decoded ID of the ArUco that was detected
  • When serstyle is 1:
      ArUco ID X,Y
    where
    • ID is the decoded ID of the ArUco that was detected
    • X,Y are the coordinates of the marker's center
  • When serstyle is 2:
      ArUco ID X1,Y1 X2,Y2 X3,Y3 X4,Y4
    where
    • ID is the decoded ID of the ArUco that was detected
    • X1,Y1 are the coordinates of the first corner
    • X2,Y2 are the coordinates of the second corner
    • X3,Y3 are the coordinates of the third corner
    • X4,Y4 are the coordinates of the fourth corner

The coordinates are normalized so that the serial outputs are independent of camera resolution. x=0, y=0 is the center of the field of view, the left edge of the camera image is at x=-1000, the right edge at x=1000, the top edge at y=-750, and the bottom edge at y=750 (since the camera has a 4:3 aspect ratio).

One message is issued for each detected ArUco.

Author
Laurent Itti
Display Name:
Demo ArUco
Videomapping:
NONE 0 0 0 YUYV 320 240 30.0 JeVois DemoArUco
Videomapping:
YUYV 320 260 30.0 YUYV 320 240 30.0 JeVois DemoArUco
Videomapping:
YUYV 640 500 20.0 YUYV 640 480 20.0 JeVois DemoArUco
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 128 of file DemoArUco.C.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 135 of file DemoArUco.C.

References itsArUco.

virtual DemoArUco::~DemoArUco ( )
inlinevirtual

Virtual destructor for safe inheritance.

Definition at line 144 of file DemoArUco.C.

Member Function Documentation

virtual void DemoArUco::process ( jevois::InputFrame &&  inframe)
inlineoverridevirtual

Processing function, no video output.

Reimplemented from jevois::Module.

Definition at line 150 of file DemoArUco.C.

References jevois::rawimage::convertToCvGray(), jevois::RawImage::height, itsArUco, sendAllSerial(), and jevois::RawImage::width.

void DemoArUco::sendAllSerial ( std::vector< int >  ids,
std::vector< std::vector< cv::Point2f > >  corners,
unsigned int  w,
unsigned int  h 
)
inline

Send the serial messages.

Definition at line 171 of file DemoArUco.C.

References jevois::coords::imgToStd(), and jevois::Module::sendSerial().

Referenced by process().

Friends And Related Function Documentation

#define JEVOIS_DECLARE_PARAMETER (   ParamName,
  ParamType,
  ... 
)
related

Parameter.

#define JEVOIS_DECLARE_PARAMETER (   ParamName,
  ParamType,
  ... 
)
related

Parameter.

#define JEVOIS_DECLARE_PARAMETER (   ParamName,
  ParamType,
  ... 
)
related

Parameter.

Member Data Documentation

std::shared_ptr<ArUco> DemoArUco::itsArUco
protected

Definition at line 330 of file DemoArUco.C.

Referenced by DemoArUco(), and process().


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