Пример #1
0
def getBarcodeData(img):
    if str(type(img)) != "<type 'numpy.ndarray'>":
        raise ValueError("ERROR: getBarcodeData image given is not valid. Type: "+str(type(img)))
    barcode_img = img
    preprocessed_img = preprocessing.barcodePreprocess(barcode_img)
    barcode_data = processing.barcodeDecode(preprocessed_img)
    return barcode_data
Пример #2
0
 def test_barcode_decode_load_preprocessed_img(self):
     #img = cv2.imread(DEF_IMG_DIR + '/' + "barcode_preprocessed.jpg")
     #img = cv2.imread(DEF_IMG_DIR + '/' + "barcode_preprocessedMODIFIED.jpg")
     #img = cv2.imread(DEF_IMG_DIR + '/' + "codeBar1.jpg") #no esta entero!
     #img = cv2.imread(DEF_IMG_DIR + '/' + "codeBar2.jpg")
     #img = cv2.imread(DEF_IMG_DIR + '/' + "codeBar3.jpg")
     #img = cv2.imread(DEF_IMG_DIR + '/' + "codeBar4.jpg")
     img = cv2.imread(DEF_IMG_DIR + '/' + "codeBar4INVERTED.jpg",0)
     #img = cv2.imread(DEF_IMG_DIR + '/' + "codeBar6.jpg",0)
     expected_result = 0
     
     result = barcode_decode.barcodeDecode(img)
     self.assertTrue(len(result)>0)
     print result