JeVoisBase  1.0
JeVois Smart Embedded Machine Vision Toolkit Base Modules
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 
23 namespace qrcode
24 {
25  static jevois::ParameterCategory const ParamCateg("QRcode/Barcode Options");
26 
27  //! Parameter \relates QRcode
28  JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(symbol, std::string, "Type(s) of QR code / barcode symbols searched for, "
29  "multiple entries are possible and should be separated by / characters. "
30  "Selecting many symbol types or ALL will slow down processing. Supported "
31  "symbols are: QRCODE, EAN2, EAN5, EAN8, EAN13, UPCE, UPCA, ISBN10, ISBN13, "
32  "COMPOSITE, I25, DATABAR, DATABAREXP, CODABAR, CODE39, PDF417, CODE93, "
33  "and CODE128",
34  "ALL", ParamCateg);
35 
36  //! Parameter \relates QRcode
37  JEVOIS_DECLARE_PARAMETER(xdensity, int, "Scanner vertical scan density (pixel stride), or 0 to disable",
38  1, ParamCateg);
39 
40  //! Parameter \relates QRcode
41  JEVOIS_DECLARE_PARAMETER(ydensity, int, "Scanner horizontal scan density (pixel stride), or 0 to disable",
42  1, ParamCateg);
43 }
44 
45 //! QRcode and Barcode detection using ZBar
46 /*! This is drectly modeled after the scan_image.cpp ZBar example code. \ingroup components */
47 class QRcode : public jevois::Component,
48  public jevois::Parameter<qrcode::symbol, qrcode::xdensity, qrcode::ydensity>
49 {
50  public:
51  //! Constructor
52  QRcode(std::string const & instance);
53 
54  //! Destructor
55  ~QRcode();
56 
57  //! Process a greayscale image
58  /*! Results will be stored in the image */
59  void process(zbar::Image & image);
60 
61  //! Process a greayscale image
62  /*! Results will be stored in the provided vector */
63  void process(zbar::Image & image, std::vector<std::string> & results);
64 
65  protected:
66  //! Parse symbol config strings when they change
67  void onParamChange(qrcode::symbol const & param, std::string const & newval);
68 
69  std::shared_ptr<zbar::ImageScanner> itsScanner;
70 };
void process(zbar::Image &image)
Process a greayscale image.
Definition: QRcode.C:93
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)
~QRcode()
Destructor.
Definition: QRcode.C:30
QRcode(std::string const &instance)
Constructor.
Definition: QRcode.C:23
std::shared_ptr< zbar::ImageScanner > itsScanner
Definition: QRcode.H:69
QRcode and Barcode detection using ZBar.
Definition: QRcode.H:47
Definition: QRcode.H:23
void onParamChange(qrcode::symbol const &param, std::string const &newval)
Parse symbol config strings when they change.
Definition: QRcode.C:34