JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches
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
22#include <zbar.h>
23
24namespace jevois { class StdModule; }
25
26namespace qrcode
27{
28 static jevois::ParameterCategory const ParamCateg("QRcode/Barcode Options");
29
30 //! Parameter \relates QRcode
31 JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(symbol, std::string, "Type(s) of QR code / barcode symbols searched for, "
32 "multiple entries are possible and should be separated by / characters. "
33 "Selecting many symbol types or ALL will slow down processing. Supported "
34 "symbols are: QRCODE, EAN2, EAN5, EAN8, EAN13, UPCE, UPCA, ISBN10, ISBN13, "
35 "COMPOSITE, I25, DATABAR, DATABAREXP, CODABAR, CODE39, PDF417, CODE93, "
36 "and CODE128",
37 "ALL", ParamCateg);
38
39 //! Parameter \relates QRcode
40 JEVOIS_DECLARE_PARAMETER(xdensity, int, "Scanner vertical scan density (pixel stride), or 0 to disable",
41 1, ParamCateg);
42
43 //! Parameter \relates QRcode
44 JEVOIS_DECLARE_PARAMETER(ydensity, int, "Scanner horizontal scan density (pixel stride), or 0 to disable",
45 1, ParamCateg);
46}
47
48//! QRcode and Barcode detection using ZBar
49/*! This is drectly modeled after the scan_image.cpp ZBar example code. \ingroup components */
51 public jevois::Parameter<qrcode::symbol, qrcode::xdensity, qrcode::ydensity>
52{
53 public:
54 //! Constructor
55 QRcode(std::string const & instance);
56
57 //! Destructor
58 ~QRcode();
59
60 //! Process a greayscale image
61 /*! Results will be stored in the image */
62 void process(zbar::Image & image);
63
64 //! Process a greayscale image
65 /*! Results will be stored in the provided vector */
66 void process(zbar::Image & image, std::vector<std::string> & results);
67
68 //! Draw any markers previously detected by process()
69 /*! If txtx,txty are positive, also print a text string there */
70 void drawDetections(jevois::RawImage & outimg, int txtx, int txty, zbar::Image & zgray, int w, int h, size_t nshow);
71
72#ifdef JEVOIS_PRO
73 //! Draw any markers previously detected by process()
74 void drawDetections(jevois::GUIhelper & helper, zbar::Image & zgray, int w, int h);
75#endif
76
77 //! Send serial messages about our detections
78 void sendSerial(jevois::StdModule * mod, zbar::Image & img, unsigned int camw, unsigned int camh);
79
80 protected:
81 //! Parse symbol config strings when they change
82 void onParamChange(qrcode::symbol const & param, std::string const & newval) override;
83
84 std::shared_ptr<zbar::ImageScanner> itsScanner;
85};
int h
QRcode and Barcode detection using ZBar.
Definition QRcode.H:52
void onParamChange(qrcode::symbol const &param, std::string const &newval) override
Parse symbol config strings when they change.
Definition QRcode.C:35
void process(zbar::Image &image)
Process a greayscale image.
Definition QRcode.C:94
JEVOIS_DECLARE_PARAMETER(ydensity, int, "Scanner horizontal scan density (pixel stride), or 0 to disable", 1, ParamCateg)
Parameter.
~QRcode()
Destructor.
Definition QRcode.C:31
void sendSerial(jevois::StdModule *mod, zbar::Image &img, unsigned int camw, unsigned int camh)
Send serial messages about our detections.
Definition QRcode.C:126
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.
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()
Definition QRcode.C:148
std::shared_ptr< zbar::ImageScanner > itsScanner
Definition QRcode.H:84
JEVOIS_DECLARE_PARAMETER(xdensity, int, "Scanner vertical scan density (pixel stride), or 0 to disable", 1, ParamCateg)
Parameter.