'**SUMMARY**
This function requires zbar and the zbar python wrapper
to be installed or zxing and the zxing python library.
**ZBAR**
To install please visit:
http://zbar.sourceforge.net/
On Ubuntu Linux 12.04 or greater:
sudo apt-get install python-zbar
**ZXING**
If you have the python-zxing library installed, you can find 2d and 1d
barcodes in your image.  These are returned as Barcode feature objects
in a FeatureSet.  The single parameter is the ZXing_path along with
setting the doZLib flag to False. You do not need the parameter if you
don\'t have the ZXING_LIBRARY env parameter set.
You can clone python-zxing at:
http://github.com/oostendo/python-zxing
**INSTALLING ZEBRA CROSSING**
* Download the latest version of zebra crossing from: http://code.google.com/p/zxing/
* unpack the zip file where ever you see fit
>>> cd zxing-x.x, where x.x is the version number of zebra crossing
>>> ant -f core/build.xml
>>> ant -f javase/build.xml
This should build the library, but double check the readme
* Get our helper library
>>> git clone git://github.com/oostendo/python-zxing.git
>>> cd python-zxing
>>> python setup.py install
* Our library does not have a setup file. You will need to add
it to your path variables. On OSX/Linux use a text editor to modify your shell file (e.g. .bashrc)
export ZXING_LIBRARY=<FULL PATH OF ZXING LIBRARY - (i.e. step 2)>
for example:
export ZXING_LIBRARY=/my/install/path/zxing-x.x/
On windows you will need to add these same variables to the system variable, e.g.
http://www.computerhope.com/issues/ch000549.htm
* On OSX/Linux source your shell rc file (e.g. source .bashrc). Windows users may need to restart.
* Go grab some barcodes!
.. Warning::
Users on OSX may see the following error:
RuntimeWarning: tmpnam is a potential security risk to your program
We are working to resolve this issue. For normal use this should not be a problem.
**Returns**
A :py:class:`FeatureSet` of :py:class:`Barcode` objects. If no barcodes are detected the method returns None.
**EXAMPLE**
>>> bc = cam.getImage()
>>> barcodes = img.findBarcodes()
>>> for b in barcodes:
>>>     b.draw()
**SEE ALSO**
:py:class:`FeatureSet`
:py:class:`Barcode`'

def findBarcode(self, doZLib=True, zxing_path=''):

    if doZLib:
        try:
            import zbar
        except:
            logger.warning('The    zbar    library    is    not    installed,    please    install    to    read    barcodes')
            return None
        scanner = zbar.ImageScanner()
        scanner.parse_config('enable')
        raw = self.getPIL().convert('L').tostring()
        width = self.width
        height = self.height
        image = zbar.Image(width, height, 'Y800', raw)
        scanner.scan(image)
        barcode = None
        for symbol in image:
            barcode = symbol
        del image
    else:
        if (not ZXING_ENABLED):
            warnings.warn('Zebra    Crossing    (ZXing)    Library    not    installed.    Please    see    the    release    notes.')
            return None
        if (not self._barcodeReader):
            if (not zxing_path):
                self._barcodeReader = zxing.BarCodeReader()
            else:
                self._barcodeReader = zxing.BarCodeReader(zxing_path)
        tmp_filename = (os.tmpnam() + '.png')
        self.save(tmp_filename)
        barcode = self._barcodeReader.decode(tmp_filename)
        os.unlink(tmp_filename)
    if barcode:
        f = Barcode(self, barcode)
        return FeatureSet([f])
    else:
        return None
