JeVoisBase  1.6
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
QRcode.H
Go to the documentation of this file.
1 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 //
3 // JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4 // California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5 //
6 // This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7 // redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8 // Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10 // License for more details. You should have received a copy of the GNU General Public License along with this program;
11 // if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12 //
13 // Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14 // Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15 // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16 /*! \file */
17 
18 #pragma once
19 
21 #include <zbar.h>
22 namespace jevois { class StdModule; }
23 
24 namespace qrcode
25 {
26  static jevois::ParameterCategory const ParamCateg("QRcode/Barcode Options");
27 
28  //! Parameter \relates QRcode
29  JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(symbol, std::string, "Type(s) of QR code / barcode symbols searched for, "
30  "multiple entries are possible and should be separated by / characters. "
31  "Selecting many symbol types or ALL will slow down processing. Supported "
32  "symbols are: QRCODE, EAN2, EAN5, EAN8, EAN13, UPCE, UPCA, ISBN10, ISBN13, "
33  "COMPOSITE, I25, DATABAR, DATABAREXP, CODABAR, CODE39, PDF417, CODE93, "
34  "and CODE128",
35  "ALL", ParamCateg);
36 
37  //! Parameter \relates QRcode
38  JEVOIS_DECLARE_PARAMETER(xdensity, int, "Scanner vertical scan density (pixel stride), or 0 to disable",
39  1, ParamCateg);
40 
41  //! Parameter \relates QRcode
42  JEVOIS_DECLARE_PARAMETER(ydensity, int, "Scanner horizontal scan density (pixel stride), or 0 to disable",
43  1, ParamCateg);
44 }
45 
46 //! QRcode and Barcode detection using ZBar
47 /*! This is drectly modeled after the scan_image.cpp ZBar example code. \ingroup components */
48 class QRcode : public jevois::Component,
49  public jevois::Parameter<qrcode::symbol, qrcode::xdensity, qrcode::ydensity>
50 {
51  public:
52  //! Constructor
53  QRcode(std::string const & instance);
54 
55  //! Destructor
56  ~QRcode();
57 
58  //! Process a greayscale image
59  /*! Results will be stored in the image */
60  void process(zbar::Image & image);
61 
62  //! Process a greayscale image
63  /*! Results will be stored in the provided vector */
64  void process(zbar::Image & image, std::vector<std::string> & results);
65 
66  //! Draw any markers previously detected by process()
67  /*! If txtx,txty are positive, also print a text string there */
68  void drawDetections(jevois::RawImage & outimg, int txtx, int txty, zbar::Image & zgray, int w, int h, size_t nshow);
69 
70  //! Send serial messages about our detections
71  void sendSerial(jevois::StdModule * mod, zbar::Image & img, unsigned int camw, unsigned int camh);
72 
73  protected:
74  //! Parse symbol config strings when they change
75  void onParamChange(qrcode::symbol const & param, std::string const & newval);
76 
77  std::shared_ptr<zbar::ImageScanner> itsScanner;
78 };
JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(l2grad, bool, "Use more accurate L2 gradient norm if true, L1 if false", false, ParamCateg)
JEVOIS_DECLARE_PARAMETER(thresh1, double, "First threshold for hysteresis", 50.0, ParamCateg)
std::shared_ptr< zbar::ImageScanner > itsScanner
Definition: QRcode.H:77
QRcode and Barcode detection using ZBar.
Definition: QRcode.H:48
Definition: QRcode.H:24
void onParamChange(manager::loglevel const &param, manager::LogLevel const &newval)