JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches
DemoARtoolkit Class Reference

Augmented reality markers using ARtoolkit. More...

Inheritance diagram for DemoARtoolkit:
Collaboration diagram for DemoARtoolkit:

Public Member Functions

 DemoARtoolkit (std::string const &instance)
 
virtual ~DemoARtoolkit ()
 
virtual void process (jevois::InputFrame &&inframe) override
 
virtual void process (jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
 
virtual void process (jevois::InputFrame &&inframe, jevois::GUIhelper &helper) override
 Processing function with zero-copy and GUI on JeVois-Pro.
 
- Public Member Functions inherited from jevois::StdModule
 StdModule (std::string const &instance)
 
virtual ~StdModule ()
 
void sendSerialImg1Dx (unsigned int camw, float x, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd1Dx (float x, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialImg1Dy (unsigned int camh, float y, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd1Dy (float y, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialImg2D (unsigned int camw, unsigned int camh, float x, float y, float w=0.0F, float h=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd2D (float x, float y, float w=0.0F, float h=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialContour2D (unsigned int camw, unsigned int camh, std::vector< cv::Point_< T > > points, std::string const &id="", std::string const &extra="")
 
void sendSerialStd3D (float x, float y, float z, float w=0.0F, float h=0.0F, float d=0.0F, float q1=0.0F, float q2=0.0F, float q3=0.0f, float q4=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd3D (std::vector< cv::Point3f > points, std::string const &id="", std::string const &extra="")
 
void sendSerialObjReco (std::vector< ObjReco > const &res)
 
void sendSerialObjDetImg2D (unsigned int camw, unsigned int camh, float x, float y, float w, float h, std::vector< ObjReco > const &res)
 
void sendSerialObjDetImg2D (unsigned int camw, unsigned int camh, ObjDetect const &det)
 
void sendSerialObjDetImg2D (unsigned int camw, unsigned int camh, ObjDetectOBB const &det)
 
 JEVOIS_DEFINE_ENUM_CLASS (SerStyle,(Terse)(Normal)(Detail)(Fine))
 
 JEVOIS_DECLARE_PARAMETER (serstyle, SerStyle, "Style for standardized serial messages as defined in " "http://jevois.org/doc/UserSerialStyle.html", SerStyle::Terse, SerStyle_Values, ParamCateg)
 
 JEVOIS_DECLARE_PARAMETER (serprec, unsigned int, "Number of decimal points in standardized serial messages as " "defined in http://jevois.org/doc/UserSerialStyle.html", 0U, jevois::Range< unsigned int >(0U, 10U), ParamCateg)
 
 JEVOIS_DEFINE_ENUM_CLASS (SerStamp,(None)(Frame)(Time)(FrameTime)(FrameDateTime))
 
 JEVOIS_DECLARE_PARAMETER (serstamp, SerStamp, "Prepend standardized serial messages with a frame number, " "time, frame+time, or frame+date+time. See details in " "http://jevois.org/doc/UserSerialStyle.html", SerStamp::None, SerStamp_Values, ParamCateg)
 
 JEVOIS_DEFINE_ENUM_CLASS (SerMark,(None)(Start)(Stop)(Both))
 
 JEVOIS_DECLARE_PARAMETER (sermark, SerMark, "Send serial message to mark the beginning (MARK START) of the " "processing of a video frame from the camera sensor, the end (MARK STOP), or both. " "Useful, among others, if one needs to know when no results were sent over serial " "on a given frame. Combine with parameter serstamp if you need to know the frame number.", SerMark::None, SerMark_Values, ParamCateg)
 
- 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< 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, 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 &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, 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 ()
 

Protected Attributes

std::shared_ptr< ARtoolkititsARtoolkit
 

Additional Inherited Members

- Protected Member Functions inherited from jevois::StdModule
void sendSerialMarkStart ()
 
void sendSerialMarkStop ()
 
std::string getStamp () const
 
- 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

Augmented reality markers using ARtoolkit.

Detect and decode patterns known as ARtoolkit markers, which are small 2D barcodes often used in augmented reality and robotics. See https://github.com/artoolkit/ARToolKit5 - This module uses version 5.x for now.

This algorithm is very fast. It runs at 400+ frames/s at 320x240 and can easily sustain the maximum 15 frames/s of the JeVois camera sensor chip at 1280x1024. It may be interesting to combine it with other algorithms running on the quad-core JeVois processor (see for example the MarkersCombo module).

Sample patterns

This module uses by default the dictionary of 3x3 patterns with parity (32 different patterns). You can download them from http://jevois.org/data/ARtoolkit3x3par.zip

Also see the files in jevoisbase/Contrib/ARToolKit5arm/doc/patterns/ for more.

Serial Messages

This module can send standardized serial messages as described in Standardized serial messages formatting.

When msg3d is turned on, 3D messages will be sent, otherwise 2D messages.

One message is issued for every detected marker, on every video frame.

2D messages when msg3d is off:

  • Serial message type: 2D
  • id: decoded ARtoolkit marker ID, with a prefix 'A'
  • x, y, or vertices: standardized 2D coordinates of marker center or corners
  • w, h: standardized marker size
  • extra: none (empty string)

3D messages when msg3d is on:

  • Serial message type: 3D
  • id: decoded ARtoolkit marker ID, with a prefix 'A'
  • x, y, z, or vertices: 3D coordinates in millimeters of marker center or corners
  • w, h, d: marker size in millimeters, a depth of 1mm is always used
  • extra: none (empty string)

If you will use the quaternion data (Detail message style; see Standardized serial messages formatting), you should probably set the serprec parameter to something non-zero to get enough accuracy in the quaternion values.

See Standardized serial messages formatting for more on standardized serial messages, and Helper functions to convert coordinates from camera resolution to standardized for more info on standardized coordinates.

For information about camera calibration and obtaining precise location, distance and pose estimates, see this tutorial.

Author
Shixian Wen
Display Name:
Demo ARtoolkit
Videomapping:
NONE 0 0 0 YUYV 320 240 60.0 JeVois DemoARtoolkit
Videomapping:
NONE 0 0 0 YUYV 640 480 30.0 JeVois DemoARtoolkit
Videomapping:
NONE 0 0 0 YUYV 1280 1024 15.0 JeVois DemoARtoolkit
Videomapping:
YUYV 320 258 60.0 YUYV 320 240 60.0 JeVois DemoARtoolkit
Videomapping:
YUYV 640 498 30.0 YUYV 640 480 30.0 JeVois DemoARtoolkit
Email:
shixianw@usc.edu
Address:
University of Southern California, HNB-10A, 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 94 of file DemoARtoolkit.C.

Constructor & Destructor Documentation

◆ DemoARtoolkit()

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

Definition at line 98 of file DemoARtoolkit.C.

References itsARtoolkit.

◆ ~DemoARtoolkit()

virtual DemoARtoolkit::~DemoARtoolkit ( )
inlinevirtual

Definition at line 104 of file DemoARtoolkit.C.

Member Function Documentation

◆ process() [1/3]

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

◆ process() [2/3]

virtual void DemoARtoolkit::process ( jevois::InputFrame &&  inframe,
jevois::GUIhelper helper 
)
inlineoverridevirtual

◆ process() [3/3]

Member Data Documentation

◆ itsARtoolkit

std::shared_ptr<ARtoolkit> DemoARtoolkit::itsARtoolkit
protected

Definition at line 216 of file DemoARtoolkit.C.

Referenced by DemoARtoolkit(), process(), process(), and process().


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