JeVoisBase
1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Augmented reality markers using ARtoolkit. More...
#include <jevoisbase/Components/ARtoolkit/ARtoolkit.H>
Classes | |
struct | arresults |
Public Member Functions | |
void | postInit () override |
Core initialization. More... | |
void | postUninit () override |
~ARtoolkit () | |
Destructor. More... | |
void | detectMarkers (jevois::RawImage const &image) |
Detect markers in an image. More... | |
void | detectMarkers (cv::Mat const &image) |
Detect markers in an image. More... | |
void | drawDetections (jevois::RawImage &outimg, int txtx=-1, int txty=-1) |
Draw any markers previously detected by detectMarkers() More... | |
void | sendSerial (jevois::StdModule *mod) |
Send serial messages about detections. More... | |
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 |
Engine * | engine () const |
bool | initialized () const |
const std::string & | className () const |
const std::string & | 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) |
void | unFreezeParam (std::string const ¶mdescriptor) |
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 |
Engine * | engine () const |
bool | initialized () const |
const std::string & | className () const |
const std::string & | 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) |
void | unFreezeParam (std::string const ¶mdescriptor) |
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 () |
Public Attributes | |
std::vector< arresults > | itsResults |
Results of the last detection round. More... | |
Protected Member Functions | |
void | manualinit (int w, int h, AR_PIXEL_FORMAT pixformat) |
Manual initialization which should be run on first frame once its size is known. More... | |
void | detectInternal (unsigned char const *data) |
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 () |
Protected Attributes | |
ARHandle * | arHandle = nullptr |
ARPattHandle * | arPattHandle |
int | gARPattDetectionMode |
AR3DHandle * | ar3DHandle |
ARParamLT * | gCparamLT = nullptr |
ARMarkerSquare * | markersSquare = nullptr |
int | markersSquareCount = 0 |
unsigned int | itsW |
unsigned int | itsH |
Related Functions | |
(Note that these are not member functions.) | |
JEVOIS_DECLARE_PARAMETER (camparams, std::string, "File stem of camera parameters, or empty. Camera resolution " "will be appended, as well as a .dat extension. For example, specifying 'camera_para' " "here and running the camera sensor at 320x240 will attempt to load " "camera_para320x240.dat from within the module's directory (if relative stem) or " "from the specified absolute location (if absolute stem).", JEVOIS_SHARE_PATH "/camera/camera_para", ParamCateg) | |
Parameter. More... | |
JEVOIS_DECLARE_PARAMETER (contpose, bool, "Use continuous pose estimation in good quality video", true, ParamCateg) | |
Parameter. More... | |
JEVOIS_DECLARE_PARAMETER (msg3d, bool, "Send 3D serial messages if true, otherwise 2D", false, ParamCateg) | |
Parameter. More... | |
JEVOIS_DEFINE_ENUM_CLASS (Dict,(AR_MATRIX_CODE_3x3)(AR_MATRIX_CODE_3x3_HAMMING63)(AR_MATRIX_CODE_3x3_PARITY65)) | |
Enum for parameter. More... | |
JEVOIS_DECLARE_PARAMETER (threshmode, DictThreshMode, "Dictionary threshold mode to use, affects " "robustness to varying lighting conditions", DictThreshMode::AR_LABELING_THRESH_MODE_AUTO_OTSU, DictThreshMode_Values, ParamCateg) | |
Parameter. More... | |
JEVOIS_DECLARE_PARAMETER (dictionary, Dict, "Symbol dictionary to use", Dict::AR_MATRIX_CODE_3x3_PARITY65, Dict_Values, ParamCateg) | |
Parameter. More... | |
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.
Definition at line 87 of file ARtoolkit.H.
ARtoolkit::~ARtoolkit | ( | ) |
Destructor.
Definition at line 25 of file ARtoolkit.C.
|
protected |
Definition at line 168 of file ARtoolkit.C.
References ar3DHandle, AR_PATTERN_TYPE_MATRIX, arHandle, itsResults, LERROR, _ARMarkerSquare::marker_height, _ARMarkerSquare::marker_width, markersSquare, markersSquareCount, demo::result, _ARMarkerSquare::valid, and _ARMarkerSquare::validPrev.
Referenced by detectMarkers().
void ARtoolkit::detectMarkers | ( | cv::Mat const & | image | ) |
Detect markers in an image.
Definition at line 151 of file ARtoolkit.C.
References arHandle, detectInternal(), demo::image, LFATAL, and manualinit().
void ARtoolkit::detectMarkers | ( | jevois::RawImage const & | image | ) |
Detect markers in an image.
Probably the fastest if you have not already converted your input image to cv::Mat
Definition at line 130 of file ARtoolkit.C.
References arHandle, detectInternal(), demo::image, LFATAL, and manualinit().
void ARtoolkit::drawDetections | ( | jevois::RawImage & | outimg, |
int | txtx = -1 , |
||
int | txty = -1 |
||
) |
Draw any markers previously detected by detectMarkers()
If txtx,txty are positive, also print a text string there
Definition at line 237 of file ARtoolkit.C.
References jevois::rawimage::drawCircle(), jevois::rawimage::drawLine(), itsResults, to_string(), and jevois::rawimage::writeText().
Referenced by PythonObject6D.PythonObject6D::process(), and FirstPython.FirstPython::process().
|
protected |
Manual initialization which should be run on first frame once its size is known.
pixformat should be AR_PIXEL_FORMAT_BGR, AR_PIXEL_FORMAT_RGB_565, etc
Definition at line 58 of file ARtoolkit.C.
References jevois::Component::absolutePath(), ar3DHandle, arHandle, arPattHandle, gARPattDetectionMode, gCparamLT, h, itsH, itsW, LERROR, LFATAL, markersSquare, markersSquareCount, newMarkers(), to_string(), and demo::w.
Referenced by detectMarkers().
|
overridevirtual |
Core initialization.
Note that initialization is only partial and will complete once the frame size and format is known at the first call to detectMarkers()
Reimplemented from jevois::Component.
Definition at line 29 of file ARtoolkit.C.
References freeze().
|
overridevirtual |
Reimplemented from jevois::Component.
Definition at line 36 of file ARtoolkit.C.
References ar3DHandle, arHandle, arPattHandle, deleteMarkers(), gCparamLT, markersSquare, markersSquareCount, and unFreeze().
void ARtoolkit::sendSerial | ( | jevois::StdModule * | mod | ) |
Send serial messages about detections.
The module given should be the owner of this component, we will use it to actually send each serial message using some variant of jevois::Module::sendSetial().
Definition at line 281 of file ARtoolkit.C.
References itsH, itsResults, itsW, jevois::StdModule::sendSerialContour2D(), jevois::StdModule::sendSerialStd3D(), and to_string().
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Enum for parameter.
dictionary to use according to the ARtoolkit AR_MATRIX_CODE_3x3 support 64 markers AR_MATRIX_CODE_3x3_HAMMING63 support 7 markers AR_MATRIX_CODE_3x3_PARITY65 support 32 markers the smaller the # of marker => larger distance between markers => better performance
|
protected |
Definition at line 154 of file ARtoolkit.H.
Referenced by detectInternal(), manualinit(), and postUninit().
|
protected |
Definition at line 151 of file ARtoolkit.H.
Referenced by detectInternal(), detectMarkers(), manualinit(), and postUninit().
|
protected |
Definition at line 152 of file ARtoolkit.H.
Referenced by manualinit(), and postUninit().
|
protected |
Definition at line 153 of file ARtoolkit.H.
Referenced by manualinit().
|
protected |
Definition at line 155 of file ARtoolkit.H.
Referenced by manualinit(), and postUninit().
|
protected |
Definition at line 158 of file ARtoolkit.H.
Referenced by manualinit(), and sendSerial().
std::vector<arresults> ARtoolkit::itsResults |
Results of the last detection round.
Definition at line 139 of file ARtoolkit.H.
Referenced by detectInternal(), drawDetections(), and sendSerial().
|
protected |
Definition at line 158 of file ARtoolkit.H.
Referenced by manualinit(), and sendSerial().
|
protected |
Definition at line 156 of file ARtoolkit.H.
Referenced by detectInternal(), manualinit(), and postUninit().
|
protected |
Definition at line 157 of file ARtoolkit.H.
Referenced by detectInternal(), manualinit(), and postUninit().