aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Software/DB/TCC/TCC.mdfbin0 -> 8388608 bytes
-rw-r--r--Software/DB/TCC/TCC_log.ldfbin0 -> 8388608 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libMagickCore-2.dllbin0 -> 3225283 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libMagickWand-2.dllbin0 -> 1030247 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libiconv-2.dllbin0 -> 964989 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libjpeg-7.dllbin0 -> 234004 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libpng12-0.dllbin0 -> 187149 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libtiff-3.dllbin0 -> 375388 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libxml2-2.dllbin0 -> 1157984 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/libzbar-0.dllbin0 -> 209438 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/zbarcam.bat9
-rw-r--r--Software/External_Repositories/ZBar/bin/zbarcam.exebin0 -> 30460 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/zbarimg.exebin0 -> 35548 bytes
-rw-r--r--Software/External_Repositories/ZBar/bin/zlib1.dllbin0 -> 78465 bytes
-rw-r--r--Software/External_Repositories/ZBar/include/zbar.h1312
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Decoder.h193
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Exception.h187
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Image.h290
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/ImageScanner.h130
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Processor.h223
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Scanner.h162
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Symbol.h451
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Video.h170
-rw-r--r--Software/External_Repositories/ZBar/include/zbar/Window.h136
-rw-r--r--Software/External_Repositories/ZBar/lib/libzbar-0.def120
-rw-r--r--Software/External_Repositories/ZBar/lib/libzbar-0.libbin0 -> 30120 bytes
-rw-r--r--Software/External_Repositories/ZBar/lib/libzbar.dll.abin0 -> 78184 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnkbin1445 -> 1530 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnkbin1516 -> 1581 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnkbin1292 -> 1529 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnkbin1310 -> 1547 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Transport Router.lnkbin1341 -> 1578 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs41
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs16
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj5
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs103
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml226
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/App.config45
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs6
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs17
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs13
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs21
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs16
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs42
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs18
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj17
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs13
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs32
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs20
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs15
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config1
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp1
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cppbin6636 -> 10128 bytes
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.hbin1104 -> 1240 bytes
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h3
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj6
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj36
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs27
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs48
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj6
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config43
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config1
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs2
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs19
71 files changed, 4190 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index 8b1c529db..041656ff8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -305,3 +305,6 @@ __pycache__/
/Software/Visual_Studio/Advanced Installer Projects/Machine Studio Installer-cache
/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache
/Software/Visual_Studio/Build
+
+# ZBar binaries
+!/Software/External_Repositories/ZBar/bin
diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf
new file mode 100644
index 000000000..f73a45d63
--- /dev/null
+++ b/Software/DB/TCC/TCC.mdf
Binary files differ
diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf
new file mode 100644
index 000000000..53fbaa5d0
--- /dev/null
+++ b/Software/DB/TCC/TCC_log.ldf
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libMagickCore-2.dll b/Software/External_Repositories/ZBar/bin/libMagickCore-2.dll
new file mode 100644
index 000000000..fbb1fcfc5
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libMagickCore-2.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libMagickWand-2.dll b/Software/External_Repositories/ZBar/bin/libMagickWand-2.dll
new file mode 100644
index 000000000..3e9a2cbf8
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libMagickWand-2.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libiconv-2.dll b/Software/External_Repositories/ZBar/bin/libiconv-2.dll
new file mode 100644
index 000000000..f3368973d
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libiconv-2.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libjpeg-7.dll b/Software/External_Repositories/ZBar/bin/libjpeg-7.dll
new file mode 100644
index 000000000..2cf6738b6
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libjpeg-7.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libpng12-0.dll b/Software/External_Repositories/ZBar/bin/libpng12-0.dll
new file mode 100644
index 000000000..35e293002
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libpng12-0.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libtiff-3.dll b/Software/External_Repositories/ZBar/bin/libtiff-3.dll
new file mode 100644
index 000000000..82706f644
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libtiff-3.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libxml2-2.dll b/Software/External_Repositories/ZBar/bin/libxml2-2.dll
new file mode 100644
index 000000000..3ef041fcf
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libxml2-2.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/libzbar-0.dll b/Software/External_Repositories/ZBar/bin/libzbar-0.dll
new file mode 100644
index 000000000..fbbbd2328
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/libzbar-0.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/zbarcam.bat b/Software/External_Repositories/ZBar/bin/zbarcam.bat
new file mode 100644
index 000000000..acefe7b69
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/zbarcam.bat
@@ -0,0 +1,9 @@
+@set PATH=%PATH%;C:\Program Files (x86)\ZBar\bin
+@echo This is the zbarcam output window.
+@echo Hold a bar code in front of the camera (make sure it's in focus!)
+@echo and decoded results will appear below.
+@echo.
+@echo Initializing camera, please wait...
+@echo.
+@zbarcam.exe --prescale=640x480
+@if errorlevel 1 pause
diff --git a/Software/External_Repositories/ZBar/bin/zbarcam.exe b/Software/External_Repositories/ZBar/bin/zbarcam.exe
new file mode 100644
index 000000000..d2d2a06e8
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/zbarcam.exe
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/zbarimg.exe b/Software/External_Repositories/ZBar/bin/zbarimg.exe
new file mode 100644
index 000000000..179494326
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/zbarimg.exe
Binary files differ
diff --git a/Software/External_Repositories/ZBar/bin/zlib1.dll b/Software/External_Repositories/ZBar/bin/zlib1.dll
new file mode 100644
index 000000000..9752c129a
--- /dev/null
+++ b/Software/External_Repositories/ZBar/bin/zlib1.dll
Binary files differ
diff --git a/Software/External_Repositories/ZBar/include/zbar.h b/Software/External_Repositories/ZBar/include/zbar.h
new file mode 100644
index 000000000..0ab1d6246
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar.h
@@ -0,0 +1,1312 @@
+/*------------------------------------------------------------------------
+ * Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+ *
+ * This file is part of the ZBar Bar Code Reader.
+ *
+ * The ZBar Bar Code Reader is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * The ZBar Bar Code Reader is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with the ZBar Bar Code Reader; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * http://sourceforge.net/projects/zbar
+ *------------------------------------------------------------------------*/
+#ifndef _ZBAR_H_
+#define _ZBAR_H_
+
+/** @file
+ * ZBar Barcode Reader C API definition
+ */
+
+/** @mainpage
+ *
+ * interface to the barcode reader is available at several levels.
+ * most applications will want to use the high-level interfaces:
+ *
+ * @section high-level High-Level Interfaces
+ *
+ * these interfaces wrap all library functionality into an easy-to-use
+ * package for a specific toolkit:
+ * - the "GTK+ 2.x widget" may be used with GTK GUI applications. a
+ * Python wrapper is included for PyGtk
+ * - the @ref zbar::QZBar "Qt4 widget" may be used with Qt GUI
+ * applications
+ * - the Processor interface (in @ref c-processor "C" or @ref
+ * zbar::Processor "C++") adds a scanning window to an application
+ * with no GUI.
+ *
+ * @section mid-level Intermediate Interfaces
+ *
+ * building blocks used to construct high-level interfaces:
+ * - the ImageScanner (in @ref c-imagescanner "C" or @ref
+ * zbar::ImageScanner "C++") looks for barcodes in a library defined
+ * image object
+ * - the Window abstraction (in @ref c-window "C" or @ref
+ * zbar::Window "C++") sinks library images, displaying them on the
+ * platform display
+ * - the Video abstraction (in @ref c-video "C" or @ref zbar::Video
+ * "C++") sources library images from a video device
+ *
+ * @section low-level Low-Level Interfaces
+ *
+ * direct interaction with barcode scanning and decoding:
+ * - the Scanner (in @ref c-scanner "C" or @ref zbar::Scanner "C++")
+ * looks for barcodes in a linear intensity sample stream
+ * - the Decoder (in @ref c-decoder "C" or @ref zbar::Decoder "C++")
+ * extracts barcodes from a stream of bar and space widths
+ */
+
+#ifdef __cplusplus
+
+/** C++ namespace for library interfaces */
+namespace zbar {
+ extern "C" {
+#endif
+
+
+/** @name Global library interfaces */
+/*@{*/
+
+/** "color" of element: bar or space. */
+typedef enum zbar_color_e {
+ ZBAR_SPACE = 0, /**< light area or space between bars */
+ ZBAR_BAR = 1, /**< dark area or colored bar segment */
+} zbar_color_t;
+
+/** decoded symbol type. */
+typedef enum zbar_symbol_type_e {
+ ZBAR_NONE = 0, /**< no symbol decoded */
+ ZBAR_PARTIAL = 1, /**< intermediate status */
+ ZBAR_EAN8 = 8, /**< EAN-8 */
+ ZBAR_UPCE = 9, /**< UPC-E */
+ ZBAR_ISBN10 = 10, /**< ISBN-10 (from EAN-13). @since 0.4 */
+ ZBAR_UPCA = 12, /**< UPC-A */
+ ZBAR_EAN13 = 13, /**< EAN-13 */
+ ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). @since 0.4 */
+ ZBAR_I25 = 25, /**< Interleaved 2 of 5. @since 0.4 */
+ ZBAR_CODE39 = 39, /**< Code 39. @since 0.4 */
+ ZBAR_PDF417 = 57, /**< PDF417. @since 0.6 */
+ ZBAR_QRCODE = 64, /**< QR Code. @since 0.10 */
+ ZBAR_CODE128 = 128, /**< Code 128 */
+ ZBAR_SYMBOL = 0x00ff, /**< mask for base symbol type */
+ ZBAR_ADDON2 = 0x0200, /**< 2-digit add-on flag */
+ ZBAR_ADDON5 = 0x0500, /**< 5-digit add-on flag */
+ ZBAR_ADDON = 0x0700, /**< add-on flag mask */
+} zbar_symbol_type_t;
+
+/** error codes. */
+typedef enum zbar_error_e {
+ ZBAR_OK = 0, /**< no error */
+ ZBAR_ERR_NOMEM, /**< out of memory */
+ ZBAR_ERR_INTERNAL, /**< internal library error */
+ ZBAR_ERR_UNSUPPORTED, /**< unsupported request */
+ ZBAR_ERR_INVALID, /**< invalid request */
+ ZBAR_ERR_SYSTEM, /**< system error */
+ ZBAR_ERR_LOCKING, /**< locking error */
+ ZBAR_ERR_BUSY, /**< all resources busy */
+ ZBAR_ERR_XDISPLAY, /**< X11 display error */
+ ZBAR_ERR_XPROTO, /**< X11 protocol error */
+ ZBAR_ERR_CLOSED, /**< output window is closed */
+ ZBAR_ERR_WINAPI, /**< windows system error */
+ ZBAR_ERR_NUM /**< number of error codes */
+} zbar_error_t;
+
+/** decoder configuration options.
+ * @since 0.4
+ */
+typedef enum zbar_config_e {
+ ZBAR_CFG_ENABLE = 0, /**< enable symbology/feature */
+ ZBAR_CFG_ADD_CHECK, /**< enable check digit when optional */
+ ZBAR_CFG_EMIT_CHECK, /**< return check digit when present */
+ ZBAR_CFG_ASCII, /**< enable full ASCII character set */
+ ZBAR_CFG_NUM, /**< number of boolean decoder configs */
+
+ ZBAR_CFG_MIN_LEN = 0x20, /**< minimum data length for valid decode */
+ ZBAR_CFG_MAX_LEN, /**< maximum data length for valid decode */
+
+ ZBAR_CFG_POSITION = 0x80, /**< enable scanner to collect position data */
+
+ ZBAR_CFG_X_DENSITY = 0x100, /**< image scanner vertical scan density */
+ ZBAR_CFG_Y_DENSITY, /**< image scanner horizontal scan density */
+} zbar_config_t;
+
+/** retrieve runtime library version information.
+ * @param major set to the running major version (unless NULL)
+ * @param minor set to the running minor version (unless NULL)
+ * @returns 0
+ */
+extern int zbar_version(unsigned *major,
+ unsigned *minor);
+
+/** set global library debug level.
+ * @param verbosity desired debug level. higher values create more spew
+ */
+extern void zbar_set_verbosity(int verbosity);
+
+/** increase global library debug level.
+ * eg, for -vvvv
+ */
+extern void zbar_increase_verbosity(void);
+
+/** retrieve string name for symbol encoding.
+ * @param sym symbol type encoding
+ * @returns the static string name for the specified symbol type,
+ * or "UNKNOWN" if the encoding is not recognized
+ */
+extern const char *zbar_get_symbol_name(zbar_symbol_type_t sym);
+
+/** retrieve string name for addon encoding.
+ * @param sym symbol type encoding
+ * @returns static string name for any addon, or the empty string
+ * if no addons were decoded
+ */
+extern const char *zbar_get_addon_name(zbar_symbol_type_t sym);
+
+/** parse a configuration string of the form "[symbology.]config[=value]".
+ * the config must match one of the recognized names.
+ * the symbology, if present, must match one of the recognized names.
+ * if symbology is unspecified, it will be set to 0.
+ * if value is unspecified it will be set to 1.
+ * @returns 0 if the config is parsed successfully, 1 otherwise
+ * @since 0.4
+ */
+extern int zbar_parse_config(const char *config_string,
+ zbar_symbol_type_t *symbology,
+ zbar_config_t *config,
+ int *value);
+
+/** @internal type unsafe error API (don't use) */
+extern int _zbar_error_spew(const void *object,
+ int verbosity);
+extern const char *_zbar_error_string(const void *object,
+ int verbosity);
+extern zbar_error_t _zbar_get_error_code(const void *object);
+
+/*@}*/
+
+struct zbar_symbol_s;
+typedef struct zbar_symbol_s zbar_symbol_t;
+
+struct zbar_symbol_set_s;
+typedef struct zbar_symbol_set_s zbar_symbol_set_t;
+
+
+/*------------------------------------------------------------*/
+/** @name Symbol interface
+ * decoded barcode symbol result object. stores type, data, and image
+ * location of decoded symbol. all memory is owned by the library
+ */
+/*@{*/
+
+/** @typedef zbar_symbol_t
+ * opaque decoded symbol object.
+ */
+
+/** symbol reference count manipulation.
+ * increment the reference count when you store a new reference to the
+ * symbol. decrement when the reference is no longer used. do not
+ * refer to the symbol once the count is decremented and the
+ * containing image has been recycled or destroyed.
+ * @note the containing image holds a reference to the symbol, so you
+ * only need to use this if you keep a symbol after the image has been
+ * destroyed or reused.
+ * @since 0.9
+ */
+extern void zbar_symbol_ref(const zbar_symbol_t *symbol,
+ int refs);
+
+/** retrieve type of decoded symbol.
+ * @returns the symbol type
+ */
+extern zbar_symbol_type_t zbar_symbol_get_type(const zbar_symbol_t *symbol);
+
+/** retrieve data decoded from symbol.
+ * @returns the data string
+ */
+extern const char *zbar_symbol_get_data(const zbar_symbol_t *symbol);
+
+/** retrieve length of binary data.
+ * @returns the length of the decoded data
+ */
+extern unsigned int zbar_symbol_get_data_length(const zbar_symbol_t *symbol);
+
+/** retrieve a symbol confidence metric.
+ * @returns an unscaled, relative quantity: larger values are better
+ * than smaller values, where "large" and "small" are application
+ * dependent.
+ * @note expect the exact definition of this quantity to change as the
+ * metric is refined. currently, only the ordered relationship
+ * between two values is defined and will remain stable in the future
+ * @since 0.9
+ */
+extern int zbar_symbol_get_quality(const zbar_symbol_t *symbol);
+
+/** retrieve current cache count. when the cache is enabled for the
+ * image_scanner this provides inter-frame reliability and redundancy
+ * information for video streams.
+ * @returns < 0 if symbol is still uncertain.
+ * @returns 0 if symbol is newly verified.
+ * @returns > 0 for duplicate symbols
+ */
+extern int zbar_symbol_get_count(const zbar_symbol_t *symbol);
+
+/** retrieve the number of points in the location polygon. the
+ * location polygon defines the image area that the symbol was
+ * extracted from.
+ * @returns the number of points in the location polygon
+ * @note this is currently not a polygon, but the scan locations
+ * where the symbol was decoded
+ */
+extern unsigned zbar_symbol_get_loc_size(const zbar_symbol_t *symbol);
+
+/** retrieve location polygon x-coordinates.
+ * points are specified by 0-based index.
+ * @returns the x-coordinate for a point in the location polygon.
+ * @returns -1 if index is out of range
+ */
+extern int zbar_symbol_get_loc_x(const zbar_symbol_t *symbol,
+ unsigned index);
+
+/** retrieve location polygon y-coordinates.
+ * points are specified by 0-based index.
+ * @returns the y-coordinate for a point in the location polygon.
+ * @returns -1 if index is out of range
+ */
+extern int zbar_symbol_get_loc_y(const zbar_symbol_t *symbol,
+ unsigned index);
+
+/** iterate the set to which this symbol belongs (there can be only one).
+ * @returns the next symbol in the set, or
+ * @returns NULL when no more results are available
+ */
+extern const zbar_symbol_t *zbar_symbol_next(const zbar_symbol_t *symbol);
+
+/** retrieve components of a composite result.
+ * @returns the symbol set containing the components
+ * @returns NULL if the symbol is already a physical symbol
+ * @since 0.10
+ */
+extern const zbar_symbol_set_t*
+zbar_symbol_get_components(const zbar_symbol_t *symbol);
+
+/** iterate components of a composite result.
+ * @returns the first physical component symbol of a composite result
+ * @returns NULL if the symbol is already a physical symbol
+ * @since 0.10
+ */
+extern const zbar_symbol_t*
+zbar_symbol_first_component(const zbar_symbol_t *symbol);
+
+/** print XML symbol element representation to user result buffer.
+ * @see http://zbar.sourceforge.net/2008/barcode.xsd for the schema.
+ * @param symbol is the symbol to print
+ * @param buffer is the inout result pointer, it will be reallocated
+ * with a larger size if necessary.
+ * @param buflen is inout length of the result buffer.
+ * @returns the buffer pointer
+ * @since 0.6
+ */
+extern char *zbar_symbol_xml(const zbar_symbol_t *symbol,
+ char **buffer,
+ unsigned *buflen);
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Symbol Set interface
+ * container for decoded result symbols associated with an image
+ * or a composite symbol.
+ * @since 0.10
+ */
+/*@{*/
+
+/** @typedef zbar_symbol_set_t
+ * opaque symbol iterator object.
+ * @since 0.10
+ */
+
+/** reference count manipulation.
+ * increment the reference count when you store a new reference.
+ * decrement when the reference is no longer used. do not refer to
+ * the object any longer once references have been released.
+ * @since 0.10
+ */
+extern void zbar_symbol_set_ref(const zbar_symbol_set_t *symbols,
+ int refs);
+
+/** retrieve set size.
+ * @returns the number of symbols in the set.
+ * @since 0.10
+ */
+extern int zbar_symbol_set_get_size(const zbar_symbol_set_t *symbols);
+
+/** set iterator.
+ * @returns the first decoded symbol result in a set
+ * @returns NULL if the set is empty
+ * @since 0.10
+ */
+extern const zbar_symbol_t*
+zbar_symbol_set_first_symbol(const zbar_symbol_set_t *symbols);
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Image interface
+ * stores image data samples along with associated format and size
+ * metadata
+ */
+/*@{*/
+
+struct zbar_image_s;
+/** opaque image object. */
+typedef struct zbar_image_s zbar_image_t;
+
+/** cleanup handler callback function.
+ * called to free sample data when an image is destroyed.
+ */
+typedef void (zbar_image_cleanup_handler_t)(zbar_image_t *image);
+
+/** data handler callback function.
+ * called when decoded symbol results are available for an image
+ */
+typedef void (zbar_image_data_handler_t)(zbar_image_t *image,
+ const void *userdata);
+
+/** new image constructor.
+ * @returns a new image object with uninitialized data and format.
+ * this image should be destroyed (using zbar_image_destroy()) as
+ * soon as the application is finished with it
+ */
+extern zbar_image_t *zbar_image_create(void);
+
+/** image destructor. all images created by or returned to the
+ * application should be destroyed using this function. when an image
+ * is destroyed, the associated data cleanup handler will be invoked
+ * if available
+ * @note make no assumptions about the image or the data buffer.
+ * they may not be destroyed/cleaned immediately if the library
+ * is still using them. if necessary, use the cleanup handler hook
+ * to keep track of image data buffers
+ */
+extern void zbar_image_destroy(zbar_image_t *image);
+
+/** image reference count manipulation.
+ * increment the reference count when you store a new reference to the
+ * image. decrement when the reference is no longer used. do not
+ * refer to the image any longer once the count is decremented.
+ * zbar_image_ref(image, -1) is the same as zbar_image_destroy(image)
+ * @since 0.5
+ */
+extern void zbar_image_ref(zbar_image_t *image,
+ int refs);
+
+/** image format conversion. refer to the documentation for supported
+ * image formats
+ * @returns a @em new image with the sample data from the original image
+ * converted to the requested format. the original image is
+ * unaffected.
+ * @note the converted image size may be rounded (up) due to format
+ * constraints
+ */
+extern zbar_image_t *zbar_image_convert(const zbar_image_t *image,
+ unsigned long format);
+
+/** image format conversion with crop/pad.
+ * if the requested size is larger than the image, the last row/column
+ * are duplicated to cover the difference. if the requested size is
+ * smaller than the image, the extra rows/columns are dropped from the
+ * right/bottom.
+ * @returns a @em new image with the sample data from the original
+ * image converted to the requested format and size.
+ * @note the image is @em not scaled
+ * @see zbar_image_convert()
+ * @since 0.4
+ */
+extern zbar_image_t *zbar_image_convert_resize(const zbar_image_t *image,
+ unsigned long format,
+ unsigned width,
+ unsigned height);
+
+/** retrieve the image format.
+ * @returns the fourcc describing the format of the image sample data
+ */
+extern unsigned long zbar_image_get_format(const zbar_image_t *image);
+
+/** retrieve a "sequence" (page/frame) number associated with this image.
+ * @since 0.6
+ */
+extern unsigned zbar_image_get_sequence(const zbar_image_t *image);
+
+/** retrieve the width of the image.
+ * @returns the width in sample columns
+ */
+extern unsigned zbar_image_get_width(const zbar_image_t *image);
+
+/** retrieve the height of the image.
+ * @returns the height in sample rows
+ */
+extern unsigned zbar_image_get_height(const zbar_image_t *image);
+
+/** return the image sample data. the returned data buffer is only
+ * valid until zbar_image_destroy() is called
+ */
+extern const void *zbar_image_get_data(const zbar_image_t *image);
+
+/** return the size of image data.
+ * @since 0.6
+ */
+extern unsigned long zbar_image_get_data_length(const zbar_image_t *img);
+
+/** retrieve the decoded results.
+ * @returns the (possibly empty) set of decoded symbols
+ * @returns NULL if the image has not been scanned
+ * @since 0.10
+ */
+extern const zbar_symbol_set_t*
+zbar_image_get_symbols(const zbar_image_t *image);
+
+/** associate the specified symbol set with the image, replacing any
+ * existing results. use NULL to release the current results from the
+ * image.
+ * @see zbar_image_scanner_recycle_image()
+ * @since 0.10
+ */
+extern void zbar_image_set_symbols(zbar_image_t *image,
+ const zbar_symbol_set_t *symbols);
+
+/** image_scanner decode result iterator.
+ * @returns the first decoded symbol result for an image
+ * or NULL if no results are available
+ */
+extern const zbar_symbol_t*
+zbar_image_first_symbol(const zbar_image_t *image);
+
+/** specify the fourcc image format code for image sample data.
+ * refer to the documentation for supported formats.
+ * @note this does not convert the data!
+ * (see zbar_image_convert() for that)
+ */
+extern void zbar_image_set_format(zbar_image_t *image,
+ unsigned long format);
+
+/** associate a "sequence" (page/frame) number with this image.
+ * @since 0.6
+ */
+extern void zbar_image_set_sequence(zbar_image_t *image,
+ unsigned sequence_num);
+
+/** specify the pixel size of the image.
+ * @note this does not affect the data!
+ */
+extern void zbar_image_set_size(zbar_image_t *image,
+ unsigned width,
+ unsigned height);
+
+/** specify image sample data. when image data is no longer needed by
+ * the library the specific data cleanup handler will be called
+ * (unless NULL)
+ * @note application image data will not be modified by the library
+ */
+extern void zbar_image_set_data(zbar_image_t *image,
+ const void *data,
+ unsigned long data_byte_length,
+ zbar_image_cleanup_handler_t *cleanup_hndlr);
+
+/** built-in cleanup handler.
+ * passes the image data buffer to free()
+ */
+extern void zbar_image_free_data(zbar_image_t *image);
+
+/** associate user specified data value with an image.
+ * @since 0.5
+ */
+extern void zbar_image_set_userdata(zbar_image_t *image,
+ void *userdata);
+
+/** return user specified data value associated with the image.
+ * @since 0.5
+ */
+extern void *zbar_image_get_userdata(const zbar_image_t *image);
+
+/** dump raw image data to a file for debug.
+ * the data will be prefixed with a 16 byte header consisting of:
+ * - 4 bytes uint = 0x676d697a ("zimg")
+ * - 4 bytes format fourcc
+ * - 2 bytes width
+ * - 2 bytes height
+ * - 4 bytes size of following image data in bytes
+ * this header can be dumped w/eg:
+ * @verbatim
+ od -Ax -tx1z -N16 -w4 [file]
+@endverbatim
+ * for some formats the image can be displayed/converted using
+ * ImageMagick, eg:
+ * @verbatim
+ display -size 640x480+16 [-depth ?] [-sampling-factor ?x?] \
+ {GRAY,RGB,UYVY,YUV}:[file]
+@endverbatim
+ *
+ * @param image the image object to dump
+ * @param filebase base filename, appended with ".XXXX.zimg" where
+ * XXXX is the format fourcc
+ * @returns 0 on success or a system error code on failure
+ */
+extern int zbar_image_write(const zbar_image_t *image,
+ const char *filebase);
+
+/** read back an image in the format written by zbar_image_write()
+ * @note TBD
+ */
+extern zbar_image_t *zbar_image_read(char *filename);
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Processor interface
+ * @anchor c-processor
+ * high-level self-contained image processor.
+ * processes video and images for barcodes, optionally displaying
+ * images to a library owned output window
+ */
+/*@{*/
+
+struct zbar_processor_s;
+/** opaque standalone processor object. */
+typedef struct zbar_processor_s zbar_processor_t;
+
+/** constructor.
+ * if threaded is set and threading is available the processor
+ * will spawn threads where appropriate to avoid blocking and
+ * improve responsiveness
+ */
+extern zbar_processor_t *zbar_processor_create(int threaded);
+
+/** destructor. cleans up all resources associated with the processor
+ */
+extern void zbar_processor_destroy(zbar_processor_t *processor);
+
+/** (re)initialization.
+ * opens a video input device and/or prepares to display output
+ */
+extern int zbar_processor_init(zbar_processor_t *processor,
+ const char *video_device,
+ int enable_display);
+
+/** request a preferred size for the video image from the device.
+ * the request may be adjusted or completely ignored by the driver.
+ * @note must be called before zbar_processor_init()
+ * @since 0.6
+ */
+extern int zbar_processor_request_size(zbar_processor_t *processor,
+ unsigned width,
+ unsigned height);
+
+/** request a preferred video driver interface version for
+ * debug/testing.
+ * @note must be called before zbar_processor_init()
+ * @since 0.6
+ */
+extern int zbar_processor_request_interface(zbar_processor_t *processor,
+ int version);
+
+/** request a preferred video I/O mode for debug/testing. You will
+ * get errors if the driver does not support the specified mode.
+ * @verbatim
+ 0 = auto-detect
+ 1 = force I/O using read()
+ 2 = force memory mapped I/O using mmap()
+ 3 = force USERPTR I/O (v4l2 only)
+@endverbatim
+ * @note must be called before zbar_processor_init()
+ * @since 0.7
+ */
+extern int zbar_processor_request_iomode(zbar_processor_t *video,
+ int iomode);
+
+/** force specific input and output formats for debug/testing.
+ * @note must be called before zbar_processor_init()
+ */
+extern int zbar_processor_force_format(zbar_processor_t *processor,
+ unsigned long input_format,
+ unsigned long output_format);
+
+/** setup result handler callback.
+ * the specified function will be called by the processor whenever
+ * new results are available from the video stream or a static image.
+ * pass a NULL value to disable callbacks.
+ * @param processor the object on which to set the handler.
+ * @param handler the function to call when new results are available.
+ * @param userdata is set as with zbar_processor_set_userdata().
+ * @returns the previously registered handler
+ */
+extern zbar_image_data_handler_t*
+zbar_processor_set_data_handler(zbar_processor_t *processor,
+ zbar_image_data_handler_t *handler,
+ const void *userdata);
+
+/** associate user specified data value with the processor.
+ * @since 0.6
+ */
+extern void zbar_processor_set_userdata(zbar_processor_t *processor,
+ void *userdata);
+
+/** return user specified data value associated with the processor.
+ * @since 0.6
+ */
+extern void *zbar_processor_get_userdata(const zbar_processor_t *processor);
+
+/** set config for indicated symbology (0 for all) to specified value.
+ * @returns 0 for success, non-0 for failure (config does not apply to
+ * specified symbology, or value out of range)
+ * @see zbar_decoder_set_config()
+ * @since 0.4
+ */
+extern int zbar_processor_set_config(zbar_processor_t *processor,
+ zbar_symbol_type_t symbology,
+ zbar_config_t config,
+ int value);
+
+/** parse configuration string using zbar_parse_config()
+ * and apply to processor using zbar_processor_set_config().
+ * @returns 0 for success, non-0 for failure
+ * @see zbar_parse_config()
+ * @see zbar_processor_set_config()
+ * @since 0.4
+ */
+static inline int zbar_processor_parse_config (zbar_processor_t *processor,
+ const char *config_string)
+{
+ zbar_symbol_type_t sym;
+ zbar_config_t cfg;
+ int val;
+ return(zbar_parse_config(config_string, &sym, &cfg, &val) ||
+ zbar_processor_set_config(processor, sym, cfg, val));
+}
+
+/** retrieve the current state of the ouput window.
+ * @returns 1 if the output window is currently displayed, 0 if not.
+ * @returns -1 if an error occurs
+ */
+extern int zbar_processor_is_visible(zbar_processor_t *processor);
+
+/** show or hide the display window owned by the library.
+ * the size will be adjusted to the input size
+ */
+extern int zbar_processor_set_visible(zbar_processor_t *processor,
+ int visible);
+
+/** control the processor in free running video mode.
+ * only works if video input is initialized. if threading is in use,
+ * scanning will occur in the background, otherwise this is only
+ * useful wrapping calls to zbar_processor_user_wait(). if the
+ * library output window is visible, video display will be enabled.
+ */
+extern int zbar_processor_set_active(zbar_processor_t *processor,
+ int active);
+
+/** retrieve decode results for last scanned image/frame.
+ * @returns the symbol set result container or NULL if no results are
+ * available
+ * @note the returned symbol set has its reference count incremented;
+ * ensure that the count is decremented after use
+ * @since 0.10
+ */
+extern const zbar_symbol_set_t*
+zbar_processor_get_results(const zbar_processor_t *processor);
+
+/** wait for input to the display window from the user
+ * (via mouse or keyboard).
+ * @returns >0 when input is received, 0 if timeout ms expired
+ * with no input or -1 in case of an error
+ */
+extern int zbar_processor_user_wait(zbar_processor_t *processor,
+ int timeout);
+
+/** process from the video stream until a result is available,
+ * or the timeout (in milliseconds) expires.
+ * specify a timeout of -1 to scan indefinitely
+ * (zbar_processor_set_active() may still be used to abort the scan
+ * from another thread).
+ * if the library window is visible, video display will be enabled.
+ * @note that multiple results may still be returned (despite the
+ * name).
+ * @returns >0 if symbols were successfully decoded,
+ * 0 if no symbols were found (ie, the timeout expired)
+ * or -1 if an error occurs
+ */
+extern int zbar_process_one(zbar_processor_t *processor,
+ int timeout);
+
+/** process the provided image for barcodes.
+ * if the library window is visible, the image will be displayed.
+ * @returns >0 if symbols were successfully decoded,
+ * 0 if no symbols were found or -1 if an error occurs
+ */
+extern int zbar_process_image(zbar_processor_t *processor,
+ zbar_image_t *image);
+
+/** display detail for last processor error to stderr.
+ * @returns a non-zero value suitable for passing to exit()
+ */
+static inline int
+zbar_processor_error_spew (const zbar_processor_t *processor,
+ int verbosity)
+{
+ return(_zbar_error_spew(processor, verbosity));
+}
+
+/** retrieve the detail string for the last processor error. */
+static inline const char*
+zbar_processor_error_string (const zbar_processor_t *processor,
+ int verbosity)
+{
+ return(_zbar_error_string(processor, verbosity));
+}
+
+/** retrieve the type code for the last processor error. */
+static inline zbar_error_t
+zbar_processor_get_error_code (const zbar_processor_t *processor)
+{
+ return(_zbar_get_error_code(processor));
+}
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Video interface
+ * @anchor c-video
+ * mid-level video source abstraction.
+ * captures images from a video device
+ */
+/*@{*/
+
+struct zbar_video_s;
+/** opaque video object. */
+typedef struct zbar_video_s zbar_video_t;
+
+/** constructor. */
+extern zbar_video_t *zbar_video_create(void);
+
+/** destructor. */
+extern void zbar_video_destroy(zbar_video_t *video);
+
+/** open and probe a video device.
+ * the device specified by platform specific unique name
+ * (v4l device node path in *nix eg "/dev/video",
+ * DirectShow DevicePath property in windows).
+ * @returns 0 if successful or -1 if an error occurs
+ */
+extern int zbar_video_open(zbar_video_t *video,
+ const char *device);
+
+/** retrieve file descriptor associated with open *nix video device
+ * useful for using select()/poll() to tell when new images are
+ * available (NB v4l2 only!!).
+ * @returns the file descriptor or -1 if the video device is not open
+ * or the driver only supports v4l1
+ */
+extern int zbar_video_get_fd(const zbar_video_t *video);
+
+/** request a preferred size for the video image from the device.
+ * the request may be adjusted or completely ignored by the driver.
+ * @returns 0 if successful or -1 if the video device is already
+ * initialized
+ * @since 0.6
+ */
+extern int zbar_video_request_size(zbar_video_t *video,
+ unsigned width,
+ unsigned height);
+
+/** request a preferred driver interface version for debug/testing.
+ * @note must be called before zbar_video_open()
+ * @since 0.6
+ */
+extern int zbar_video_request_interface(zbar_video_t *video,
+ int version);
+
+/** request a preferred I/O mode for debug/testing. You will get
+ * errors if the driver does not support the specified mode.
+ * @verbatim
+ 0 = auto-detect
+ 1 = force I/O using read()
+ 2 = force memory mapped I/O using mmap()
+ 3 = force USERPTR I/O (v4l2 only)
+@endverbatim
+ * @note must be called before zbar_video_open()
+ * @since 0.7
+ */
+extern int zbar_video_request_iomode(zbar_video_t *video,
+ int iomode);
+
+/** retrieve current output image width.
+ * @returns the width or 0 if the video device is not open
+ */
+extern int zbar_video_get_width(const zbar_video_t *video);
+
+/** retrieve current output image height.
+ * @returns the height or 0 if the video device is not open
+ */
+extern int zbar_video_get_height(const zbar_video_t *video);
+
+/** initialize video using a specific format for debug.
+ * use zbar_negotiate_format() to automatically select and initialize
+ * the best available format
+ */
+extern int zbar_video_init(zbar_video_t *video,
+ unsigned long format);
+
+/** start/stop video capture.
+ * all buffered images are retired when capture is disabled.
+ * @returns 0 if successful or -1 if an error occurs
+ */
+extern int zbar_video_enable(zbar_video_t *video,
+ int enable);
+
+/** retrieve next captured image. blocks until an image is available.
+ * @returns NULL if video is not enabled or an error occurs
+ */
+extern zbar_image_t *zbar_video_next_image(zbar_video_t *video);
+
+/** display detail for last video error to stderr.
+ * @returns a non-zero value suitable for passing to exit()
+ */
+static inline int zbar_video_error_spew (const zbar_video_t *video,
+ int verbosity)
+{
+ return(_zbar_error_spew(video, verbosity));
+}
+
+/** retrieve the detail string for the last video error. */
+static inline const char *zbar_video_error_string (const zbar_video_t *video,
+ int verbosity)
+{
+ return(_zbar_error_string(video, verbosity));
+}
+
+/** retrieve the type code for the last video error. */
+static inline zbar_error_t
+zbar_video_get_error_code (const zbar_video_t *video)
+{
+ return(_zbar_get_error_code(video));
+}
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Window interface
+ * @anchor c-window
+ * mid-level output window abstraction.
+ * displays images to user-specified platform specific output window
+ */
+/*@{*/
+
+struct zbar_window_s;
+/** opaque window object. */
+typedef struct zbar_window_s zbar_window_t;
+
+/** constructor. */
+extern zbar_window_t *zbar_window_create(void);
+
+/** destructor. */
+extern void zbar_window_destroy(zbar_window_t *window);
+
+/** associate reader with an existing platform window.
+ * This can be any "Drawable" for X Windows or a "HWND" for windows.
+ * input images will be scaled into the output window.
+ * pass NULL to detach from the resource, further input will be
+ * ignored
+ */
+extern int zbar_window_attach(zbar_window_t *window,
+ void *x11_display_w32_hwnd,
+ unsigned long x11_drawable);
+
+/** control content level of the reader overlay.
+ * the overlay displays graphical data for informational or debug
+ * purposes. higher values increase the level of annotation (possibly
+ * decreasing performance). @verbatim
+ 0 = disable overlay
+ 1 = outline decoded symbols (default)
+ 2 = also track and display input frame rate
+@endverbatim
+ */
+extern void zbar_window_set_overlay(zbar_window_t *window,
+ int level);
+
+/** retrieve current content level of reader overlay.
+ * @see zbar_window_set_overlay()
+ * @since 0.10
+ */
+extern int zbar_window_get_overlay(const zbar_window_t *window);
+
+/** draw a new image into the output window. */
+extern int zbar_window_draw(zbar_window_t *window,
+ zbar_image_t *image);
+
+/** redraw the last image (exposure handler). */
+extern int zbar_window_redraw(zbar_window_t *window);
+
+/** resize the image window (reconfigure handler).
+ * this does @em not update the contents of the window
+ * @since 0.3, changed in 0.4 to not redraw window
+ */
+extern int zbar_window_resize(zbar_window_t *window,
+ unsigned width,
+ unsigned height);
+
+/** display detail for last window error to stderr.
+ * @returns a non-zero value suitable for passing to exit()
+ */
+static inline int zbar_window_error_spew (const zbar_window_t *window,
+ int verbosity)
+{
+ return(_zbar_error_spew(window, verbosity));
+}
+
+/** retrieve the detail string for the last window error. */
+static inline const char*
+zbar_window_error_string (const zbar_window_t *window,
+ int verbosity)
+{
+ return(_zbar_error_string(window, verbosity));
+}
+
+/** retrieve the type code for the last window error. */
+static inline zbar_error_t
+zbar_window_get_error_code (const zbar_window_t *window)
+{
+ return(_zbar_get_error_code(window));
+}
+
+
+/** select a compatible format between video input and output window.
+ * the selection algorithm attempts to use a format shared by
+ * video input and window output which is also most useful for
+ * barcode scanning. if a format conversion is necessary, it will
+ * heuristically attempt to minimize the cost of the conversion
+ */
+extern int zbar_negotiate_format(zbar_video_t *video,
+ zbar_window_t *window);
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Image Scanner interface
+ * @anchor c-imagescanner
+ * mid-level image scanner interface.
+ * reads barcodes from 2-D images
+ */
+/*@{*/
+
+struct zbar_image_scanner_s;
+/** opaque image scanner object. */
+typedef struct zbar_image_scanner_s zbar_image_scanner_t;
+
+/** constructor. */
+extern zbar_image_scanner_t *zbar_image_scanner_create(void);
+
+/** destructor. */
+extern void zbar_image_scanner_destroy(zbar_image_scanner_t *scanner);
+
+/** setup result handler callback.
+ * the specified function will be called by the scanner whenever
+ * new results are available from a decoded image.
+ * pass a NULL value to disable callbacks.
+ * @returns the previously registered handler
+ */
+extern zbar_image_data_handler_t*
+zbar_image_scanner_set_data_handler(zbar_image_scanner_t *scanner,
+ zbar_image_data_handler_t *handler,
+ const void *userdata);
+
+
+/** set config for indicated symbology (0 for all) to specified value.
+ * @returns 0 for success, non-0 for failure (config does not apply to
+ * specified symbology, or value out of range)
+ * @see zbar_decoder_set_config()
+ * @since 0.4
+ */
+extern int zbar_image_scanner_set_config(zbar_image_scanner_t *scanner,
+ zbar_symbol_type_t symbology,
+ zbar_config_t config,
+ int value);
+
+/** parse configuration string using zbar_parse_config()
+ * and apply to image scanner using zbar_image_scanner_set_config().
+ * @returns 0 for success, non-0 for failure
+ * @see zbar_parse_config()
+ * @see zbar_image_scanner_set_config()
+ * @since 0.4
+ */
+static inline int
+zbar_image_scanner_parse_config (zbar_image_scanner_t *scanner,
+ const char *config_string)
+{
+ zbar_symbol_type_t sym;
+ zbar_config_t cfg;
+ int val;
+ return(zbar_parse_config(config_string, &sym, &cfg, &val) ||
+ zbar_image_scanner_set_config(scanner, sym, cfg, val));
+}
+
+/** enable or disable the inter-image result cache (default disabled).
+ * mostly useful for scanning video frames, the cache filters
+ * duplicate results from consecutive images, while adding some
+ * consistency checking and hysteresis to the results.
+ * this interface also clears the cache
+ */
+extern void zbar_image_scanner_enable_cache(zbar_image_scanner_t *scanner,
+ int enable);
+
+/** remove any previously decoded results from the image scanner and the
+ * specified image. somewhat more efficient version of
+ * zbar_image_set_symbols(image, NULL) which may retain memory for
+ * subsequent decodes
+ * @since 0.10
+ */
+extern void zbar_image_scanner_recycle_image(zbar_image_scanner_t *scanner,
+ zbar_image_t *image);
+
+/** retrieve decode results for last scanned image.
+ * @returns the symbol set result container or NULL if no results are
+ * available
+ * @note the symbol set does not have its reference count adjusted;
+ * ensure that the count is incremented if the results may be kept
+ * after the next image is scanned
+ * @since 0.10
+ */
+extern const zbar_symbol_set_t*
+zbar_image_scanner_get_results(const zbar_image_scanner_t *scanner);
+
+/** scan for symbols in provided image. The image format must be
+ * "Y800" or "GRAY".
+ * @returns >0 if symbols were successfully decoded from the image,
+ * 0 if no symbols were found or -1 if an error occurs
+ * @see zbar_image_convert()
+ * @since 0.9 - changed to only accept grayscale images
+ */
+extern int zbar_scan_image(zbar_image_scanner_t *scanner,
+ zbar_image_t *image);
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Decoder interface
+ * @anchor c-decoder
+ * low-level bar width stream decoder interface.
+ * identifies symbols and extracts encoded data
+ */
+/*@{*/
+
+struct zbar_decoder_s;
+/** opaque decoder object. */
+typedef struct zbar_decoder_s zbar_decoder_t;
+
+/** decoder data handler callback function.
+ * called by decoder when new data has just been decoded
+ */
+typedef void (zbar_decoder_handler_t)(zbar_decoder_t *decoder);
+
+/** constructor. */
+extern zbar_decoder_t *zbar_decoder_create(void);
+
+/** destructor. */
+extern void zbar_decoder_destroy(zbar_decoder_t *decoder);
+
+/** set config for indicated symbology (0 for all) to specified value.
+ * @returns 0 for success, non-0 for failure (config does not apply to
+ * specified symbology, or value out of range)
+ * @since 0.4
+ */
+extern int zbar_decoder_set_config(zbar_decoder_t *decoder,
+ zbar_symbol_type_t symbology,
+ zbar_config_t config,
+ int value);
+
+/** parse configuration string using zbar_parse_config()
+ * and apply to decoder using zbar_decoder_set_config().
+ * @returns 0 for success, non-0 for failure
+ * @see zbar_parse_config()
+ * @see zbar_decoder_set_config()
+ * @since 0.4
+ */
+static inline int zbar_decoder_parse_config (zbar_decoder_t *decoder,
+ const char *config_string)
+{
+ zbar_symbol_type_t sym;
+ zbar_config_t cfg;
+ int val;
+ return(zbar_parse_config(config_string, &sym, &cfg, &val) ||
+ zbar_decoder_set_config(decoder, sym, cfg, val));
+}
+
+/** clear all decoder state.
+ * any partial symbols are flushed
+ */
+extern void zbar_decoder_reset(zbar_decoder_t *decoder);
+
+/** mark start of a new scan pass.
+ * clears any intra-symbol state and resets color to ::ZBAR_SPACE.
+ * any partially decoded symbol state is retained
+ */
+extern void zbar_decoder_new_scan(zbar_decoder_t *decoder);
+
+/** process next bar/space width from input stream.
+ * the width is in arbitrary relative units. first value of a scan
+ * is ::ZBAR_SPACE width, alternating from there.
+ * @returns appropriate symbol type if width completes
+ * decode of a symbol (data is available for retrieval)
+ * @returns ::ZBAR_PARTIAL as a hint if part of a symbol was decoded
+ * @returns ::ZBAR_NONE (0) if no new symbol data is available
+ */
+extern zbar_symbol_type_t zbar_decode_width(zbar_decoder_t *decoder,
+ unsigned width);
+
+/** retrieve color of @em next element passed to
+ * zbar_decode_width(). */
+extern zbar_color_t zbar_decoder_get_color(const zbar_decoder_t *decoder);
+
+/** retrieve last decoded data.
+ * @returns the data string or NULL if no new data available.
+ * the returned data buffer is owned by library, contents are only
+ * valid between non-0 return from zbar_decode_width and next library
+ * call
+ */
+extern const char *zbar_decoder_get_data(const zbar_decoder_t *decoder);
+
+/** retrieve length of binary data.
+ * @returns the length of the decoded data or 0 if no new data
+ * available.
+ */
+extern unsigned int
+zbar_decoder_get_data_length(const zbar_decoder_t *decoder);
+
+/** retrieve last decoded symbol type.
+ * @returns the type or ::ZBAR_NONE if no new data available
+ */
+extern zbar_symbol_type_t
+zbar_decoder_get_type(const zbar_decoder_t *decoder);
+
+/** setup data handler callback.
+ * the registered function will be called by the decoder
+ * just before zbar_decode_width() returns a non-zero value.
+ * pass a NULL value to disable callbacks.
+ * @returns the previously registered handler
+ */
+extern zbar_decoder_handler_t*
+zbar_decoder_set_handler(zbar_decoder_t *decoder,
+ zbar_decoder_handler_t *handler);
+
+/** associate user specified data value with the decoder. */
+extern void zbar_decoder_set_userdata(zbar_decoder_t *decoder,
+ void *userdata);
+
+/** return user specified data value associated with the decoder. */
+extern void *zbar_decoder_get_userdata(const zbar_decoder_t *decoder);
+
+/*@}*/
+
+/*------------------------------------------------------------*/
+/** @name Scanner interface
+ * @anchor c-scanner
+ * low-level linear intensity sample stream scanner interface.
+ * identifies "bar" edges and measures width between them.
+ * optionally passes to bar width decoder
+ */
+/*@{*/
+
+struct zbar_scanner_s;
+/** opaque scanner object. */
+typedef struct zbar_scanner_s zbar_scanner_t;
+
+/** constructor.
+ * if decoder is non-NULL it will be attached to scanner
+ * and called automatically at each new edge
+ * current color is initialized to ::ZBAR_SPACE
+ * (so an initial BAR->SPACE transition may be discarded)
+ */
+extern zbar_scanner_t *zbar_scanner_create(zbar_decoder_t *decoder);
+
+/** destructor. */
+extern void zbar_scanner_destroy(zbar_scanner_t *scanner);
+
+/** clear all scanner state.
+ * also resets an associated decoder
+ */
+extern zbar_symbol_type_t zbar_scanner_reset(zbar_scanner_t *scanner);
+
+/** mark start of a new scan pass. resets color to ::ZBAR_SPACE.
+ * also updates an associated decoder.
+ * @returns any decode results flushed from the pipeline
+ * @note when not using callback handlers, the return value should
+ * be checked the same as zbar_scan_y()
+ * @note call zbar_scanner_flush() at least twice before calling this
+ * method to ensure no decode results are lost
+ */
+extern zbar_symbol_type_t zbar_scanner_new_scan(zbar_scanner_t *scanner);
+
+/** flush scanner processing pipeline.
+ * forces current scanner position to be a scan boundary.
+ * call multiple times (max 3) to completely flush decoder.
+ * @returns any decode/scan results flushed from the pipeline
+ * @note when not using callback handlers, the return value should
+ * be checked the same as zbar_scan_y()
+ * @since 0.9
+ */
+extern zbar_symbol_type_t zbar_scanner_flush(zbar_scanner_t *scanner);
+
+/** process next sample intensity value.
+ * intensity (y) is in arbitrary relative units.
+ * @returns result of zbar_decode_width() if a decoder is attached,
+ * otherwise @returns (::ZBAR_PARTIAL) when new edge is detected
+ * or 0 (::ZBAR_NONE) if no new edge is detected
+ */
+extern zbar_symbol_type_t zbar_scan_y(zbar_scanner_t *scanner,
+ int y);
+
+/** process next sample from RGB (or BGR) triple. */
+static inline zbar_symbol_type_t zbar_scan_rgb24 (zbar_scanner_t *scanner,
+ unsigned char *rgb)
+{
+ return(zbar_scan_y(scanner, rgb[0] + rgb[1] + rgb[2]));
+}
+
+/** retrieve last scanned width. */
+extern unsigned zbar_scanner_get_width(const zbar_scanner_t *scanner);
+
+/** retrieve sample position of last edge.
+ * @since 0.10
+ */
+extern unsigned zbar_scanner_get_edge(const zbar_scanner_t *scn,
+ unsigned offset,
+ int prec);
+
+/** retrieve last scanned color. */
+extern zbar_color_t zbar_scanner_get_color(const zbar_scanner_t *scanner);
+
+/*@}*/
+
+#ifdef __cplusplus
+ }
+}
+
+# include "zbar/Exception.h"
+# include "zbar/Decoder.h"
+# include "zbar/Scanner.h"
+# include "zbar/Symbol.h"
+# include "zbar/Image.h"
+# include "zbar/ImageScanner.h"
+# include "zbar/Video.h"
+# include "zbar/Window.h"
+# include "zbar/Processor.h"
+#endif
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Decoder.h b/Software/External_Repositories/ZBar/include/zbar/Decoder.h
new file mode 100644
index 000000000..3e65d5ed5
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Decoder.h
@@ -0,0 +1,193 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_DECODER_H_
+#define _ZBAR_DECODER_H_
+
+/// @file
+/// Decoder C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Decoder.h"
+#endif
+
+#include <string>
+
+namespace zbar {
+
+/// low-level bar width stream decoder interface.
+/// identifies symbols and extracts encoded data
+
+class Decoder {
+ public:
+
+ /// Decoder result handler.
+ /// applications should subtype this and pass an instance to
+ /// set_handler() to implement result processing
+ class Handler {
+ public:
+ virtual ~Handler() { }
+
+ /// invoked by the Decoder as decode results become available.
+ virtual void decode_callback(Decoder &decoder) = 0;
+ };
+
+ /// constructor.
+ Decoder ()
+ : _handler(NULL)
+ {
+ _decoder = zbar_decoder_create();
+ }
+
+ ~Decoder ()
+ {
+ zbar_decoder_destroy(_decoder);
+ }
+
+ /// clear all decoder state.
+ /// see zbar_decoder_reset()
+ void reset ()
+ {
+ zbar_decoder_reset(_decoder);
+ }
+
+ /// mark start of a new scan pass.
+ /// see zbar_decoder_new_scan()
+ void new_scan ()
+ {
+ zbar_decoder_new_scan(_decoder);
+ }
+
+ /// process next bar/space width from input stream.
+ /// see zbar_decode_width()
+ zbar_symbol_type_t decode_width (unsigned width)
+ {
+ return(zbar_decode_width(_decoder, width));
+ }
+
+ /// process next bar/space width from input stream.
+ /// see zbar_decode_width()
+ Decoder& operator<< (unsigned width)
+ {
+ zbar_decode_width(_decoder, width);
+ return(*this);
+ }
+
+ /// retrieve color of @em next element passed to Decoder.
+ /// see zbar_decoder_get_color()
+ zbar_color_t get_color () const
+ {
+ return(zbar_decoder_get_color(_decoder));
+ }
+
+ /// retrieve last decoded symbol type.
+ /// see zbar_decoder_get_type()
+ zbar_symbol_type_t get_type () const
+ {
+ return(zbar_decoder_get_type(_decoder));
+ }
+
+ /// retrieve string name of last decoded symbol type.
+ /// see zbar_get_symbol_name()
+ const char *get_symbol_name () const
+ {
+ return(zbar_get_symbol_name(zbar_decoder_get_type(_decoder)));
+ }
+
+ /// retrieve string name for last decode addon.
+ /// see zbar_get_addon_name()
+ const char *get_addon_name () const
+ {
+ return(zbar_get_addon_name(zbar_decoder_get_type(_decoder)));
+ }
+
+ /// retrieve last decoded data in ASCII format as a char array.
+ /// see zbar_decoder_get_data()
+ const char *get_data_chars() const
+ {
+ return(zbar_decoder_get_data(_decoder));
+ }
+
+ /// retrieve last decoded data as a std::string.
+ /// see zbar_decoder_get_data()
+ const std::string get_data_string() const
+ {
+ return(std::string(zbar_decoder_get_data(_decoder),
+ zbar_decoder_get_data_length(_decoder)));
+ }
+
+ /// retrieve last decoded data as a std::string.
+ /// see zbar_decoder_get_data()
+ const std::string get_data() const
+ {
+ return(get_data_string());
+ }
+
+ /// retrieve length of decoded binary data.
+ /// see zbar_decoder_get_data_length()
+ int get_data_length() const
+ {
+ return(zbar_decoder_get_data_length(_decoder));
+ }
+
+ /// setup callback to handle result data.
+ void set_handler (Handler &handler)
+ {
+ _handler = &handler;
+ zbar_decoder_set_handler(_decoder, _cb);
+ zbar_decoder_set_userdata(_decoder, this);
+ }
+
+ /// set config for indicated symbology (0 for all) to specified value.
+ /// @see zbar_decoder_set_config()
+ /// @since 0.4
+ int set_config (zbar_symbol_type_t symbology,
+ zbar_config_t config,
+ int value)
+ {
+ return(zbar_decoder_set_config(_decoder, symbology, config, value));
+ }
+
+ /// set config parsed from configuration string.
+ /// @see zbar_decoder_parse_config()
+ /// @since 0.4
+ int set_config (std::string cfgstr)
+ {
+ return(zbar_decoder_parse_config(_decoder, cfgstr.c_str()));
+ }
+
+ private:
+ friend class Scanner;
+ zbar_decoder_t *_decoder;
+ Handler *_handler;
+
+ static void _cb (zbar_decoder_t *cdcode)
+ {
+ Decoder *dcode = (Decoder*)zbar_decoder_get_userdata(cdcode);
+ if(dcode && dcode->_handler)
+ dcode->_handler->decode_callback(*dcode);
+ }
+};
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Exception.h b/Software/External_Repositories/ZBar/include/zbar/Exception.h
new file mode 100644
index 000000000..236622f69
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Exception.h
@@ -0,0 +1,187 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_EXCEPTION_H_
+#define _ZBAR_EXCEPTION_H_
+
+/// @file
+/// C++ Exception definitions
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Exception.h"
+#endif
+
+#include <exception>
+#include <new>
+
+namespace zbar {
+
+/// base class for exceptions defined by this API.
+class Exception : public std::exception {
+
+public:
+ /// create exception from C library error
+ Exception (const void *obj = NULL)
+ : std::exception(),
+ _obj(obj)
+ { }
+
+ ~Exception () throw() { }
+
+ /// retrieve error message
+ virtual const char* what () const throw()
+ {
+ if(!_obj)
+ return("zbar library unspecified generic error");
+ return(_zbar_error_string(_obj, 0));
+ }
+
+private:
+ const void *_obj;
+};
+
+/// internal library error.
+class InternalError : public Exception {
+public:
+ /// create exception from C library error
+ InternalError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// unsupported request.
+class UnsupportedError : public Exception {
+public:
+ /// create exception from C library error
+ UnsupportedError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// invalid request.
+class InvalidError : public Exception {
+public:
+ /// create exception from C library error
+ InvalidError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// failed system call.
+class SystemError : public Exception {
+public:
+ /// create exception from C library error
+ SystemError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// locking error.
+class LockingError : public Exception {
+public:
+ /// create exception from C library error
+ LockingError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// all resources busy.
+class BusyError : public Exception {
+public:
+ /// create exception from C library error
+ BusyError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// X11 display error.
+class XDisplayError : public Exception {
+public:
+ /// create exception from C library error
+ XDisplayError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// X11 protocol error.
+class XProtoError : public Exception {
+public:
+ /// create exception from C library error
+ XProtoError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// output window is closed.
+class ClosedError : public Exception {
+public:
+ /// create exception from C library error
+ ClosedError (const void *obj)
+ : Exception(obj)
+ { }
+};
+
+/// image format error
+class FormatError : public Exception {
+ // FIXME needs c equivalent
+
+ virtual const char* what () const throw()
+ {
+ // FIXME what format?
+ return("unsupported format");
+ }
+};
+
+/// @internal
+
+/// extract error information and create exception.
+static inline std::exception throw_exception (const void *obj)
+{
+ switch(_zbar_get_error_code(obj)) {
+ case ZBAR_ERR_NOMEM:
+ throw std::bad_alloc();
+ case ZBAR_ERR_INTERNAL:
+ throw InternalError(obj);
+ case ZBAR_ERR_UNSUPPORTED:
+ throw UnsupportedError(obj);
+ case ZBAR_ERR_INVALID:
+ throw InvalidError(obj);
+ case ZBAR_ERR_SYSTEM:
+ throw SystemError(obj);
+ case ZBAR_ERR_LOCKING:
+ throw LockingError(obj);
+ case ZBAR_ERR_BUSY:
+ throw BusyError(obj);
+ case ZBAR_ERR_XDISPLAY:
+ throw XDisplayError(obj);
+ case ZBAR_ERR_XPROTO:
+ throw XProtoError(obj);
+ case ZBAR_ERR_CLOSED:
+ throw ClosedError(obj);
+ default:
+ throw Exception(obj);
+ }
+}
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Image.h b/Software/External_Repositories/ZBar/include/zbar/Image.h
new file mode 100644
index 000000000..e1d964404
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Image.h
@@ -0,0 +1,290 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_IMAGE_H_
+#define _ZBAR_IMAGE_H_
+
+/// @file
+/// Image C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Image.h"
+#endif
+
+#include <assert.h>
+#include <iterator>
+#include "Symbol.h"
+#include "Exception.h"
+
+namespace zbar {
+
+class Video;
+
+/// stores image data samples along with associated format and size
+/// metadata
+
+class Image {
+public:
+
+ /// general Image result handler.
+ /// applications should subtype this and pass an instance to
+ /// eg. ImageScanner::set_handler() to implement result processing
+ class Handler {
+ public:
+ virtual ~Handler() { }
+
+ /// invoked by library when Image should be processed
+ virtual void image_callback(Image &image) = 0;
+
+ /// cast this handler to the C handler
+ operator zbar_image_data_handler_t* () const
+ {
+ return(_cb);
+ }
+
+ private:
+ static void _cb (zbar_image_t *zimg,
+ const void *userdata)
+ {
+ if(userdata) {
+ Image *image = (Image*)zbar_image_get_userdata(zimg);
+ ((Handler*)userdata)->image_callback(*image);
+ }
+ }
+ };
+
+ class SymbolIterator : public zbar::SymbolIterator {
+ public:
+ /// default constructor.
+ SymbolIterator ()
+ : zbar::SymbolIterator()
+ { }
+
+ /// constructor.
+ SymbolIterator (const SymbolSet &syms)
+ : zbar::SymbolIterator(syms)
+ { }
+
+ /// copy constructor.
+ SymbolIterator (const SymbolIterator& iter)
+ : zbar::SymbolIterator(iter)
+ { }
+ };
+
+ /// constructor.
+ /// create a new Image with the specified parameters
+ Image (unsigned width = 0,
+ unsigned height = 0,
+ const std::string& format = "",
+ const void *data = NULL,
+ unsigned long length = 0)
+ : _img(zbar_image_create())
+ {
+ zbar_image_set_userdata(_img, this);
+ if(width && height)
+ set_size(width, height);
+ if(format.length())
+ set_format(format);
+ if(data && length)
+ set_data(data, length);
+ }
+
+ ~Image ()
+ {
+ zbar_image_ref(_img, -1);
+ }
+
+ /// cast to C image object
+ operator const zbar_image_t* () const
+ {
+ return(_img);
+ }
+
+ /// cast to C image object
+ operator zbar_image_t* ()
+ {
+ return(_img);
+ }
+
+ /// retrieve the image format.
+ /// see zbar_image_get_format()
+ unsigned long get_format () const
+ {
+ return(zbar_image_get_format(_img));
+ }
+
+ /// specify the fourcc image format code for image sample data.
+ /// see zbar_image_set_format()
+ void set_format (unsigned long format)
+ {
+ zbar_image_set_format(_img, format);
+ }
+
+ /// specify the fourcc image format code for image sample data.
+ /// see zbar_image_set_format()
+ void set_format (const std::string& format)
+ {
+ if(format.length() != 4)
+ throw FormatError();
+ unsigned long fourcc = ((format[0] & 0xff) |
+ ((format[1] & 0xff) << 8) |
+ ((format[2] & 0xff) << 16) |
+ ((format[3] & 0xff) << 24));
+ zbar_image_set_format(_img, fourcc);
+ }
+
+ /// retrieve a "sequence" (page/frame) number associated with this
+ /// image.
+ /// see zbar_image_get_sequence()
+ /// @since 0.6
+ unsigned get_sequence () const
+ {
+ return(zbar_image_get_sequence(_img));
+ }
+
+ /// associate a "sequence" (page/frame) number with this image.
+ /// see zbar_image_set_sequence()
+ /// @since 0.6
+ void set_sequence (unsigned sequence_num)
+ {
+ zbar_image_set_sequence(_img, sequence_num);
+ }
+
+ /// retrieve the width of the image.
+ /// see zbar_image_get_width()
+ unsigned get_width () const
+ {
+ return(zbar_image_get_width(_img));
+ }
+
+ /// retrieve the height of the image.
+ /// see zbar_image_get_height()
+ unsigned get_height () const
+ {
+ return(zbar_image_get_height(_img));
+ }
+
+ /// specify the pixel size of the image.
+ /// see zbar_image_set_size()
+ void set_size (unsigned width,
+ unsigned height)
+ {
+ zbar_image_set_size(_img, width, height);
+ }
+
+ /// return the image sample data.
+ /// see zbar_image_get_data()
+ const void *get_data () const
+ {
+ return(zbar_image_get_data(_img));
+ }
+
+ /// return the size of the image sample data.
+ /// see zbar_image_get_data_length()
+ /// @since 0.6
+ unsigned long get_data_length () const
+ {
+ return(zbar_image_get_data_length(_img));
+ }
+
+ /// specify image sample data.
+ /// see zbar_image_set_data()
+ void set_data (const void *data,
+ unsigned long length)
+ {
+ zbar_image_set_data(_img, data, length, _cleanup);
+ }
+
+ /// image format conversion.
+ /// see zbar_image_convert()
+ Image convert (unsigned long format) const
+ {
+ zbar_image_t *img = zbar_image_convert(_img, format);
+ if(img)
+ return(Image(img));
+ throw FormatError();
+ }
+
+ /// image format conversion with crop/pad.
+ /// see zbar_image_convert_resize()
+ /// @since 0.4
+ Image convert (unsigned long format,
+ unsigned width,
+ unsigned height) const
+ {
+ zbar_image_t *img =
+ zbar_image_convert_resize(_img, format, width, height);
+ if(img)
+ return(Image(img));
+ throw FormatError();
+ }
+
+ const SymbolSet get_symbols () const {
+ return(SymbolSet(zbar_image_get_symbols(_img)));
+ }
+
+ void set_symbols (const SymbolSet &syms) {
+ zbar_image_set_symbols(_img, syms);
+ }
+
+ /// create a new SymbolIterator over decoded results.
+ SymbolIterator symbol_begin () const {
+ return(SymbolIterator(get_symbols()));
+ }
+
+ /// return a SymbolIterator suitable for ending iteration.
+ SymbolIterator symbol_end () const {
+ return(SymbolIterator());
+ }
+
+protected:
+
+ friend class Video;
+
+ /// constructor.
+ /// @internal
+ /// create a new Image from a zbar_image_t C object
+ Image (zbar_image_t *src,
+ int refs = 0)
+ : _img(src)
+ {
+ if(refs)
+ zbar_image_ref(_img, refs);
+ zbar_image_set_userdata(_img, this);
+ }
+
+ /// default data cleanup (noop)
+ /// @internal
+ static void _cleanup (zbar_image_t *img)
+ {
+ // by default nothing is cleaned
+ assert(img);
+ assert(zbar_image_get_userdata(img));
+ }
+
+private:
+ zbar_image_t *_img;
+};
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/ImageScanner.h b/Software/External_Repositories/ZBar/include/zbar/ImageScanner.h
new file mode 100644
index 000000000..bda84338d
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/ImageScanner.h
@@ -0,0 +1,130 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_IMAGE_SCANNER_H_
+#define _ZBAR_IMAGE_SCANNER_H_
+
+/// @file
+/// Image Scanner C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/ImageScanner.h"
+#endif
+
+#include "Image.h"
+
+namespace zbar {
+
+/// mid-level image scanner interface.
+/// reads barcodes from a 2-D Image
+
+class ImageScanner {
+public:
+ /// constructor.
+ ImageScanner (zbar_image_scanner_t *scanner = NULL)
+ {
+ if(scanner)
+ _scanner = scanner;
+ else
+ _scanner = zbar_image_scanner_create();
+ }
+
+ ~ImageScanner ()
+ {
+ zbar_image_scanner_destroy(_scanner);
+ }
+
+ /// cast to C image_scanner object
+ operator zbar_image_scanner_t* () const
+ {
+ return(_scanner);
+ }
+
+ /// setup result handler callback.
+ void set_handler (Image::Handler &handler)
+ {
+ zbar_image_scanner_set_data_handler(_scanner, handler, &handler);
+ }
+
+ /// set config for indicated symbology (0 for all) to specified value.
+ /// @see zbar_image_scanner_set_config()
+ /// @since 0.4
+ int set_config (zbar_symbol_type_t symbology,
+ zbar_config_t config,
+ int value)
+ {
+ return(zbar_image_scanner_set_config(_scanner, symbology,
+ config, value));
+ }
+
+ /// set config parsed from configuration string.
+ /// @see zbar_image_scanner_parse_config()
+ /// @since 0.4
+ int set_config (std::string cfgstr)
+ {
+ return(zbar_image_scanner_parse_config(_scanner, cfgstr.c_str()));
+ }
+
+ /// enable or disable the inter-image result cache.
+ /// see zbar_image_scanner_enable_cache()
+ void enable_cache (bool enable = true)
+ {
+ zbar_image_scanner_enable_cache(_scanner, enable);
+ }
+
+ /// remove previous results from scanner and image.
+ /// @see zbar_image_scanner_recycle_image()
+ /// @since 0.10
+ void recycle_image (Image &image)
+ {
+ zbar_image_scanner_recycle_image(_scanner, image);
+ }
+
+ /// retrieve decode results for last scanned image.
+ /// @see zbar_image_scanner_get_results()
+ /// @since 0.10
+ const SymbolSet get_results () const {
+ return(SymbolSet(zbar_image_scanner_get_results(_scanner)));
+ }
+
+ /// scan for symbols in provided image.
+ /// see zbar_scan_image()
+ int scan (Image& image)
+ {
+ return(zbar_scan_image(_scanner, image));
+ }
+
+ /// scan for symbols in provided image.
+ /// see zbar_scan_image()
+ ImageScanner& operator<< (Image& image)
+ {
+ scan(image);
+ return(*this);
+ }
+
+private:
+ zbar_image_scanner_t *_scanner;
+};
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Processor.h b/Software/External_Repositories/ZBar/include/zbar/Processor.h
new file mode 100644
index 000000000..51b0e1c4a
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Processor.h
@@ -0,0 +1,223 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_PROCESSOR_H_
+#define _ZBAR_PROCESSOR_H_
+
+/// @file
+/// Processor C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Processor.h"
+#endif
+
+#include "Exception.h"
+#include "Image.h"
+
+namespace zbar {
+
+/// high-level self-contained image processor.
+/// processes video and images for barcodes, optionally displaying
+/// images to a library owned output window
+
+class Processor {
+ public:
+ /// value to pass for no timeout.
+ static const int FOREVER = -1;
+
+ /// constructor.
+ Processor (bool threaded = true,
+ const char *video_device = "",
+ bool enable_display = true)
+ {
+ _processor = zbar_processor_create(threaded);
+ if(!_processor)
+ throw std::bad_alloc();
+ init(video_device, enable_display);
+ }
+
+ ~Processor ()
+ {
+ zbar_processor_destroy(_processor);
+ }
+
+ /// cast to C processor object.
+ operator zbar_processor_t* ()
+ {
+ return(_processor);
+ }
+
+ /// opens a video input device and/or prepares to display output.
+ /// see zbar_processor_init()
+ void init (const char *video_device = "",
+ bool enable_display = true)
+ {
+ if(zbar_processor_init(_processor, video_device, enable_display))
+ throw_exception(_processor);
+ }
+
+ /// setup result handler callback.
+ /// see zbar_processor_set_data_handler()
+ void set_handler (Image::Handler& handler)
+ {
+ zbar_processor_set_data_handler(_processor, handler, &handler);
+ }
+
+ /// set config for indicated symbology (0 for all) to specified value.
+ /// @see zbar_processor_set_config()
+ /// @since 0.4
+ int set_config (zbar_symbol_type_t symbology,
+ zbar_config_t config,
+ int value)
+ {
+ return(zbar_processor_set_config(_processor, symbology,
+ config, value));
+ }
+
+ /// set config parsed from configuration string.
+ /// @see zbar_processor_parse_config()
+ /// @since 0.4
+ int set_config (std::string cfgstr)
+ {
+ return(zbar_processor_parse_config(_processor, cfgstr.c_str()));
+ }
+
+ /// retrieve the current state of the ouput window.
+ /// see zbar_processor_is_visible()
+ bool is_visible ()
+ {
+ int rc = zbar_processor_is_visible(_processor);
+ if(rc < 0)
+ throw_exception(_processor);
+ return(rc != 0);
+ }
+
+ /// show or hide the display window owned by the library.
+ /// see zbar_processor_set_visible()
+ void set_visible (bool visible = true)
+ {
+ if(zbar_processor_set_visible(_processor, visible) < 0)
+ throw_exception(_processor);
+ }
+
+ /// control the processor in free running video mode.
+ /// see zbar_processor_set_active()
+ void set_active (bool active = true)
+ {
+ if(zbar_processor_set_active(_processor, active) < 0)
+ throw_exception(_processor);
+ }
+
+ /// retrieve decode results for last scanned image.
+ /// @see zbar_processor_get_results()
+ /// @since 0.10
+ const SymbolSet get_results () const {
+ return(SymbolSet(zbar_processor_get_results(_processor)));
+ }
+
+ /// wait for input to the display window from the user.
+ /// see zbar_processor_user_wait()
+ int user_wait (int timeout = FOREVER)
+ {
+ int rc = zbar_processor_user_wait(_processor, timeout);
+ if(rc < 0)
+ throw_exception(_processor);
+ return(rc);
+ }
+
+ /// process from the video stream until a result is available.
+ /// see zbar_process_one()
+ void process_one (int timeout = FOREVER)
+ {
+ if(zbar_process_one(_processor, timeout) < 0)
+ throw_exception(_processor);
+ }
+
+ /// process the provided image for barcodes.
+ /// see zbar_process_image()
+ void process_image (Image& image)
+ {
+ if(zbar_process_image(_processor, image) < 0)
+ throw_exception(_processor);
+ }
+
+ /// process the provided image for barcodes.
+ /// see zbar_process_image()
+ Processor& operator<< (Image& image)
+ {
+ process_image(image);
+ return(*this);
+ }
+
+ /// force specific input and output formats for debug/testing.
+ /// see zbar_processor_force_format()
+ void force_format (unsigned long input_format,
+ unsigned long output_format)
+ {
+ if(zbar_processor_force_format(_processor, input_format,
+ output_format))
+ throw_exception(_processor);
+ }
+
+ /// force specific input and output formats for debug/testing.
+ /// see zbar_processor_force_format()
+ void force_format (std::string& input_format,
+ std::string& output_format)
+ {
+ unsigned long ifourcc = *(unsigned long*)input_format.c_str();
+ unsigned long ofourcc = *(unsigned long*)output_format.c_str();
+ if(zbar_processor_force_format(_processor, ifourcc, ofourcc))
+ throw_exception(_processor);
+ }
+
+ /// request a preferred size for the video image from the device.
+ /// see zbar_processor_request_size()
+ /// @since 0.6
+ void request_size (int width, int height)
+ {
+ zbar_processor_request_size(_processor, width, height);
+ }
+
+ /// request a preferred driver interface version for debug/testing.
+ /// see zbar_processor_request_interface()
+ /// @since 0.6
+ void request_interface (int version)
+ {
+ zbar_processor_request_interface(_processor, version);
+ }
+
+ /// request a preferred I/O mode for debug/testing.
+ /// see zbar_processor_request_iomode()
+ /// @since 0.7
+ void request_iomode (int iomode)
+ {
+ if(zbar_processor_request_iomode(_processor, iomode))
+ throw_exception(_processor);
+ }
+
+ private:
+ zbar_processor_t *_processor;
+};
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Scanner.h b/Software/External_Repositories/ZBar/include/zbar/Scanner.h
new file mode 100644
index 000000000..8c9a756ba
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Scanner.h
@@ -0,0 +1,162 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_SCANNER_H_
+#define _ZBAR_SCANNER_H_
+
+/// @file
+/// Scanner C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Scanner.h"
+#endif
+
+#include <stdio.h>
+
+namespace zbar {
+
+/// low-level linear intensity sample stream scanner interface.
+/// identifies "bar" edges and measures width between them.
+/// optionally passes to bar width Decoder
+
+class Scanner {
+ public:
+
+ /// constructor.
+ /// @param decoder reference to a Decoder instance which will
+ /// be passed scan results automatically
+ Scanner (Decoder& decoder)
+ {
+ _scanner = zbar_scanner_create(decoder._decoder);
+ }
+
+ /// constructor.
+ /// @param decoder pointer to a Decoder instance which will
+ /// be passed scan results automatically
+ Scanner (Decoder* decoder = NULL)
+ {
+ zbar_decoder_t *zdcode = NULL;
+ if(decoder)
+ zdcode = decoder->_decoder;
+ _scanner = zbar_scanner_create(zdcode);
+ }
+
+ ~Scanner ()
+ {
+ zbar_scanner_destroy(_scanner);
+ }
+
+ /// clear all scanner state.
+ /// see zbar_scanner_reset()
+ void reset ()
+ {
+ zbar_scanner_reset(_scanner);
+ }
+
+ /// mark start of a new scan pass.
+ /// see zbar_scanner_new_scan()
+ zbar_symbol_type_t new_scan ()
+ {
+ _type = zbar_scanner_new_scan(_scanner);
+ return(_type);
+ }
+
+ /// flush scanner pipeline.
+ /// see zbar_scanner_flush()
+ zbar_symbol_type_t flush ()
+ {
+ _type = zbar_scanner_flush(_scanner);
+ return(_type);
+ }
+
+ /// process next sample intensity value.
+ /// see zbar_scan_y()
+ zbar_symbol_type_t scan_y (int y)
+ {
+ _type = zbar_scan_y(_scanner, y);
+ return(_type);
+ }
+
+ /// process next sample intensity value.
+ /// see zbar_scan_y()
+ Scanner& operator<< (int y)
+ {
+ _type = zbar_scan_y(_scanner, y);
+ return(*this);
+ }
+
+ /// process next sample from RGB (or BGR) triple.
+ /// see zbar_scan_rgb24()
+ zbar_symbol_type_t scan_rgb24 (unsigned char *rgb)
+ {
+ _type = zbar_scan_rgb24(_scanner, rgb);
+ return(_type);
+ }
+
+ /// process next sample from RGB (or BGR) triple.
+ /// see zbar_scan_rgb24()
+ Scanner& operator<< (unsigned char *rgb)
+ {
+ _type = zbar_scan_rgb24(_scanner, rgb);
+ return(*this);
+ }
+
+ /// retrieve last scanned width.
+ /// see zbar_scanner_get_width()
+ unsigned get_width () const
+ {
+ return(zbar_scanner_get_width(_scanner));
+ }
+
+ /// retrieve last scanned color.
+ /// see zbar_scanner_get_color()
+ zbar_color_t get_color () const
+ {
+ return(zbar_scanner_get_color(_scanner));
+ }
+
+ /// retrieve last scan result.
+ zbar_symbol_type_t get_type () const
+ {
+ return(_type);
+ }
+
+ /// cast to C scanner
+ operator zbar_scanner_t* () const
+ {
+ return(_scanner);
+ }
+
+ /// retrieve C scanner
+ const zbar_scanner_t *get_c_scanner () const
+ {
+ return(_scanner);
+ }
+
+ private:
+ zbar_scanner_t *_scanner;
+ zbar_symbol_type_t _type;
+};
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Symbol.h b/Software/External_Repositories/ZBar/include/zbar/Symbol.h
new file mode 100644
index 000000000..b47732a2c
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Symbol.h
@@ -0,0 +1,451 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_SYMBOL_H_
+#define _ZBAR_SYMBOL_H_
+
+/// @file
+/// Symbol C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Symbol.h"
+#endif
+
+#include <stdlib.h>
+#include <string>
+#include <ostream>
+#include <assert.h>
+
+namespace zbar {
+
+class SymbolIterator;
+
+/// container for decoded result symbols associated with an image
+/// or a composite symbol.
+
+class SymbolSet {
+public:
+ /// constructor.
+ SymbolSet (const zbar_symbol_set_t *syms = NULL)
+ : _syms(syms)
+ {
+ ref();
+ }
+
+ /// copy constructor.
+ SymbolSet (const SymbolSet& syms)
+ : _syms(syms._syms)
+ {
+ ref();
+ }
+
+ /// destructor.
+ ~SymbolSet ()
+ {
+ ref(-1);
+ }
+
+ /// manipulate reference count.
+ void ref (int delta = 1) const
+ {
+ if(_syms)
+ zbar_symbol_set_ref((zbar_symbol_set_t*)_syms, delta);
+ }
+
+ /// cast to C symbol set.
+ operator const zbar_symbol_set_t* () const
+ {
+ return(_syms);
+ }
+
+ int get_size ()
+ {
+ return((_syms) ? zbar_symbol_set_get_size(_syms) : 0);
+ }
+
+ /// create a new SymbolIterator over decoded results.
+ SymbolIterator symbol_begin() const;
+
+ /// return a SymbolIterator suitable for ending iteration.
+ const SymbolIterator symbol_end() const;
+
+private:
+ const zbar_symbol_set_t *_syms;
+};
+
+/// decoded barcode symbol result object. stores type, data, and
+/// image location of decoded symbol
+
+class Symbol {
+public:
+
+ /// image pixel location (x, y) coordinate tuple.
+ class Point {
+ public:
+ int x; ///< x-coordinate.
+ int y; ///< y-coordinate.
+
+ Point () { }
+
+ Point(int x, int y)
+ : x(x), y(y)
+ { }
+
+ /// copy constructor.
+ Point (const Point& pt)
+ {
+ x = pt.x;
+ y = pt.y;
+ }
+ };
+
+ /// iteration over Point objects in a symbol location polygon.
+ class PointIterator
+ : public std::iterator<std::input_iterator_tag, Point> {
+
+ public:
+ /// constructor.
+ PointIterator (const Symbol *sym = NULL,
+ int index = 0)
+ : _sym(sym),
+ _index(index)
+ {
+ sym->ref(1);
+ if(!sym ||
+ (unsigned)_index >= zbar_symbol_get_loc_size(*_sym))
+ _index = -1;
+ }
+
+ /// constructor.
+ PointIterator (const PointIterator& iter)
+ : _sym(iter._sym),
+ _index(iter._index)
+ {
+ _sym->ref();
+ }
+
+ /// destructor.
+ ~PointIterator ()
+ {
+ _sym->ref(-1);
+ }
+
+ /// advance iterator to next Point.
+ PointIterator& operator++ ()
+ {
+ unsigned int i = ++_index;
+ if(i >= zbar_symbol_get_loc_size(*_sym))
+ _index = -1;
+ return(*this);
+ }
+
+ /// retrieve currently referenced Point.
+ const Point operator* () const
+ {
+ assert(_index >= 0);
+ return(Point(zbar_symbol_get_loc_x(*_sym, _index),
+ zbar_symbol_get_loc_y(*_sym, _index)));
+ }
+
+ /// test if two iterators refer to the same Point in the same
+ /// Symbol.
+ bool operator== (const PointIterator& iter) const
+ {
+ return(_index == iter._index &&
+ ((_index < 0) || _sym == iter._sym));
+ }
+
+ /// test if two iterators refer to the same Point in the same
+ /// Symbol.
+ bool operator!= (const PointIterator& iter) const
+ {
+ return(!(*this == iter));
+ }
+
+ private:
+ const Symbol *_sym;
+ int _index;
+ };
+
+ /// constructor.
+ Symbol (const zbar_symbol_t *sym = NULL)
+ : _xmlbuf(NULL),
+ _xmllen(0)
+ {
+ init(sym);
+ ref();
+ }
+
+ /// copy constructor.
+ Symbol (const Symbol& sym)
+ : _sym(sym._sym),
+ _type(sym._type),
+ _data(sym._data),
+ _xmlbuf(NULL),
+ _xmllen(0)
+ {
+ ref();
+ }
+
+ /// destructor.
+ ~Symbol () {
+ if(_xmlbuf)
+ free(_xmlbuf);
+ ref(-1);
+ }
+
+ void ref (int delta = 1) const
+ {
+ if(_sym)
+ zbar_symbol_ref((zbar_symbol_t*)_sym, delta);
+ }
+
+ /// cast to C symbol.
+ operator const zbar_symbol_t* () const
+ {
+ return(_sym);
+ }
+
+ /// test if two Symbol objects refer to the same C symbol.
+ bool operator== (const Symbol& sym) const
+ {
+ return(_sym == sym._sym);
+ }
+
+ /// test if two Symbol objects refer to the same C symbol.
+ bool operator!= (const Symbol& sym) const
+ {
+ return(!(*this == sym));
+ }
+
+ /// retrieve type of decoded symbol.
+ zbar_symbol_type_t get_type () const
+ {
+ return(_type);
+ }
+
+ /// retrieve the string name of the symbol type.
+ const std::string get_type_name () const
+ {
+ return(zbar_get_symbol_name(_type));
+ }
+
+ /// retrieve the string name for any addon.
+ const std::string get_addon_name () const
+ {
+ return(zbar_get_addon_name(_type));
+ }
+
+ /// retrieve data decoded from symbol.
+ const std::string get_data () const
+ {
+ return(_data);
+ }
+
+ /// retrieve length of binary data
+ unsigned get_data_length () const
+ {
+ return((_sym) ? zbar_symbol_get_data_length(_sym) : 0);
+ }
+
+ /// retrieve inter-frame coherency count.
+ /// see zbar_symbol_get_count()
+ /// @since 1.5
+ int get_count () const
+ {
+ return((_sym) ? zbar_symbol_get_count(_sym) : -1);
+ }
+
+ SymbolSet get_components () const
+ {
+ return(SymbolSet((_sym) ? zbar_symbol_get_components(_sym) : NULL));
+ }
+
+ /// create a new PointIterator at the start of the location
+ /// polygon.
+ PointIterator point_begin() const
+ {
+ return(PointIterator(this));
+ }
+
+ /// return a PointIterator suitable for ending iteration.
+ const PointIterator point_end() const
+ {
+ return(PointIterator());
+ }
+
+ /// see zbar_symbol_get_loc_size().
+ int get_location_size () const
+ {
+ return((_sym) ? zbar_symbol_get_loc_size(_sym) : 0);
+ }
+
+ /// see zbar_symbol_get_loc_x().
+ int get_location_x (unsigned index) const
+ {
+ return((_sym) ? zbar_symbol_get_loc_x(_sym, index) : -1);
+ }
+
+ /// see zbar_symbol_get_loc_y().
+ int get_location_y (unsigned index) const
+ {
+ return((_sym) ? zbar_symbol_get_loc_y(_sym, index) : -1);
+ }
+
+ /// see zbar_symbol_xml().
+ const std::string xml () const
+ {
+ if(!_sym)
+ return("");
+ return(zbar_symbol_xml(_sym, (char**)&_xmlbuf, (unsigned*)&_xmllen));
+ }
+
+protected:
+
+ friend class SymbolIterator;
+
+ /// (re)initialize Symbol from C symbol object.
+ void init (const zbar_symbol_t *sym = NULL)
+ {
+ _sym = sym;
+ if(sym) {
+ _type = zbar_symbol_get_type(sym);
+ _data = std::string(zbar_symbol_get_data(sym),
+ zbar_symbol_get_data_length(sym));
+ }
+ else {
+ _type = ZBAR_NONE;
+ _data = "";
+ }
+ }
+
+private:
+ const zbar_symbol_t *_sym;
+ zbar_symbol_type_t _type;
+ std::string _data;
+ char *_xmlbuf;
+ unsigned _xmllen;
+};
+
+/// iteration over Symbol result objects in a scanned Image or SymbolSet.
+class SymbolIterator
+ : public std::iterator<std::input_iterator_tag, Symbol> {
+
+public:
+ /// default constructor.
+ SymbolIterator ()
+ { }
+
+ /// constructor.
+ SymbolIterator (const SymbolSet &syms)
+ : _syms(syms)
+ {
+ const zbar_symbol_set_t *zsyms = _syms;
+ if(zsyms)
+ _sym.init(zbar_symbol_set_first_symbol(zsyms));
+ }
+
+ /// copy constructor.
+ SymbolIterator (const SymbolIterator& iter)
+ : _syms(iter._syms)
+ {
+ const zbar_symbol_set_t *zsyms = _syms;
+ if(zsyms)
+ _sym.init(zbar_symbol_set_first_symbol(zsyms));
+ }
+
+ ~SymbolIterator ()
+ {
+ _sym.init();
+ }
+
+ /// advance iterator to next Symbol.
+ SymbolIterator& operator++ ()
+ {
+ const zbar_symbol_t *zsym = _sym;
+ if(zsym)
+ _sym.init(zbar_symbol_next(zsym));
+ else {
+ const zbar_symbol_set_t *zsyms = _syms;
+ if(zsyms)
+ _sym.init(zbar_symbol_set_first_symbol(zsyms));
+ }
+ return(*this);
+ }
+
+ /// retrieve currently referenced Symbol.
+ const Symbol operator* () const
+ {
+ return(_sym);
+ }
+
+ /// access currently referenced Symbol.
+ const Symbol* operator-> () const
+ {
+ return(&_sym);
+ }
+
+ /// test if two iterators refer to the same Symbol
+ bool operator== (const SymbolIterator& iter) const
+ {
+ // it is enough to test the symbols, as they belong
+ // to only one set (also simplifies invalid case)
+ return(_sym == iter._sym);
+ }
+
+ /// test if two iterators refer to the same Symbol
+ bool operator!= (const SymbolIterator& iter) const
+ {
+ return(!(*this == iter));
+ }
+
+ const SymbolIterator end () const {
+ return(SymbolIterator());
+ }
+
+private:
+ SymbolSet _syms;
+ Symbol _sym;
+};
+
+inline SymbolIterator SymbolSet::symbol_begin () const {
+ return(SymbolIterator(*this));
+}
+
+inline const SymbolIterator SymbolSet::symbol_end () const {
+ return(SymbolIterator());
+}
+
+/// @relates Symbol
+/// stream the string representation of a Symbol.
+static inline std::ostream& operator<< (std::ostream& out,
+ const Symbol& sym)
+{
+ out << sym.get_type_name()
+ << sym.get_addon_name()
+ << ":" << sym.get_data();
+ return(out);
+}
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Video.h b/Software/External_Repositories/ZBar/include/zbar/Video.h
new file mode 100644
index 000000000..2787d86b2
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Video.h
@@ -0,0 +1,170 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_VIDEO_H_
+#define _ZBAR_VIDEO_H_
+
+/// @file
+/// Video Input C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Video.h"
+#endif
+
+#include "Image.h"
+
+namespace zbar {
+
+/// mid-level video source abstraction.
+/// captures images from a video device
+
+class Video {
+public:
+ /// constructor.
+ Video (zbar_video_t *video = NULL)
+ {
+ if(video)
+ _video = video;
+ else
+ _video = zbar_video_create();
+ }
+
+ /// constructor.
+ Video (std::string& device)
+ {
+ _video = zbar_video_create();
+ open(device);
+ }
+
+ ~Video ()
+ {
+ zbar_video_destroy(_video);
+ }
+
+ /// cast to C video object.
+ operator zbar_video_t* () const
+ {
+ return(_video);
+ }
+
+ /// open and probe a video device.
+ void open (std::string& device)
+ {
+ if(zbar_video_open(_video, device.c_str()))
+ throw_exception(_video);
+ }
+
+ /// close video device if open.
+ void close ()
+ {
+ if(zbar_video_open(_video, NULL))
+ throw_exception(_video);
+ }
+
+ /// initialize video using a specific format for debug.
+ /// see zbar_video_init()
+ void init (unsigned long fourcc)
+ {
+ if(zbar_video_init(_video, fourcc))
+ throw_exception(_video);
+ }
+
+ /// initialize video using a specific format for debug.
+ /// see zbar_video_init()
+ void init (std::string& format)
+ {
+ unsigned int fourcc = *(unsigned int*)format.c_str();
+ if(zbar_video_init(_video, fourcc))
+ throw_exception(_video);
+ }
+
+ /// retrieve file descriptor associated with open *nix video device.
+ /// see zbar_video_get_fd()
+ int get_fd ()
+ {
+ return(zbar_video_get_fd(_video));
+ }
+
+ /// retrieve current output image width.
+ /// see zbar_video_get_width()
+ int get_width ()
+ {
+ return(zbar_video_get_width(_video));
+ }
+
+ /// retrieve current output image height.
+ /// see zbar_video_get_height()
+ int get_height ()
+ {
+ return(zbar_video_get_height(_video));
+ }
+
+ /// start/stop video capture.
+ /// see zbar_video_enable()
+ void enable (bool enable = true)
+ {
+ if(zbar_video_enable(_video, enable))
+ throw_exception(_video);
+ }
+
+ /// retrieve next captured image.
+ /// see zbar_video_next_image()
+ Image next_image ()
+ {
+ zbar_image_t *img = zbar_video_next_image(_video);
+ if(!img)
+ throw_exception(_video);
+ return(Image(img));
+ }
+
+ /// request a preferred size for the video image from the device.
+ /// see zbar_video_request_size()
+ /// @since 0.6
+ void request_size (int width, int height)
+ {
+ zbar_video_request_size(_video, width, height);
+ }
+
+ /// request a preferred driver interface version for debug/testing.
+ /// see zbar_video_request_interface()
+ /// @since 0.6
+ void request_interface (int version)
+ {
+ zbar_video_request_interface(_video, version);
+ }
+
+ /// request a preferred I/O mode for debug/testing.
+ /// see zbar_video_request_iomode()
+ /// @since 0.7
+ void request_iomode (int iomode)
+ {
+ if(zbar_video_request_iomode(_video, iomode))
+ throw_exception(_video);
+ }
+
+private:
+ zbar_video_t *_video;
+};
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/include/zbar/Window.h b/Software/External_Repositories/ZBar/include/zbar/Window.h
new file mode 100644
index 000000000..c91a405ae
--- /dev/null
+++ b/Software/External_Repositories/ZBar/include/zbar/Window.h
@@ -0,0 +1,136 @@
+//------------------------------------------------------------------------
+// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
+//
+// This file is part of the ZBar Bar Code Reader.
+//
+// The ZBar Bar Code Reader is free software; you can redistribute it
+// and/or modify it under the terms of the GNU Lesser Public License as
+// published by the Free Software Foundation; either version 2.1 of
+// the License, or (at your option) any later version.
+//
+// The ZBar Bar Code Reader is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser Public License for more details.
+//
+// You should have received a copy of the GNU Lesser Public License
+// along with the ZBar Bar Code Reader; if not, write to the Free
+// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA
+//
+// http://sourceforge.net/projects/zbar
+//------------------------------------------------------------------------
+#ifndef _ZBAR_WINDOW_H_
+#define _ZBAR_WINDOW_H_
+
+/// @file
+/// Output Window C++ wrapper
+
+#ifndef _ZBAR_H_
+# error "include zbar.h in your application, **not** zbar/Window.h"
+#endif
+
+#include "Image.h"
+
+namespace zbar {
+
+/// mid-level output window abstraction.
+/// displays images to user-specified platform specific output window
+
+class Window {
+public:
+ /// constructor.
+ Window (zbar_window_t *window = NULL)
+ {
+ if(window)
+ _window = window;
+ else
+ _window = zbar_window_create();
+ }
+
+ /// constructor.
+ Window (void *x11_display_w32_hwnd,
+ unsigned long x11_drawable)
+ {
+ _window = zbar_window_create();
+ attach(x11_display_w32_hwnd, x11_drawable);
+ }
+
+ ~Window ()
+ {
+ zbar_window_destroy(_window);
+ }
+
+ /// cast to C window object.
+ operator zbar_window_t* () const
+ {
+ return(_window);
+ }
+
+ /// associate reader with an existing platform window.
+ /// see zbar_window_attach()
+ void attach (void *x11_display_w32_hwnd,
+ unsigned long x11_drawable = 0)
+ {
+ if(zbar_window_attach(_window,
+ x11_display_w32_hwnd, x11_drawable) < 0)
+ throw_exception(_window);
+ }
+
+ /// control content level of the reader overlay.
+ /// see zbar_window_set_overlay()
+ void set_overlay (int level)
+ {
+ zbar_window_set_overlay(_window, level);
+ }
+
+ /// retrieve current content level of reader overlay.
+ /// see zbar_window_get_overlay()
+
+ /// draw a new image into the output window.
+ /// see zbar_window_draw()
+ void draw (Image& image)
+ {
+ if(zbar_window_draw(_window, image) < 0)
+ throw_exception(_window);
+ }
+
+ /// clear the image from the output window.
+ /// see zbar_window_draw()
+ void clear ()
+ {
+ if(zbar_window_draw(_window, NULL) < 0)
+ throw_exception(_window);
+ }
+
+ /// redraw the last image.
+ /// zbar_window_redraw()
+ void redraw ()
+ {
+ if(zbar_window_redraw(_window) < 0)
+ throw_exception(_window);
+ }
+
+ /// resize the image window.
+ /// zbar_window_resize()
+ void resize (unsigned width, unsigned height)
+ {
+ if(zbar_window_resize(_window, width, height) < 0)
+ throw_exception(_window);
+ }
+
+private:
+ zbar_window_t *_window;
+};
+
+/// select a compatible format between video input and output window.
+/// see zbar_negotiate_format()
+static inline void negotiate_format (Video& video, Window& window)
+{
+ if(zbar_negotiate_format(video, window) < 0)
+ throw_exception(video);
+}
+
+}
+
+#endif
diff --git a/Software/External_Repositories/ZBar/lib/libzbar-0.def b/Software/External_Repositories/ZBar/lib/libzbar-0.def
new file mode 100644
index 000000000..6c0d54b3d
--- /dev/null
+++ b/Software/External_Repositories/ZBar/lib/libzbar-0.def
@@ -0,0 +1,120 @@
+EXPORTS
+_zbar_error_spew
+_zbar_error_string
+_zbar_get_error_code
+zbar_decode_width
+zbar_decoder_create
+zbar_decoder_destroy
+zbar_decoder_get_color
+zbar_decoder_get_data
+zbar_decoder_get_data_length
+zbar_decoder_get_type
+zbar_decoder_get_userdata
+zbar_decoder_new_scan
+zbar_decoder_reset
+zbar_decoder_set_config
+zbar_decoder_set_handler
+zbar_decoder_set_userdata
+zbar_get_addon_name
+zbar_get_symbol_name
+zbar_image_convert
+zbar_image_convert_resize
+zbar_image_copy
+zbar_image_create
+zbar_image_destroy
+zbar_image_first_symbol
+zbar_image_free_data
+zbar_image_get_data
+zbar_image_get_data_length
+zbar_image_get_format
+zbar_image_get_height
+zbar_image_get_sequence
+zbar_image_get_symbols
+zbar_image_get_userdata
+zbar_image_get_width
+zbar_image_ref
+zbar_image_scanner_create
+zbar_image_scanner_destroy
+zbar_image_scanner_enable_cache
+zbar_image_scanner_get_results
+zbar_image_scanner_recycle_image
+zbar_image_scanner_set_config
+zbar_image_scanner_set_data_handler
+zbar_image_set_data
+zbar_image_set_format
+zbar_image_set_sequence
+zbar_image_set_size
+zbar_image_set_symbols
+zbar_image_set_userdata
+zbar_image_write
+zbar_increase_verbosity
+zbar_negotiate_format
+zbar_parse_config
+zbar_process_image
+zbar_process_one
+zbar_processor_create
+zbar_processor_destroy
+zbar_processor_force_format
+zbar_processor_get_results
+zbar_processor_get_userdata
+zbar_processor_init
+zbar_processor_is_visible
+zbar_processor_request_interface
+zbar_processor_request_iomode
+zbar_processor_request_size
+zbar_processor_set_active
+zbar_processor_set_config
+zbar_processor_set_data_handler
+zbar_processor_set_userdata
+zbar_processor_set_visible
+zbar_processor_user_wait
+zbar_scan_image
+zbar_scan_y
+zbar_scanner_create
+zbar_scanner_destroy
+zbar_scanner_flush
+zbar_scanner_get_color
+zbar_scanner_get_edge
+zbar_scanner_get_state
+zbar_scanner_get_width
+zbar_scanner_new_scan
+zbar_scanner_reset
+zbar_set_verbosity
+zbar_symbol_first_component
+zbar_symbol_get_components
+zbar_symbol_get_count
+zbar_symbol_get_data
+zbar_symbol_get_data_length
+zbar_symbol_get_loc_size
+zbar_symbol_get_loc_x
+zbar_symbol_get_loc_y
+zbar_symbol_get_quality
+zbar_symbol_get_type
+zbar_symbol_next
+zbar_symbol_ref
+zbar_symbol_set_first_symbol
+zbar_symbol_set_get_size
+zbar_symbol_set_ref
+zbar_symbol_xml
+zbar_version
+zbar_video_create
+zbar_video_destroy
+zbar_video_enable
+zbar_video_get_fd
+zbar_video_get_format
+zbar_video_get_height
+zbar_video_get_width
+zbar_video_init
+zbar_video_next_image
+zbar_video_open
+zbar_video_request_interface
+zbar_video_request_iomode
+zbar_video_request_size
+zbar_window_attach
+zbar_window_create
+zbar_window_destroy
+zbar_window_draw
+zbar_window_get_overlay
+zbar_window_redraw
+zbar_window_resize
+zbar_window_set_overlay
diff --git a/Software/External_Repositories/ZBar/lib/libzbar-0.lib b/Software/External_Repositories/ZBar/lib/libzbar-0.lib
new file mode 100644
index 000000000..7b15f726d
--- /dev/null
+++ b/Software/External_Repositories/ZBar/lib/libzbar-0.lib
Binary files differ
diff --git a/Software/External_Repositories/ZBar/lib/libzbar.dll.a b/Software/External_Repositories/ZBar/lib/libzbar.dll.a
new file mode 100644
index 000000000..a6d7f8acf
--- /dev/null
+++ b/Software/External_Repositories/ZBar/lib/libzbar.dll.a
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
index cd539235a..09f542836 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
index 691007139..ff9db3779 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
index 8264c04b0..86ac8562d 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
index 00f4779a7..b0950b3d7 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
index c82e7cff2..5285bbf10 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs
index c1f5d4f48..9f54837cb 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Tango.Core;
using Tango.Core.Helpers;
+using Tango.TCC.BL;
namespace Tango.MachineStudio.ColorCapture.Models
{
@@ -67,6 +68,42 @@ namespace Tango.MachineStudio.ColorCapture.Models
set { _sampleHeight = value; RaisePropertyChangedAuto(); }
}
+ private bool _autoRelease;
+ public bool AutoRelease
+ {
+ get { return _autoRelease; }
+ set { _autoRelease = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _similarityTolerance;
+ public double SimilarityTolerance
+ {
+ get { return _similarityTolerance; }
+ set { _similarityTolerance = value; RaisePropertyChangedAuto(); }
+ }
+
+ private DeltaEComparisons _deltaEComparison;
+ public DeltaEComparisons DeltaEComparison
+ {
+ get { return _deltaEComparison; }
+ set { _deltaEComparison = value; RaisePropertyChangedAuto(); }
+ }
+
+ private CardDetectionHistogramMethods _histogramComparison;
+ public CardDetectionHistogramMethods HistogramComparison
+ {
+ get { return _histogramComparison; }
+ set { _histogramComparison = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _enableDoubleChecking;
+ public bool EnableDoubleChecking
+ {
+ get { return _enableDoubleChecking; }
+ set { _enableDoubleChecking = value; RaisePropertyChangedAuto(); }
+ }
+
+
public CaptureConfig()
{
Columns = 10;
@@ -74,9 +111,13 @@ namespace Tango.MachineStudio.ColorCapture.Models
TargetIndex = 89;
SampleWidth = 300;
SampleHeight = 330;
+ SimilarityTolerance = 50;
SamplesFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "TCC Samples");
BenchmarksFile = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "TCC", "benchmarks_rgb_lab.csv");
TemplateFile = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "TCC", "template.bmp");
+ DeltaEComparison = DeltaEComparisons.CieDe2000;
+ HistogramComparison = CardDetectionHistogramMethods.Chi_Square;
+ EnableDoubleChecking = true;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs
new file mode 100644
index 000000000..8f3ab87c8
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.ColorCapture.Models
+{
+ public enum DeltaEComparisons
+ {
+ Cie1976,
+ Cie94,
+ CieDe2000,
+ Cmc
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj
index 1679f2af9..c30520f13 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj
@@ -104,6 +104,7 @@
<Compile Include="Models\BenchmarkItem.cs" />
<Compile Include="Models\CaptureConfig.cs" />
<Compile Include="Models\CaptureItem.cs" />
+ <Compile Include="Models\DeltaEComparisons.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
@@ -150,6 +151,10 @@
<Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
<Name>Tango.BL</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.CircularGauge\Tango.CircularGauge.csproj">
+ <Project>{6efd5895-177b-4bbb-af52-29f4d53b3fbd}</Project>
+ <Name>Tango.CircularGauge</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj">
<Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
<Name>Tango.Core</Name>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs
index 5b9d20bc4..21bb0baf0 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs
@@ -37,6 +37,8 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
private BitmapSource _last_original_source;
private DetectionOutput _last_detection_output;
private byte[] templateBitmap;
+ private DeltaEComparisons _lastDeltaEComparison;
+ private IColorSpaceComparison _deltaEComparison;
public IVideoCaptureProvider VideoProvider { get; set; }
@@ -124,6 +126,20 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
set { _config = value; RaisePropertyChangedAuto(); }
}
+ private bool _isPaused;
+ public bool IsPaused
+ {
+ get { return _isPaused; }
+ set { _isPaused = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _similarity;
+ public double Similarity
+ {
+ get { return _similarity; }
+ set { _similarity = value; RaisePropertyChangedAuto(); }
+ }
+
public RelayCommand ImportBenchmarksCommand { get; set; }
public RelayCommand ExportBenchmarksCommand { get; set; }
@@ -233,6 +249,19 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
var rgb = new Lab(MeasureL, _measureA, _measureB).ToRgb();
Color refColor = Color.FromArgb(255, (byte)rgb.R, (byte)rgb.G, (byte)rgb.B);
+ CsvFile<DetectionColor> means_csv = new CsvFile<DetectionColor>(new CsvDestination(sample_folder + "\\means.csv"));
+
+ foreach (var item in ColorDetector.EmptyColorMatrixFiducials(new DetectionInput()
+ {
+ Columns = Config.Columns,
+ Rows = Config.Rows,
+ }, _last_detection_output))
+ {
+ means_csv.Append(item);
+ }
+
+ means_csv.Dispose();
+
var captureItem = new CaptureItem()
{
Image = rectified_file,
@@ -250,6 +279,8 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
File.WriteAllText(capture_item_file, captureItem.ToJsonString());
CaptureItems.Insert(0, captureItem);
+
+ Clear();
}
catch (Exception ex)
{
@@ -313,13 +344,17 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
{
if (SelectedVideoDevice.IsStarted)
{
- _abort = true;
- SelectedVideoDevice.Stop();
- ProcessedColor = System.Windows.Media.Colors.Transparent;
- CapturedColor = System.Windows.Media.Colors.Transparent;
- Colors = null;
- DetectedSource = null;
- CaptureDeltaEController.Clear();
+ if (!IsPaused)
+ {
+ _abort = true;
+ SelectedVideoDevice.Stop();
+ Clear();
+ }
+ else
+ {
+ IsPaused = false;
+ Clear();
+ }
}
else
{
@@ -330,6 +365,16 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
}
}
+ private void Clear()
+ {
+ ProcessedColor = System.Windows.Media.Colors.Transparent;
+ CapturedColor = System.Windows.Media.Colors.Transparent;
+ Colors = null;
+ DetectedSource = null;
+ CaptureDeltaEController.Clear();
+ Similarity = 0;
+ }
+
private void OnSelectedVideoDeviceChanged(CaptureDevice previousDevice, CaptureDevice newDevice)
{
if (previousDevice != null)
@@ -346,7 +391,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
private async void OnVideoFrameReceived(object sender, Video.DirectShow.EventArguments.FrameReceivedEventArgs args)
{
- if (_abort) return;
+ if (_abort || IsPaused) return;
if (_cardDetector.CanDetect)
{
@@ -359,10 +404,23 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
DesiredBitmapHeight = Config.SampleHeight,
TargetIndex = Config.TargetIndex,
TemplateBitmapBytes = templateBitmap,
+ SimilarityTolerance = Config.SimilarityTolerance,
+ HistogramMethod = Config.HistogramComparison,
+ EnableDoubleChecking = Config.EnableDoubleChecking,
});
+ if (result.Similarity > 0)
+ {
+ Similarity = result.Similarity;
+ }
+
if (result.IsDetected)
{
+ if (Config.AutoRelease)
+ {
+ IsPaused = true;
+ }
+
_last_original_source = result.Source;
_last_detection_output = result.ColorDetectionOutput;
@@ -386,7 +444,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
//calculate delta E.
Lab measureLab = new Lab(MeasureL, MeasureA, MeasureB);
- DeltaE = measureLab.Compare(new Rgb(ProcessedColor.R, ProcessedColor.G, ProcessedColor.B), new CieDe2000Comparison());
+ DeltaE = measureLab.Compare(new Rgb(ProcessedColor.R, ProcessedColor.G, ProcessedColor.B), GetDeltaEComparison());
});
}
}
@@ -432,5 +490,32 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels
SettingsManager.Default.GetOrCreate<ColorCaptureSettings>().Config = Config;
SettingsManager.Default.Save();
}
+
+ private IColorSpaceComparison GetDeltaEComparison()
+ {
+ if (_lastDeltaEComparison != Config.DeltaEComparison || _deltaEComparison == null)
+ {
+ _lastDeltaEComparison = Config.DeltaEComparison;
+
+ if (Config.DeltaEComparison == DeltaEComparisons.Cie1976)
+ {
+ _deltaEComparison = new Cie1976Comparison();
+ }
+ else if (Config.DeltaEComparison == DeltaEComparisons.Cie94)
+ {
+ _deltaEComparison = new Cie94Comparison();
+ }
+ else if (Config.DeltaEComparison == DeltaEComparisons.CieDe2000)
+ {
+ _deltaEComparison = new CieDe2000Comparison();
+ }
+ else if (Config.DeltaEComparison == DeltaEComparisons.Cmc)
+ {
+ _deltaEComparison = new CmcComparison();
+ }
+ }
+
+ return _deltaEComparison;
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml
index c1555fbcd..d6f4890d7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml
@@ -1,9 +1,11 @@
<UserControl x:Class="Tango.MachineStudio.ColorCapture.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:models="clr-namespace:Tango.MachineStudio.ColorCapture.Models"
+ xmlns:gauge="clr-namespace:Tango.CircularGauge;assembly=Tango.CircularGauge"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:vm="clr-namespace:Tango.MachineStudio.ColorCapture.ViewModels"
xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
@@ -11,6 +13,7 @@
xmlns:componentsX="clr-namespace:RealTimeGraphX.WPF.Components;assembly=RealTimeGraphX.WPF"
xmlns:controls="clr-namespace:Tango.MachineStudio.ColorCapture.Controls"
xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:tcc="clr-namespace:Tango.TCC.BL;assembly=Tango.TCC.BL"
xmlns:realtimeGraphX="clr-namespace:RealTimeGraphX.WPF.Surfaces;assembly=RealTimeGraphX.WPF"
xmlns:global="clr-namespace:Tango.MachineStudio.ColorCapture"
xmlns:local="clr-namespace:Tango.MachineStudio.ColorCapture.Views"
@@ -18,14 +21,26 @@
d:DesignHeight="1080" d:DesignWidth="1920" Background="#202020" Foreground="#BBBBBB" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
<UserControl.Resources>
- <SolidColorBrush x:Key="Foreground" Color="#BBBBBB" />
- <SolidColorBrush x:Key="Background" Color="#202020" />
- <SolidColorBrush x:Key="Accent" Color="{StaticResource AccentColor}" />
- <SolidColorBrush x:Key="Red" Color="#FF5F5F" />
- <SolidColorBrush x:Key="Green" Color="#68E46E" />
- <SolidColorBrush x:Key="Blue" Color="#64B8EC" />
- <SolidColorBrush x:Key="BorderBrush" Color="#3E3E3E" />
- <SolidColorBrush x:Key="LightBackground" Color="#303030" />
+
+ <ResourceDictionary>
+ <ResourceDictionary.MergedDictionaries>
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml">
+ </ResourceDictionary>
+ </ResourceDictionary.MergedDictionaries>
+
+ <SolidColorBrush x:Key="Foreground" Color="#BBBBBB" />
+ <SolidColorBrush x:Key="Background" Color="#202020" />
+ <SolidColorBrush x:Key="Accent" Color="#03A9F4" />
+ <SolidColorBrush x:Key="Red" Color="#FF5F5F" />
+ <SolidColorBrush x:Key="Green" Color="#68E46E" />
+ <SolidColorBrush x:Key="Blue" Color="#64B8EC" />
+ <SolidColorBrush x:Key="BorderBrush" Color="#3E3E3E" />
+ <SolidColorBrush x:Key="LightBackground" Color="#303030" />
+
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
+ </ResourceDictionary>
</UserControl.Resources>
<Grid Margin="20">
@@ -62,6 +77,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="800"/>
+ <ColumnDefinition Width="200"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
@@ -82,6 +98,22 @@
<DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False">
<Setter Property="Kind" Value="Play"></Setter>
</DataTrigger>
+ <DataTrigger Binding="{Binding IsPaused}" Value="True">
+ <Setter Property="Kind" Value="Play"></Setter>
+ <DataTrigger.EnterActions>
+ <BeginStoryboard x:Name="blink">
+ <Storyboard>
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever">
+ <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" />
+ <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="1" />
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.EnterActions>
+ <DataTrigger.ExitActions>
+ <RemoveStoryboard BeginStoryboardName="blink" />
+ </DataTrigger.ExitActions>
+ </DataTrigger>
</Style.Triggers>
</Style>
</materialDesign:PackIcon.Style>
@@ -91,27 +123,94 @@
</DockPanel>
<Border Padding="2" Background="{StaticResource LightBackground}" BorderThickness="1" BorderBrush="{StaticResource Accent}" Margin="0 10 0 0">
- <Image Source="{Binding SelectedVideoDevice.VideoSource,Mode=OneWay,IsAsync=True}" Stretch="Fill">
- <Image.Style>
- <Style TargetType="Image">
- <Setter Property="Visibility" Value="Hidden"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="True">
- <Setter Property="Visibility" Value="Visible"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False">
- <Setter Property="Visibility" Value="Hidden"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Image.Style>
- </Image>
+ <Grid>
+ <Image Source="{Binding SelectedVideoDevice.VideoSource,Mode=OneWay,IsAsync=True}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant">
+ <Image.Style>
+ <Style TargetType="Image">
+ <Setter Property="Visibility" Value="Hidden"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="True">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False">
+ <Setter Property="Visibility" Value="Hidden"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Image.Style>
+ </Image>
+
+ <Border HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="40 10" CornerRadius="20" Margin="20" Visibility="{Binding SelectedVideoDevice.IsStarted,Converter={StaticResource BoolToVisConverter}}">
+ <Border.Background>
+ <SolidColorBrush Color="Black" Opacity="0.5"></SolidColorBrush>
+ </Border.Background>
+
+ <TextBlock Foreground="{StaticResource Accent}">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="Text" Value="Scanning..."></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsPaused}" Value="True">
+ <Setter Property="Text" Value="Card captured. Press 'play 'to resume scanning."></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ </TextBlock>
+ </Border>
+ </Grid>
</Border>
</DockPanel>
</Grid>
</Border>
- <Grid Grid.Column="1" Margin="200 60 0 0" HorizontalAlignment="Left">
+ <Grid Grid.Column="1">
+ <DockPanel Margin="20 130 20 20" VerticalAlignment="Top">
+ <TextBlock DockPanel.Dock="Top" FontSize="14" HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="{StaticResource Accent}">Similarity</TextBlock>
+ <Viewbox Margin="0 10 0 0">
+ <gauge:CircularGaugeControl
+ Radius="150"
+ ScaleRadius="110"
+ ScaleStartAngle="120"
+ ScaleSweepAngle="300"
+ PointerLength="85"
+ PointerCapRadius="35"
+ MinValue="0"
+ MaxValue="100"
+ MajorDivisionsCount="10"
+ MinorDivisionsCount="5"
+ CurrentValue="{Binding Similarity}"
+ ImageSize="40,50"
+ RangeIndicatorThickness="8"
+ RangeIndicatorRadius="120"
+ RangeIndicatorLightRadius="10"
+ RangeIndicatorLightOffset="80"
+ ScaleLabelRadius="90"
+ ScaleLabelSize="40,20"
+ ScaleLabelFontSize="18"
+ DialTextFontSize="18"
+ ScaleLabelForeground="LightGray"
+ MajorTickSize="10,3"
+ MinorTickSize="3,1"
+ MajorTickColor="LightGray"
+ MinorTickColor="LightGray"
+ ImageOffset="-50"
+ GaugeBackgroundColor="Black"
+ PointerThickness ="16"
+ OptimalRangeStartValue="{Binding Config.SimilarityTolerance}"
+ OptimalRangeEndValue="100"
+ OptimalRangeColor="#04CB04"
+ AboveOptimalRangeColor="#FF5151"
+ DialTextOffset="40"
+ DialTextColor="Black"
+ >
+
+ </gauge:CircularGaugeControl>
+ </Viewbox>
+ </DockPanel>
+ </Grid>
+
+ <Grid Grid.Column="2" Margin="0 60 0 0" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="180*"/>
<RowDefinition Height="130*"/>
@@ -206,6 +305,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="800"/>
+ <ColumnDefinition Width="200"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<DockPanel>
@@ -265,7 +365,7 @@
<DataGridTemplateColumn Header="#" Width="50">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
- <Image Width="30" Height="30" Source="{Binding Image}"></Image>
+ <Image Width="30" Height="30" Source="{Binding Image}" Stretch="Fill"></Image>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
@@ -312,10 +412,17 @@
</sharedControls:DoubleClickDataGrid>
</DockPanel>
- <DockPanel Grid.Column="1" Margin="120 0 60 0">
- <TextBlock HorizontalAlignment="Center" Margin="0 0 0 0" DockPanel.Dock="Top" Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Delta E Distance</TextBlock>
+ <DockPanel Grid.Column="2" Margin="0 0 60 0">
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DockPanel.Dock="Top">
+ <TextBlock Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Delta E Distance</TextBlock>
+ <TextBlock VerticalAlignment="Center" Margin="5 0 0 0">
+ <Run>(</Run>
+ <Run Text="{Binding Config.DeltaEComparison}"></Run>
+ <Run>)</Run>
+ </TextBlock>
+ </StackPanel>
<Grid>
- <Border Margin="0 10 0 0" Padding="20 0 20 0" BorderThickness="1" BorderBrush="#202020">
+ <Border Margin="0 10 0 0" Padding="0 0 15 0" BorderThickness="1" BorderBrush="#202020">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55"/>
@@ -358,7 +465,7 @@
</DataTemplate>
</TabItem.HeaderTemplate>
- <Grid Margin="0 20 20 20">
+ <Grid Margin="0 40 20 20">
<DockPanel>
<StackPanel Margin="0 10 0 0" HorizontalAlignment="Right" Orientation="Horizontal" DockPanel.Dock="Bottom">
<Button Command="{Binding ImportBenchmarksCommand}" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="45" MinWidth="150">IMPORT</Button>
@@ -454,23 +561,27 @@
</DataTemplate>
</TabItem.HeaderTemplate>
- <Border Width="700" Margin="0 100 0 0" VerticalAlignment="Center" TextElement.FontSize="20" Background="{StaticResource LightBackground}" Padding="20" CornerRadius="10">
+ <Border Width="750" Margin="0 0 0 0" VerticalAlignment="Center" TextElement.FontSize="16" Background="{StaticResource LightBackground}" Padding="20" CornerRadius="10" BorderThickness="1" BorderBrush="{StaticResource Accent}">
<Grid>
<Grid.ColumnDefinitions>
- <ColumnDefinition Width="144*"/>
- <ColumnDefinition Width="293*"/>
- <ColumnDefinition Width="163*"/>
+ <ColumnDefinition Width="196*"/>
+ <ColumnDefinition Width="331*"/>
+ <ColumnDefinition Width="193*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
- <RowDefinition Height="50"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="50"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
<RowDefinition Height="200"/>
- <RowDefinition Height="705*"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="40"/>
</Grid.RowDefinitions>
<TextBlock VerticalAlignment="Bottom" Height="27">Columns</TextBlock>
@@ -490,19 +601,42 @@
<TextBlock Grid.Row="5" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Samples Folder</TextBlock>
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Config.SamplesFolder}" IsReadOnly="True" FontSize="10"></TextBox>
- <Button Command="{Binding SelectSamplesFolderCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="5" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1">SELECT</Button>
+ <Button Command="{Binding SelectSamplesFolderCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="5" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button>
<TextBlock Grid.Row="6" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Benchmarks</TextBlock>
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Config.BenchmarksFile}" IsReadOnly="True" FontSize="10"></TextBox>
- <Button Command="{Binding SelectBenchmarksFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="6" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1">SELECT</Button>
+ <Button Command="{Binding SelectBenchmarksFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="6" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button>
<TextBlock Grid.Row="7" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Template</TextBlock>
<DockPanel Grid.Row="7" Grid.Column="1">
<TextBox Margin="0 10 0 0" DockPanel.Dock="Bottom" Text="{Binding Config.TemplateFile}" IsReadOnly="True" FontSize="10"></TextBox>
- <Image Width="150" Height="150" Source="{Binding Config.TemplateFile}" Stretch="Fill"></Image>
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Right" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Right">
+ <Run Text="{Binding ElementName=img,Path=Source.Width,Mode=OneWay,StringFormat='0'}"></Run> <Run>x</Run> <Run Text="{Binding ElementName=img,Path=Source.Height,Mode=OneWay,StringFormat='0'}"></Run>
+ </TextBlock>
+ <Border Width="150" Height="150" BorderThickness="1" BorderBrush="{StaticResource Accent}" Padding="1">
+ <Image x:Name="img" Source="{Binding Config.TemplateFile}" Stretch="Fill"></Image>
+ </Border>
+ </DockPanel>
</DockPanel>
- <Button Command="{Binding SelectTemplateFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="7" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1">SELECT</Button>
+ <Button Command="{Binding SelectTemplateFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="7" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button>
+
+ <TextBlock Grid.Row="8" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Similarity Tolerance</TextBlock>
+ <Slider Minimum="0" Maximum="100" Value="{Binding Config.SimilarityTolerance}" TickFrequency="1" IsSnapToTickEnabled="True" Grid.Row="8" Grid.Column="1" VerticalAlignment="Bottom" Height="18"></Slider>
+ <TextBlock Grid.Row="8" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Text="{Binding Config.SimilarityTolerance}"></TextBlock>
+
+ <TextBlock Grid.Row="9" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Auto Release</TextBlock>
+ <ToggleButton IsChecked="{Binding Config.AutoRelease}" Grid.Row="9" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton>
+
+ <TextBlock Grid.Row="10" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Delta E Standard</TextBlock>
+ <ComboBox Grid.Row="10" Grid.Column="1" Margin="0 8 0 0" ItemsSource="{Binding Source={x:Type models:DeltaEComparisons},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Config.DeltaEComparison}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
+ <TextBlock Grid.Row="11" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Histogram Similarity</TextBlock>
+ <ComboBox Grid.Row="11" Grid.Column="1" Margin="0 8 0 0" ItemsSource="{Binding Source={x:Type tcc:CardDetectionHistogramMethods},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Config.HistogramComparison}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
+ <TextBlock Grid.Row="12" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Double Checking</TextBlock>
+ <ToggleButton IsChecked="{Binding Config.EnableDoubleChecking}" Grid.Row="12" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton>
</Grid>
</Border>
</TabItem>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs
index 3aa9d4c88..f710cf082 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs
@@ -28,16 +28,17 @@ namespace Tango.MachineStudio.Common.Video
var availableDevices = CaptureDevice.GetAvailableCaptureDevices();
- for (int i = 0; i < 3; i++)
+ for (int i = 0; i < availableDevices.Count; i++)
{
- if (i > availableDevices.Count - 1)
- {
- AvailableCaptureDevices.Add(new CaptureDevice() { Device = null });
- }
- else
+ AvailableCaptureDevices.Add(new CaptureDevice() { Device = availableDevices[i] });
+ }
+
+ while (AvailableCaptureDevices.Count < 3)
+ {
+ AvailableCaptureDevices.Add(new CaptureDevice()
{
- AvailableCaptureDevices.Add(new CaptureDevice() { Device = availableDevices[i] });
- }
+ Device = null,
+ });
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
index 9794404b9..7c4e960ec 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
@@ -124,7 +124,7 @@
</StackPanel>
<StackPanel Margin="20 0 0 0" Orientation="Horizontal" VerticalAlignment="Center">
- <ToggleButton IsChecked="{Binding EnableKeepAlive}" VerticalAlignment="Center" ToolTip="Upload hardware configuration after connection is successful"></ToggleButton>
+ <ToggleButton IsChecked="{Binding EnableKeepAlive}" VerticalAlignment="Center" ToolTip="Allow a keep alive mechanism to improve lost connection detection"></ToggleButton>
<TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Keep Alive</TextBlock>
</StackPanel>
</StackPanel>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/App.config b/Software/Visual_Studio/TCC/Tango.TCC.BL/App.config
new file mode 100644
index 000000000..8f1b939fd
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/App.config
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs
index bd8b394ad..e63e0bdd1 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs
@@ -16,6 +16,9 @@ namespace Tango.TCC.BL
public int Rows { get; set; }
public int TargetIndex { get; set; }
public byte[] TemplateBitmapBytes { get; set; }
+ public double SimilarityTolerance { get; set; }
+ public CardDetectionHistogramMethods HistogramMethod { get; set; }
+ public bool EnableDoubleChecking { get; set; }
public CardDetectionConfig()
{
@@ -24,7 +27,10 @@ namespace Tango.TCC.BL
Columns = 10;
Rows = 11;
TargetIndex = 89;
+ SimilarityTolerance = 20;
Benchmarks = new List<DetectionBenchmark>();
+ HistogramMethod = CardDetectionHistogramMethods.Intersection;
+ EnableDoubleChecking = true;
}
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs
new file mode 100644
index 000000000..26125ea3f
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.TCC.BL
+{
+ public enum CardDetectionHistogramMethods
+ {
+ Correlation = 0,
+ Chi_Square = 1,
+ Intersection = 2,
+ BhattacharyyaDistance = 3,
+ None = 4,
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs
index 0cf7f3d67..117317dcd 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs
@@ -14,5 +14,7 @@ namespace Tango.TCC.BL
public BitmapSource Source { get; set; }
public BitmapSource DetectedBitmap { get; set; }
public DetectionOutput ColorDetectionOutput { get; set; }
+ public double Similarity { get; set; }
+ public String Barcode { get; set; }
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs
index c0f827e1b..50bcceeba 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs
@@ -17,6 +17,7 @@ namespace Tango.TCC.BL
private ColorDetector _colorDetector;
private static byte[] _defaultTemplate;
private static List<DetectionBenchmark> _defaultBenchmarks;
+ private byte[] _sourceBitmapBytes;
private bool _canDetect;
public bool CanDetect
@@ -54,14 +55,22 @@ namespace Tango.TCC.BL
CardDetectionResult detectionResult = new CardDetectionResult();
detectionResult.Source = cloned;
+ _sourceBitmapBytes = cloned.ToBytes(PixelFormats.Rgb24);
+
Tango.TCC.CardDetector.CardDetection detector = new TCC.CardDetector.CardDetection();
- var result = detector.Detect(cloned.ToBytes(PixelFormats.Rgb24), new TCC.CardDetector.CardDetectionConfig()
+ var result = detector.Detect(_sourceBitmapBytes, new TCC.CardDetector.CardDetectionConfig()
{
DesiredBitmapWidth = config.DesiredBitmapWidth,
DesiredBitmapHeight = config.DesiredBitmapHeight,
- TemplateBitmap = config.TemplateBitmapBytes != null ? config.TemplateBitmapBytes : _defaultTemplate.ToArray(),
+ TemplateBitmap = config.TemplateBitmapBytes != null ? config.TemplateBitmapBytes : _defaultTemplate,
+ SimilarityTolerance = config.SimilarityTolerance,
+ HistogramMethod = (int)config.HistogramMethod,
+ EnableDoubleChecking = config.EnableDoubleChecking,
});
+ detectionResult.Similarity = result.Similarity;
+ detectionResult.Barcode = result.Barcode;
+
if (result.IsDetected)
{
detectionResult.IsDetected = true;
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs
index a41124c42..d8a7f9dc7 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs
@@ -148,6 +148,25 @@ namespace Tango.TCC.BL
return bmp;
}
+ public static IEnumerable<DetectionColor> EmptyColorMatrixFiducials(DetectionInput detectionInput, DetectionOutput detectionOutput)
+ {
+ List<DetectionColor> colors = new List<DetectionColor>();
+
+ for (int i = 0; i < detectionOutput.ColorMatrix.Count; i++)
+ {
+ if (!IsDetectedColorFiducial(i + 1, detectionInput.Columns, detectionInput.Rows))
+ {
+ colors.Add(detectionOutput.ColorMatrix[i]);
+ }
+ else
+ {
+ colors.Add(new DetectionColor());
+ }
+ }
+
+ return colors;
+ }
+
public static bool IsDetectedColorFiducial(int index, int columns, int rows)
{
return index == 1 || index == columns || index == columns * rows || index == (columns * rows) - columns + 1;
@@ -159,7 +178,7 @@ namespace Tango.TCC.BL
return benchmarks;
}
- public static void SaveBenchmarks(String file,IEnumerable<DetectionBenchmark> benchmarks)
+ public static void SaveBenchmarks(String file, IEnumerable<DetectionBenchmark> benchmarks)
{
CsvFile<DetectionBenchmark> csvFile = new CsvFile<DetectionBenchmark>(new CsvDestination(file));
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs
new file mode 100644
index 000000000..8283ef332
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.TCC.BL.Entities
+{
+ [Table("DEVICES")]
+ public class Device : TCCEntityBase
+ {
+ [Column("DEVICE_ID")]
+ public String DeviceID { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs
new file mode 100644
index 000000000..5770bf1d0
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.TCC.BL.Entities
+{
+ public class TCCContext : DbContext
+ {
+ private DataSource _dataSource;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TCCContext"/> class.
+ /// </summary>
+ public TCCContext()
+ {
+
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TCCContext"/> class.
+ /// </summary>
+ /// <param name="dataSource">The data source.</param>
+ public TCCContext(DataSource dataSource) : base(dataSource.ToConnection(), true)
+ {
+ _dataSource = dataSource;
+ Database.SetInitializer<TCCContext>(null);
+ Configuration.LazyLoadingEnabled = false;
+ }
+
+ /// <summary>
+ /// Gets or sets the devices.
+ /// </summary>
+ public DbSet<Device> Devices
+ {
+ get; set;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs
new file mode 100644
index 000000000..9e3778a3c
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.TCC.BL.Entities
+{
+ public class TCCEntityBase
+ {
+ [Column("ID")]
+ public int ID { get; set; }
+
+ [Column("GUID")]
+ public String Guid { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj
index bb12c02cc..7d677edc3 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj
@@ -31,12 +31,19 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
@@ -55,15 +62,24 @@
<Compile Include="CardDetectionResult.cs" />
<Compile Include="CardDetector.cs" />
<Compile Include="ColorDetector.cs" />
+ <Compile Include="CardDetectionHistogramMethods.cs" />
+ <Compile Include="Entities\Device.cs" />
+ <Compile Include="Entities\TCCContext.cs" />
+ <Compile Include="Entities\TCCEntityBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Web\ColorDetectionRequest.cs" />
<Compile Include="Web\ColorDetectionResponse.cs" />
+ <Compile Include="Web\DefinitionRequest.cs" />
+ <Compile Include="Web\DefinitionResponse.cs" />
+ <Compile Include="Web\LoginRequest.cs" />
+ <Compile Include="Web\LoginResponse.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Benchmarks\benchmarks_rgb_lab.csv">
<Link>TCC\benchmarks_rgb_lab.csv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
@@ -110,6 +126,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs
index 2ee202acc..ba411dda6 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs
@@ -9,7 +9,7 @@ namespace Tango.TCC.BL.Web
{
public class ColorDetectionRequest : WebRequestMessage
{
- public int Number { get; set; }
public String BitmapString { get; set; }
+ public String Barcode { get; set; }
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs
index a58d1a414..afc53b26c 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs
@@ -10,8 +10,6 @@ namespace Tango.TCC.BL.Web
{
public class ColorDetectionResponse : WebResponseMessage
{
- public int Number { get; set; }
-
public DetectionColor RawColor { get; set; }
public DetectionColor ProcessedColor { get; set; }
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs
new file mode 100644
index 000000000..6082fedaf
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.TCC.BL.Web
+{
+ public class DefinitionRequest : WebRequestMessage
+ {
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs
new file mode 100644
index 000000000..d6161e738
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.TCC.BL.Web
+{
+ public class DefinitionResponse : WebResponseMessage
+ {
+ public String TemplateString { get; set; }
+ public int SampleWidth { get; set; }
+ public int SampleHeight { get; set; }
+ public int CameraWidth { get; set; }
+ public int CameraHeight { get; set; }
+ public double SimilarityTolerance { get; set; }
+ public CardDetectionHistogramMethods HistogramMethod { get; set; }
+ public bool EnableDoubleChecking { get; set; }
+
+ public DefinitionResponse()
+ {
+ SampleWidth = 300;
+ SampleHeight = 330;
+ CameraWidth = 1280;
+ CameraHeight = 720;
+ SimilarityTolerance = 50;
+ HistogramMethod = CardDetectionHistogramMethods.Chi_Square;
+ EnableDoubleChecking = true;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs
new file mode 100644
index 000000000..5f3a66daa
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.TCC.BL.Web
+{
+ public class LoginRequest : WebRequestMessage
+ {
+ public String Email { get; set; }
+ public String Password { get; set; }
+ public String AppID { get; set; }
+
+ public String Device { get; set; }
+ public String DeviceID { get; set; }
+ public String OSVersion { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs
new file mode 100644
index 000000000..054e18ce1
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+using Tango.Web.Security;
+
+namespace Tango.TCC.BL.Web
+{
+ public class LoginResponse : WebTokenResponse
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config b/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config
index fa3c0d58d..08b9dd27c 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp
index 52721368a..91b38c55c 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp
@@ -24,6 +24,7 @@ vector<Point> ArucoUtils::getArcusVertices(Mat image)
aruco::DetectorParameters* params = new aruco::DetectorParameters();
params->cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX;
params->perspectiveRemovePixelPerCell = 50;
+ params->minDistanceToBorder = 0;
aruco::detectMarkers(image, dictionary, corners, ids, &(*params));
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp
index 3f3415e48..174d2d549 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp
Binary files differ
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h
index 05b137a7b..0f1a87d45 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h
Binary files differ
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h
index a6e104b53..86d44ca34 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h
@@ -14,6 +14,9 @@ namespace Tango
property double DesiredBitmapWidth;
property double DesiredBitmapHeight;
property cli::array<Byte>^ TemplateBitmap;
+ property double SimilarityTolerance;
+ property int HistogramMethod;
+ property bool EnableDoubleChecking;
};
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h
index 68507e1f4..ad15b6ae4 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h
@@ -14,6 +14,8 @@ namespace Tango
CardDetectionResult();
property bool IsDetected;
property cli::array<Byte>^ DetectedBitmap;
+ property double Similarity;
+ property System::String^ Barcode;
};
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj
index 2ee6e7a2d..11af99029 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj
@@ -94,11 +94,11 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(ProjectDir)..\Tango.TCC.OpenCV;$(SolutionDir)..\External_Repositories\OpenCV;$(SolutionDir)..\External_Repositories\OpenCV\opencv_contrib-master\modules\aruco\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\Tango.TCC.OpenCV;$(SolutionDir)..\External_Repositories\OpenCV;$(SolutionDir)..\External_Repositories\OpenCV\opencv_contrib-master\modules\aruco\include;$(SolutionDir)..\External_Repositories\ZBar\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
- <AdditionalDependencies>opencv_calib3d330d.lib;opencv_core330d.lib;opencv_features2d330d.lib;opencv_flann330d.lib;opencv_highgui330d.lib;opencv_imgproc330d.lib;opencv_imgcodecs330d.lib;opencv_ml330d.lib;opencv_objdetect330d.lib;opencv_photo330d.lib;opencv_stitching330d.lib;opencv_superres330d.lib;opencv_video330d.lib;opencv_videostab330d.lib;opencv_videoio330d.lib;opencv_aruco330d.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>$(SolutionDir)..\External_Repositories\OpenCV\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>opencv_calib3d330d.lib;opencv_core330d.lib;opencv_features2d330d.lib;opencv_flann330d.lib;opencv_highgui330d.lib;opencv_imgproc330d.lib;opencv_imgcodecs330d.lib;opencv_ml330d.lib;opencv_objdetect330d.lib;opencv_photo330d.lib;opencv_stitching330d.lib;opencv_superres330d.lib;opencv_video330d.lib;opencv_videostab330d.lib;opencv_videoio330d.lib;opencv_aruco330d.lib;libzbar-0.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>$(SolutionDir)..\External_Repositories\OpenCV\bin;$(SolutionDir)..\External_Repositories\ZBar\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj b/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj
index 1356ad9b7..415d51a6e 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj
@@ -161,6 +161,42 @@
<Link>ZedGraph.resources.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libiconv-2.dll">
+ <Link>libiconv-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libjpeg-7.dll">
+ <Link>libjpeg-7.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libMagickCore-2.dll">
+ <Link>libMagickCore-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libMagickWand-2.dll">
+ <Link>libMagickWand-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libpng12-0.dll">
+ <Link>libpng12-0.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libtiff-3.dll">
+ <Link>libtiff-3.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libxml2-2.dll">
+ <Link>libxml2-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libzbar-0.dll">
+ <Link>libzbar-0.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\zlib1.dll">
+ <Link>zlib1.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
index ade4f72f3..b3a4d4808 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
@@ -15,25 +15,44 @@ namespace Tango.TCC.Service.Controllers
public class ColorDetectionController : TangoController
{
[HttpPost]
+ public LoginResponse Login(LoginRequest request)
+ {
+ return new LoginResponse();
+ }
+
+ [HttpPost]
+ public DefinitionResponse GetDefinition(DefinitionRequest request)
+ {
+ return new DefinitionResponse()
+ {
+ TemplateString = TCCServiceConfig.TEMPLATE_STRING,
+ SampleWidth = TCCServiceConfig.SAMPLE_WIDTH,
+ SampleHeight = TCCServiceConfig.SAMPLE_HEIGHT,
+ CameraWidth = TCCServiceConfig.CAMERA_WIDTH,
+ CameraHeight = TCCServiceConfig.CAMERA_HEIGHT,
+ HistogramMethod = TCCServiceConfig.HISTOGRAM_METHOD,
+ SimilarityTolerance = TCCServiceConfig.SIMILARITY_TOLERANCE,
+ EnableDoubleChecking = TCCServiceConfig.ENABLE_DOUBLE_CHECKING,
+ };
+ }
+
+ [HttpPost]
public ColorDetectionResponse Detect(ColorDetectionRequest request)
{
- byte[] bitmapBytes = System.Convert.FromBase64String(request.BitmapString);
+ byte[] bitmapBytes = Convert.FromBase64String(request.BitmapString);
using (ColorDetector detector = new ColorDetector())
{
var output = detector.Detect(new DetectionInput()
{
- Number = request.Number,
Bitmap = ByteString.CopyFrom(bitmapBytes),
Columns = TCCServiceConfig.CARD_COLUMNS,
Rows = TCCServiceConfig.CARD_ROWS,
TargetIndex = TCCServiceConfig.CARD_TARGET_INDEX,
- DebugMode = true,
});
return new ColorDetectionResponse()
{
- Number = (int)output.Number,
ProcessedColor = output.ProcessedColor,
RawColor = output.RawColor,
};
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs
index 8cacbe636..8bedaefe9 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs
@@ -3,12 +3,15 @@ using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
+using Tango.TCC.BL;
using Tango.Web;
namespace Tango.TCC.Service
{
public class TCCServiceConfig : WebConfig
{
+ public static String JWT_TOKEN_SECRET => ConfigurationManager.AppSettings[nameof(JWT_TOKEN_SECRET)].ToString();
+
/// <summary>
/// Gets the number of card columns.
/// </summary>
@@ -23,5 +26,50 @@ namespace Tango.TCC.Service
/// Gets the card target index (hole).
/// </summary>
public static int CARD_TARGET_INDEX => int.Parse(ConfigurationManager.AppSettings[nameof(CARD_TARGET_INDEX)].ToString());
+
+ /// <summary>
+ /// Gets the template image base64 string.
+ /// </summary>
+ public static String TEMPLATE_STRING => ConfigurationManager.AppSettings[nameof(TEMPLATE_STRING)].ToString();
+
+ /// <summary>
+ /// Gets the desired width of the sample image.
+ /// </summary>
+ public static int SAMPLE_WIDTH => int.Parse(ConfigurationManager.AppSettings[nameof(SAMPLE_WIDTH)].ToString());
+
+ /// <summary>
+ /// Gets the desired height of the sample image.
+ /// </summary>
+ public static int SAMPLE_HEIGHT => int.Parse(ConfigurationManager.AppSettings[nameof(SAMPLE_HEIGHT)].ToString());
+
+ /// <summary>
+ /// Gets the recommended camera resolution width.
+ /// </summary>
+ public static int CAMERA_WIDTH => int.Parse(ConfigurationManager.AppSettings[nameof(CAMERA_WIDTH)].ToString());
+
+ /// <summary>
+ /// Gets the recommended camera resolution height.
+ /// </summary>
+ public static int CAMERA_HEIGHT => int.Parse(ConfigurationManager.AppSettings[nameof(CAMERA_HEIGHT)].ToString());
+
+ /// <summary>
+ /// Gets the histogram similarity tolerance.
+ /// </summary>
+ public static double SIMILARITY_TOLERANCE => int.Parse(ConfigurationManager.AppSettings[nameof(SIMILARITY_TOLERANCE)].ToString());
+
+ /// <summary>
+ /// Gets the histogram comparison method.
+ /// </summary>
+ public static CardDetectionHistogramMethods HISTOGRAM_METHOD => (CardDetectionHistogramMethods)Enum.Parse(typeof(CardDetectionHistogramMethods), ConfigurationManager.AppSettings[nameof(HISTOGRAM_METHOD)].ToString());
+
+ /// <summary>
+ /// Gets a value indicating whether to perform a double check of the card arucos.
+ /// </summary>
+ public static bool ENABLE_DOUBLE_CHECKING => bool.Parse(ConfigurationManager.AppSettings[nameof(ENABLE_DOUBLE_CHECKING)].ToString());
+
+ /// <summary>
+ /// Gets the mobile application ID.
+ /// </summary>
+ public static String APP_ID => ConfigurationManager.AppSettings[nameof(APP_ID)].ToString();
}
} \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj
index 43a493f8e..78e13e6d4 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj
@@ -46,6 +46,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config
index 754e88280..d2433dc9b 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config
@@ -4,15 +4,43 @@
https://go.microsoft.com/fwlink/?LinkId=301879
-->
<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
+
+ <add key="DB_ADDRESS" value="twine.database.windows.net" />
+ <add key="DB_USER_NAME" value="Roy" />
+ <add key="DB_PASSWORD" value="Aa123456" />
+ <add key="DB_CATALOG" value="TCC_DEV" />
+ <add key="STORAGE_ACCOUNT" value="DefaultEndpointsProtocol=https;AccountName=tangostorage;AccountKey=S4z/D+Yg6mwMis+bs/VpcDLA9yE1iZaYq23shQlRIi2KmM9E7JY8zdZjeAPOPdG3gONHoNDEpsgH6D4cqQ/bsA==;EndpointSuffix=core.windows.net" />
+ <add key="TENANT_ID" value="2ebd63a5-bc2f-41dc-9066-4409ed5e5dd4" />
+ <add key="CLIENT_ID" value="ec612854-7abc-457b-808a-5d0c5ba80c57" />
+ <add key="APP_SECRET" value="54)019A7wv+#86l*PQcQWYKu%fd4Dv!@G=VhCiDI5rD+H4BTH" />
+ <add key="DEPLOYMENT_SLOT" value="DEV" />
+ <add key="ENVIRONMENT_GROUP" value="Tango DEV" />
+ <add key="JWT_TOKEN_SECRET" value="GQDstcKsx0NHjLOuXOYg5MbeJ1yT0u1iwDVTwine" />
+
<add key="CARD_COLUMNS" value="10" />
<add key="CARD_ROWS" value="11" />
<add key="CARD_TARGET_INDEX" value="99" />
+ <add key="TEMPLATE_STRING" value="PUT TEMPLATE STRING HERE!" />
+ <add key="SAMPLE_WIDTH" value="300" />
+ <add key="SAMPLE_HEIGHT" value="330" />
+ <add key="CAMERA_WIDTH" value="1280" />
+ <add key="CAMERA_HEIGHT" value="720" />
+ <add key="SIMILARITY_TOLERANCE" value="50" />
+ <add key="HISTOGRAM_METHOD" value="Chi_Square" />
+ <add key="ENABLE_DOUBLE_CHECKING" value="True" />
+ <add key="APP_ID" value="Tdf793i4ughsiduf8749509237885ehgfdlkghlT" />
+
+
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
@@ -34,12 +62,13 @@
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
- <handlers>
+ <handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
- </handlers></system.webServer>
+ </handlers>
+ </system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
@@ -49,7 +78,7 @@
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
- </dependentAssembly>
+ </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
@@ -102,4 +131,10 @@
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
-</configuration>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config
index 34d59e98c..115c40d26 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config
@@ -2,6 +2,7 @@
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net461" />
<package id="bootstrap" version="3.3.7" targetFramework="net461" />
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
<package id="jQuery" version="3.3.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="2.5.1" targetFramework="net461" />
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
index 85b104aa8..f12a6c322 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
@@ -28,7 +28,7 @@ namespace Tango.SharedUI.Controls
private void DoubleClickDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (SelectedItem != null)
+ if (SelectedItem != null && (e.OriginalSource as UIElement != null) && (e.OriginalSource as FrameworkElement).DataContext == SelectedItem)
{
DoubleClickCommand?.Execute(SelectedItem);
}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs
index ae5c66f6e..59237b4a0 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs
@@ -10,10 +10,12 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.Core.IO;
using Tango.CSV;
using Tango.PMR.TCC;
using Tango.TCC.BL;
+using Tango.TCC.BL.Entities;
namespace Tango.UnitTesting.TCC
{
@@ -82,6 +84,23 @@ namespace Tango.UnitTesting.TCC
}
}
+ [TestMethod]
+ public void Test_Database()
+ {
+ using (TCCContext db = new TCCContext(new DataSource()
+ {
+ Address = "localhost\\SQLEXPRESS",
+ Catalog = "TCC",
+ IntegratedSecurity = true,
+ Type = DataSourceType.SQLServer,
+ }))
+ {
+ var device = db.Devices.FirstOrDefault();
+ Assert.IsNotNull(device);
+ db.SaveChanges();
+ }
+ }
+
private byte[] GetBitmapData(byte[] bitmap)
{
using (MemoryStream ms = new MemoryStream(bitmap))