JeVoisBase
1.22
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. | |
void | postUninit () override |
~ARtoolkit () | |
Destructor. | |
void | detectMarkers (jevois::RawImage const &image) |
Detect markers in an image. | |
void | detectMarkers (cv::Mat const &image) |
Detect markers in an image. | |
void | drawDetections (jevois::RawImage &outimg, int txtx=-1, int txty=-1) |
Draw any markers previously detected by detectMarkers() | |
void | drawDetections (jevois::GUIhelper &helper) |
Draw any markers previously detected by detectMarkers() using ImGui. | |
void | sendSerial (jevois::StdModule *mod) |
Send serial messages about detections. | |
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 | |
std::vector< arresults > | itsResults |
Results of the last detection round. | |
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. | |
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 Symbols | |
(Note that these are not member symbols.) | |
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. | |
JEVOIS_DECLARE_PARAMETER (contpose, bool, "Use continuous pose estimation in good quality video", true, ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (msg3d, bool, "Send 3D serial messages if true, otherwise 2D", false, ParamCateg) | |
Parameter. | |
JEVOIS_DEFINE_ENUM_CLASS (Dict,(AR_MATRIX_CODE_3x3)(AR_MATRIX_CODE_3x3_HAMMING63)(AR_MATRIX_CODE_3x3_PARITY65)) | |
Enum for parameter. | |
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. | |
JEVOIS_DECLARE_PARAMETER (dictionary, Dict, "Symbol dictionary to use", Dict::AR_MATRIX_CODE_3x3_PARITY65, Dict_Values, ParamCateg) | |
Parameter. | |
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 82 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, _ARMarkerSquare::valid, and _ARMarkerSquare::validPrev.
Referenced by detectMarkers(), and detectMarkers().
void ARtoolkit::detectMarkers | ( | cv::Mat const & | image | ) |
Detect markers in an image.
Definition at line 151 of file ARtoolkit.C.
References arHandle, detectInternal(), 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(), LFATAL, and manualinit().
void ARtoolkit::drawDetections | ( | jevois::GUIhelper & | helper | ) |
Draw any markers previously detected by detectMarkers() using ImGui.
Detections are drawn to scale on the last image drawn by the helper.
Definition at line 261 of file ARtoolkit.C.
References jevois::GUIhelper::drawCircle(), jevois::GUIhelper::drawPoly(), jevois::GUIhelper::drawText(), jevois::GUIhelper::itext(), and itsResults.
Referenced by FirstPython.FirstPython::process(), and PythonObject6D.PythonObject6D::process().
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, jevois::yuyv::LightPink, jevois::yuyv::White, and jevois::rawimage::writeText().
Referenced by FirstPython.FirstPython::process(), and PythonObject6D.PythonObject6D::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, and newMarkers().
Referenced by detectMarkers(), and 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.
|
overridevirtual |
Reimplemented from jevois::Component.
Definition at line 36 of file ARtoolkit.C.
References ar3DHandle, arHandle, arPattHandle, deleteMarkers(), gCparamLT, markersSquare, and markersSquareCount.
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(), and jevois::StdModule::sendSerialStd3D().
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Parameter.
|
related |
Enum for parameter.
|
protected |
Definition at line 149 of file ARtoolkit.H.
Referenced by detectInternal(), manualinit(), and postUninit().
|
protected |
Definition at line 146 of file ARtoolkit.H.
Referenced by detectInternal(), detectMarkers(), detectMarkers(), manualinit(), and postUninit().
|
protected |
Definition at line 147 of file ARtoolkit.H.
Referenced by manualinit(), and postUninit().
|
protected |
Definition at line 148 of file ARtoolkit.H.
Referenced by manualinit().
|
protected |
Definition at line 150 of file ARtoolkit.H.
Referenced by manualinit(), and postUninit().
|
protected |
Definition at line 153 of file ARtoolkit.H.
Referenced by manualinit(), and sendSerial().
std::vector<arresults> ARtoolkit::itsResults |
Results of the last detection round.
Definition at line 134 of file ARtoolkit.H.
Referenced by detectInternal(), drawDetections(), drawDetections(), and sendSerial().
|
protected |
Definition at line 153 of file ARtoolkit.H.
Referenced by manualinit(), and sendSerial().
|
protected |
Definition at line 151 of file ARtoolkit.H.
Referenced by detectInternal(), manualinit(), and postUninit().
|
protected |
Definition at line 152 of file ARtoolkit.H.
Referenced by detectInternal(), manualinit(), and postUninit().