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

QRcode and Barcode detection using ZBar. More...

#include <jevoisbase/Components/QRcode/QRcode.H>

Inheritance diagram for QRcode:
Collaboration diagram for QRcode:

Public Member Functions

 QRcode (std::string const &instance)
 Constructor. More...
 
 ~QRcode ()
 Destructor. More...
 
void process (zbar::Image &image)
 Process a greayscale image. More...
 
void process (zbar::Image &image, std::vector< std::string > &results)
 Process a greayscale image. More...
 
void drawDetections (jevois::RawImage &outimg, int txtx, int txty, zbar::Image &zgray, int w, int h, size_t nshow)
 Draw any markers previously detected by process() More...
 
void sendSerial (jevois::StdModule *mod, zbar::Image &img, unsigned int camw, unsigned int camh)
 Send serial messages about our 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
 
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 ()
 

Protected Member Functions

void onParamChange (qrcode::symbol const &param, std::string const &newval) override
 Parse symbol config strings when they change. More...
 
- 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 ()
 

Protected Attributes

std::shared_ptr< zbar::ImageScanner > itsScanner
 

Related Functions

(Note that these are not member functions.)

 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK (symbol, std::string, "Type(s) of QR code / barcode symbols searched for, " "multiple entries are possible and should be separated by / characters. " "Selecting many symbol types or ALL will slow down processing. Supported " "symbols are: QRCODE, EAN2, EAN5, EAN8, EAN13, UPCE, UPCA, ISBN10, ISBN13, " "COMPOSITE, I25, DATABAR, DATABAREXP, CODABAR, CODE39, PDF417, CODE93, " "and CODE128", "ALL", ParamCateg)
 Parameter. More...
 
 JEVOIS_DECLARE_PARAMETER (xdensity, int, "Scanner vertical scan density (pixel stride), or 0 to disable", 1, ParamCateg)
 Parameter. More...
 
 JEVOIS_DECLARE_PARAMETER (ydensity, int, "Scanner horizontal scan density (pixel stride), or 0 to disable", 1, ParamCateg)
 Parameter. More...
 

Detailed Description

QRcode and Barcode detection using ZBar.

This is drectly modeled after the scan_image.cpp ZBar example code.

Definition at line 50 of file QRcode.H.

Constructor & Destructor Documentation

◆ QRcode()

QRcode::QRcode ( std::string const &  instance)

Constructor.

Definition at line 24 of file QRcode.C.

References itsScanner.

◆ ~QRcode()

QRcode::~QRcode ( )

Destructor.

Definition at line 31 of file QRcode.C.

Member Function Documentation

◆ drawDetections()

void QRcode::drawDetections ( jevois::RawImage outimg,
int  txtx,
int  txty,
zbar::Image &  zgray,
int  w,
int  h,
size_t  nshow 
)

Draw any markers previously detected by process()

If txtx,txty are positive, also print a text string there

Definition at line 148 of file QRcode.C.

References jevois::rawimage::drawLine(), jevois::rawimage::drawRect(), h, to_string(), demo::w, and jevois::rawimage::writeText().

Referenced by PythonObject6D.PythonObject6D::process(), and FirstPython.FirstPython::process().

◆ onParamChange()

void QRcode::onParamChange ( qrcode::symbol const &  param,
std::string const &  newval 
)
overrideprotected

Parse symbol config strings when they change.

Definition at line 35 of file QRcode.C.

References itsScanner, LFATAL, and jevois::split().

◆ process() [1/2]

void QRcode::process ( zbar::Image &  image)

Process a greayscale image.

Results will be stored in the image

Definition at line 94 of file QRcode.C.

References demo::image, itsScanner, and LERROR.

◆ process() [2/2]

void QRcode::process ( zbar::Image &  image,
std::vector< std::string > &  results 
)

Process a greayscale image.

Results will be stored in the provided vector

Definition at line 106 of file QRcode.C.

References demo::image, itsScanner, LERROR, and demo::results.

◆ sendSerial()

void QRcode::sendSerial ( jevois::StdModule mod,
zbar::Image &  img,
unsigned int  camw,
unsigned int  camh 
)

Send serial messages about our detections.

Definition at line 126 of file QRcode.C.

References jevois::StdModule::sendSerialContour2D().

Friends And Related Function Documentation

◆ JEVOIS_DECLARE_PARAMETER() [1/2]

JEVOIS_DECLARE_PARAMETER ( xdensity  ,
int  ,
"Scanner vertical scan density   pixel stride,
or 0 to disable"  ,
,
ParamCateg   
)
related

Parameter.

◆ JEVOIS_DECLARE_PARAMETER() [2/2]

JEVOIS_DECLARE_PARAMETER ( ydensity  ,
int  ,
"Scanner horizontal scan density   pixel stride,
or 0 to disable"  ,
,
ParamCateg   
)
related

Parameter.

◆ JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK()

JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK ( symbol  ,
std::string  ,
"Type(s) of QR code / barcode symbols searched  for,
" "multiple entries are possible and should be separated by/characters. " "Selecting many symbol types or ALL will slow down processing. Supported " "symbols are:QRCODE  ,
EAN2  ,
EAN5  ,
EAN8  ,
EAN13  ,
UPCE  ,
UPCA  ,
ISBN10  ,
ISBN13  ,
" "  COMPOSITE,
I25  ,
DATABAR  ,
DATABAREXP  ,
CODABAR  ,
CODE39  ,
PDF417  ,
CODE93  ,
" "and CODE128"  ,
"ALL"  ,
ParamCateg   
)
related

Parameter.

Member Data Documentation

◆ itsScanner

std::shared_ptr<zbar::ImageScanner> QRcode::itsScanner
protected

Definition at line 84 of file QRcode.H.

Referenced by onParamChange(), process(), and QRcode().


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