def _locate_all_barcodes_in_image(self): if self._is_single_image: # barcodes = DataMatrix.locate_all_barcodes_in_image_deep(self._frame_img, self.barcode_size) barcodes = DataMatrix.locate_all_barcodes_in_image(self._frame_img, self.barcode_size) else: barcodes = DataMatrix.locate_all_barcodes_in_image(self._frame_img, self.barcode_size) if len(barcodes) == 0: raise NoBarcodesError("No Barcodes Detected In Image") return barcodes
def _locate_all_barcodes_in_image(self): if self._is_single_image: # barcodes = DataMatrix.locate_all_barcodes_in_image_deep(self._frame_img, self.barcode_sizes) barcodes = DataMatrix.locate_all_barcodes_in_image(self._frame_img, self.barcode_sizes) else: barcodes = DataMatrix.locate_all_barcodes_in_image(self._frame_img, self.barcode_sizes) if len(barcodes) == 0: raise NoBarcodesDetectedError() return barcodes
def _locate_all_barcodes_in_image(self): barcodes = DataMatrix.locate_all_barcodes_in_image(self._frame_img, self.barcode_sizes) # TODO: log this if len(barcodes) == 0: raise NoBarcodesDetectedError() return barcodes
def _locate_all_barcodes_in_image(self): """ Perform a deep scan to find all the datamatrix barcodes in the image (but don't read them). """ if self._is_single_image: barcodes = DataMatrix.locate_all_barcodes_in_image_deep(self._frame_img, self.barcode_size) else: barcodes = DataMatrix.locate_all_barcodes_in_image(self._frame_img, self.barcode_size) if len(barcodes) == 0: raise NoBarcodesError("No Barcodes Detected In Image") return barcodes
def _locate_all_barcodes_in_image(self): """ Perform a deep scan to find all the datamatrix barcodes in the image (but don't read them). """ if self._is_single_image: barcodes = DataMatrix.locate_all_barcodes_in_image_deep( self._frame_img, self.barcode_sizes) else: barcodes = DataMatrix.locate_all_barcodes_in_image( self._frame_img, self.barcode_sizes) # TODO: log the error if len(barcodes) == 0: raise NoBarcodesDetectedError() return barcodes
from dls_barcode.datamatrix import DataMatrix from dls_util import Image, Color dm_img_file = '../tests/test-resources/test/dm6.png' dm_img = Image.from_file(dm_img_file) mono_img = dm_img.to_grayscale() barcodes = DataMatrix.locate_all_barcodes_in_image(mono_img, matrix_sizes=[18]) for barcode in barcodes: barcode.draw(dm_img, Color.Green()) barcode.perform_read() print(barcode.data()) print(barcode._error_message) dm_img.popup() from dls_barcode.datamatrix.read import ReedSolomonDecoder # msg = 16, 16 ecc chars = [69, 71, 145, 49, 70, 134, 173, 69, 71, 145, 49, 70, 134, 173, 129] decoder = ReedSolomonDecoder() out = decoder.encode(chars, 17) print([int(b) for b in out], len(out))