Artifact 7228665d7ca2b6c7190c31bc0eb45a71aa72f495:
Wiki page
[
dmtx command] by
chw
2019-04-26 06:47:26.
D 2019-04-26T06:47:26.575
L dmtx\scommand
P 578601101c191045f0c5380b9c82b80eaccc590c
U chw
W 2711
<h2>dmtx command</h2>
<h3>Name</h3>
<b>dmtx::*</b> - interface to the libdmtx.org Data Matrix Code scanner library.
<h3>Synopsis</h3>
<tt>package require dmtx</tt><br>
<tt>dmtx::decode ?options?</tt><br>
<tt>dmtx::async_decode ?options?</tt>
<h3>Description</h3>
These commands are used to scan Data Matrix Codes off pixel image data.
<tt>dmtx::decode <i>photoEtc</i> ?<i>scale timeout</i>?</tt>
Scans the photo image <tt><i>photoEtc</i></tt> for Data Matrix Code information. Alternatively, <tt><i>photoEtc</i></tt> can be a four element list describing a greyscale or RGB image as a byte array. The elements must be width, height, depth and byte array of the image in this order. The optional integer parameter <tt><i>scale</i></tt> downsamples the image before the scan takes place. The optional <tt><i>timeout</i></tt> limits the scan process to that many milliseconds. The command returns a three element list made up of a flag indicating success (=1) or failure (=0) of the scan process, the amount of milliseconds spent on decoding, and the scan result as a byte array.
<tt>dmtx::async_decode <i>photoEtc callback</i> ?<i>scale timeout</i>?</tt>
Similar to <tt>dmtx::decode</tt> but the decoder is run as a background thread and the result is presented to a <tt><i>callback</i></tt> procedure. It requires the Tcl core being built with thread support, and a running event loop since the callback is invoked as an event or do-when-idle handler. Three additional arguments are passed to <tt><i>callback</i></tt>: a flag indicating success (=1) or failure (=0) of the scan process, the number of milliseconds for decoding, and the scan result as a byte array. The optional parameters <tt><i>scale</i></tt> and <tt><i>timeout</i></tt> have the same meaning as in the <tt>dmtx::decode</tt> command. The default timeout value is 1000 milliseconds. Caution: only a single thread instance is supported per Tcl interpreter, i.e. another asynchronous decode process can only be started when a previous decode process has finished.
<tt>dmtx::async_decode abort</tt>
Aborts a running asynchronous decode process.
<tt>dmtx::async_decode status</tt>
Returns the current state of the asynchronous decode as a string: <tt><i>stopped</i></tt> when no asynchronous decode thread has been started, <tt><i>running</i></tt> when a asynchronous decode is in progress, and <tt><i>ready</i></tt> when the next asynchronous decode can be started.
<tt>dmtx::async_decode stop</tt>
Stops the background thread for asynchronous decoding if it has been implicitely started by a prior <tt>dmtx::async_decode</tt>. This can be useful to conserve memory resources.
Z 8c7c05e8cc021c01bf77cbe91d4878d3