Download Latest Version release 0.8 (4.7 MB)
Email in envelope

Get an email when there's a new version of pyDataMatrixScanner

Home
Name Modified Size InfoDownloads / Week
pyDataMatrixScanner-0.7 2009-08-06
README-0.8.txt 2009-10-07 6.5 kB
pyDataMatrixScanner-0.8.tar.gz 2009-10-07 32.2 kB
pyDataMatrixScanner-win32-0.8.zip 2009-10-06 4.7 MB
Totals: 4 Items   4.7 MB 3
pyDatamatrixScanner
===
A simple application to scan and decode DataMatrix barcodes. It was  originally written 
to be used as badge scanning application for use in a conference enviroment, but it is 
flexible to be used for other purposes.

It is essentially a command line application which can open an optional pyGTK gui to 
display images and results.

Usage
===
The most simple usage is to display images from the attached webcam, you will need know
the 'pixelformat' available. The cameras capabilities can be listed with the included 
'pyv4l2.py' application.
--
$ ./pyv4l2.py
Available devices:  ['/dev/video0']
----
Device:
        /dev/video0
Capabilities:
        Capture
        ReadWrite
        Streaming
Input 0:
                Name:   Camera 1
                Type:   camera
                Standards: []
Pixel formats: 
        MJPG    MJPEG
        YUYV    YUV 4:2:2 (YUYV)
        RGB3    RGB3
        BGR3    BGR3
        YU12    YU12
        YV12    YV12
Resolutions: 
...
--

Note: If using libv4l (enabled by default), then the library will be able to convert from
a camera's native format(s) to RGB3 (recommended) or GBR3. The YU12 and YV12 formats are not 
supported. When using libv4l on low power hardware you may experience a slow down, this can 
be minimised by using a native format where possible.

The most simple usage is to display images from the attached webcam in a pyGTK gui; type the 
following, and then click the 'start' button in the app.
--
$ ./pyDataMatrixScanner.py -p MJPG -g
--

To grab, locate and decode the barcodes add the '-l' option.
--
$ ./pyDataMatrixScanner.py -p MJPG -g -l
--

Further options are available to beep when a bar code is located, export the barcode text
to the forground window, etc. See the '--help' option.
--
Usage: pyDataMatrixScanner.py [options]

Options:
  -h, --help            show this help message and exit
  -d DEVICE, --device=DEVICE
                        video device
  -i INPUT, --input=INPUT
                        Input number: typically 0-8
  -p PIXELFORMAT, --pixelformat=PIXELFORMAT
                        Format codes
  -s STANDARD, --standard=STANDARD
                        Video Standard
  -I, --interlace       Select Interlaced video
  -C, --capture         Use Capture to grab images rather than streaming.
  -f FPS_DEN, --framerate=FPS_DEN
                        Framerate (1/s) or Denominator for Fractional FPS
  -t FPS_NUM, --interval=FPS_NUM
                        Frameinterval (s) or Numerator for Fractional FPS
  -x WIDTH, --width=WIDTH
                        Capture width, default 640
  -y HEIGHT, --height=HEIGHT
                        Capture height, default 480
  -a, --autostart       Automatically start capturing video, default if no GUI
  -b, --barcode         Decode barcodes found in image, default if no GUI
  -v, --virtkey         Export barcode 'Text' via VirtKey to foreground window
  -n, --newline         Appends a newline to each exported barcode
  -B, --beep            Play audio sample on each sucessful scan/decode
  -g, --gui             Display captured images using pyGTK GUI
  -l, --locate          Highlight location of decoded barcodes on display
  -D, --debug           Display additional debug information
  -F FILE, --file=FILE  Get image from file, rather than webcam
--

Getting the source
===
The source is available in 'tar' fashion from the projects SourceForge page:
https://sourceforge.net/projects/pydmscanner/

More up-to-date source can be obtained from the SVN repo's:
svn co https://pydmscanner.svn.sourceforge.net/svnroot/pydmscanner pydmscanner 

Dependancies
===
The code is written in python and uses C for the V4L capture.

Optionally it uses:
	libdmtx
	libv4l
	pyGTK
	python-virtkey

Notes on building from SVN
===
Get a SVN version of libdmtx, with:
> svn co https://libdmtx.svn.sourceforge.net/svnroot/libdmtx/trunk libdmtx 

Ensure that you have the dependencies:
> sudo apt-get install automake autoconf libmagick9-dev libtool python-dev python-imaging libv4l-dev

Build and install libdtmx
> cd libdmtx
> ./autogen.sh
> ./configure
> sudo make install
> ldconfig
> cd wrappers/python
> sudo make install

For luck run the test application
> python test.py


Get/Unpack pyDataMatrixScanner
> tar -xzf pyDataMatrixScanner-0.6.tar.gz
> cd pyDataMatrixScanner
> make

Confirm that your webcam/capture card is found
> ./pyv4l2.py


Building on Win32
===

You will need the source for both pyDataMatrixScanner and libdmtx. See above for download 
instructions.

You will also need python (2.6), python image library (PIL), py2exe, GTK development libraries 
and pyGTK development libraries installed. These can be download from:
	http://www.python.org/download/
	http://www.pythonware.com/products/pil/
	http://sourceforge.net/projects/py2exe/files/
	http://gladewin32.sourceforge.net/
	http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.12/

Using VisualC++ (Express version is free of charge) build libdmtx as per instructions in 
libdmtx source. 

Ensure that the '<libdmtx root>/project/visualc9/Release' directory is in your path.

Change to the pyDataMatrixScanner source and run the command
> python py2exe_setup.py py2exe

Zip up the 'pyDataMatrixScanner-win32' directory or use an installer builder of your choice.
 

Running on Win32
===

In order to run (the pre-built version) you need the GTK runtime libraries installed, these 
may already be install if you have ANY of these applications installed (Glade, Gimp or Pidgin):
	http://gladewin32.sourceforge.net/
	http://sourceforge.net/projects/gimp-win/
	http://www.pidgin.im/

Ensure that the path to GTK libraries is in your %PATH% (for example 'C:\GTK\lib').

Depending on what other applications installed on your system you may also need the MicroSoft 
VisualC runtime libraries, which are available here:
	http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en

Open a 'Command Prompt' and navigate to the location of the pyDataMatrixScanner 'binaries'. 

Run pyDataMatrixScanner with the '-F' from file option (as the webcam options only work under 
Linux) and '-K' (enable the control panel), '-g' (enable gui), '-a' (autostart), '-b' (decode 
barcodes) and '-l' (locate).

C:\Program Files\pyDataMatrixScanner-win32>.\pyDataMatrixScanner.exe -F test.png -K -g -a -b -l
Source: README-0.8.txt, updated 2009-10-07