Exemplo n.º 1
0
def createAllRange(state, city, street, startColumn, levelMax, product,
                   endColumn):
    check = levelMax
    city = customeFunctions.addZero_twoDigits(city)
    street = customeFunctions.addZero_twoDigits(street)
    product = customeFunctions.addZero_twoDigits(product)
    allBarcodesPath = []

    for column in range(startColumn, endColumn + 1):
        columnThreeDigits = customeFunctions.addZero_threeDigits(column)
        for level in range(1, levelMax + 1):
            level = customeFunctions.addZero_twoDigits(level)

            # Generate Barcode
            barcodeNumber = ('{}.{}.{}.{}.{}.{}').format(
                state, city, street, columnThreeDigits, level, product)
            print("Barcode Number: " + barcodeNumber)
            barcodeGenerator.generateSingleBarcode(barcodeNumber)
            barcodeImgPath = "{}barcode_library/{}.{}.{}.{}.{}.{}.png".format(
                imagesPath, state, city, street, columnThreeDigits, level,
                product)
            allBarcodesPath.append(barcodeImgPath)

        # Generates the a single column image
        createColumnImage(state, city, street, column, level, allBarcodesPath,
                          check)

        # Clear list for next iteration
        allBarcodesPath.clear()
Exemplo n.º 2
0
def getBarcode(state, city, street, column, level, product):
    city = customeFunctions.addZero_twoDigits(city)
    street = customeFunctions.addZero_twoDigits(street)
    column = customeFunctions.addZero_threeDigits(column)
    level = customeFunctions.addZero_twoDigits(level)
    product = customeFunctions.addZero_twoDigits(product)
    path = "{}barcode_library/{}.{}.{}.{}.{}.{}.png".format(
        imagesPath, state, city, street, column, level, product)
    barcode = cv2.imread(path)
    return barcode
Exemplo n.º 3
0
def createColumnImage(state, city, street, column, level, allBarcodesPath,
                      check):

    labelAndBarcode = []
    city = int(city)
    column = int(column)
    level = int(level)

    for i in range(level, 0, -1):
        lable = getLabel(i)
        labelAndBarcode.append(lable)
        barcodeImg = cv2.imread(allBarcodesPath[i - 1])
        labelAndBarcode.append(barcodeImg)

    # Convers the list to array
    labelAndBarcode_array = np.array(labelAndBarcode)

    # Generate column Image File
    fullImg = cv2.vconcat(labelAndBarcode_array)
    fullImg = cv2.vconcat([createColumnLable(column), fullImg])

    # Add line on the side
    fullImg = cv2.hconcat([fullImg, getLine("side", level)])

    # Add line on the top
    fullImg = cv2.vconcat([getLine("top", level), fullImg])

    # Save file
    columnThreeDigits = customeFunctions.addZero_threeDigits(column)
    cityTwoDigits = customeFunctions.addZero_twoDigits(city)

    fileName = ("{}sign_done_single/{}.{}.{}.{}.nivelMax-{}.PNG".format(
        imagesPath, state, cityTwoDigits, street, columnThreeDigits, check))

    cv2.imwrite(fileName, fullImg)

    if check == 6:
        width = 246
        height = 1118
        resize.singleFileResize(fileName, width, height)
    elif check == 8:
        width = 246
        height = 1437
        resize.singleFileResize(fileName, width, height)
    elif check == 12:
        width = 246
        height = 2075
        resize.singleFileResize(fileName, width, height)

    print("Generating Image: {}".format(fileName))
Exemplo n.º 4
0
def createColumnLable(column):

    #Makes "1" into "001"
    column = customeFunctions.addZero_threeDigits(column)

    #substring the input into 3 digits
    columnDigit1 = column[0:1]
    columnDigit2 = column[1:2]
    columnDigit3 = column[2:3]

    # Gets the digits images for each column digit
    firstDigit = getDigit(columnDigit1)
    secondDigit = getDigit(columnDigit2)
    thirdDigit = getDigit(columnDigit3)

    # Create New column
    columnImg = cv2.hconcat(
        [getPad(), firstDigit, secondDigit, thirdDigit,
         getPad()])
    headerImg = cv2.vconcat([getArrow(column), columnImg])

    return headerImg
Exemplo n.º 5
0
    def create_single(state, city, street, column, level, product, apt):

        # Generate sectioin images
        arrow = get_arrow()
        pad = get_pad()
        header = get_header(level) #420 x 114
        # barcode = getBarcode(state, city, street, column, level, product)
        barcode = barcodeGenerator.getBarcode(state, city, street, column, level, product)

        # create the product number
        apt = customeFunctions.addZero_twoDigits(apt)
        digit1 = apt[0:1]
        digit2 = apt[1:2]
        first_digit = get_digit(digit1) # 82 x 114
        second_digit = get_digit(digit2)

        # Combine Images
        img1 = cv2.hconcat([header, first_digit, second_digit, pad])
        img2 = cv2.vconcat([img1, barcode])
        img3 = cv2.hconcat([img2, arrow])
        # Side Line
        img4 = cv2.hconcat([img3, get_line("side")])
        # Top Line
        img5 = cv2.vconcat([get_line("top"), img4])

        # Create File Name
        city = customeFunctions.addZero_twoDigits(city)
        street = customeFunctions.addZero_twoDigits(street)
        column = customeFunctions.addZero_threeDigits(column)
        level = customeFunctions.addZero_twoDigits(level)
        product = customeFunctions.addZero_twoDigits(product)
        file_name = "{}.{}.{}.{}.{}.{}-apt-{}.png".format(state, city, street, column, level, product, apt)

        save_path = "{}apt_sticker_done_single/{}".format(IMAGES_PATH, file_name)
        cv2.imwrite(save_path, img5)
        print(save_path)
Exemplo n.º 6
0
def removeColumnSticker(state, city, street, column, aptLevelMax, product, apt,
                        startDelete, endDelete, sideRemove):
    print("Remove Column Sticker")

    cityTwoDigits = customeFunctions.addZero_twoDigits(city)
    streetTwoDigits = customeFunctions.addZero_twoDigits(street)
    productTwoDigits = customeFunctions.addZero_twoDigits(product)

    deleteList = []
    path = "C:/personal-git/aresta-barcode/src/app/images/column_done_single/inv-{}.PNG"

    if sideRemove == "even":
        for c in range(startDelete, endDelete + 1):
            if c % 2 == 0:
                print("\n ---------- Deleting column: {}".format(c))
                columnThreeDigits = customeFunctions.addZero_threeDigits(c)
                for i in range(1, aptLevelMax + 1):
                    levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                    search = '{}.{}.{}.{}.{}.{}'.format(
                        state, cityTwoDigits, streetTwoDigits,
                        columnThreeDigits, levelTwoDigits, productTwoDigits)

                    deletePath = path.format(search)
                    deleteList.append(deletePath)

                    if os.path.exists(deletePath):
                        os.remove(deletePath)
                        print("Deleted: {}".format(deletePath))
                    else:
                        print("Do not exist: {}".format(deletePath))

        # List of deletes
        # for i in range(len(deleteList)):
        #     print(deleteList[i])

    elif sideRemove == "odd":
        for c in range(startDelete, endDelete + 1):
            if c % 2 != 0:
                print("\n ---------- Deleting column: {}".format(c))
                columnThreeDigits = customeFunctions.addZero_threeDigits(c)
                for i in range(1, aptLevelMax + 1):
                    levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                    search = '{}.{}.{}.{}.{}.{}'.format(
                        state, cityTwoDigits, streetTwoDigits,
                        columnThreeDigits, levelTwoDigits, productTwoDigits)

                    deletePath = path.format(search)
                    deleteList.append(deletePath)

                    if os.path.exists(deletePath):
                        os.remove(deletePath)
                        print("Deleted: {}".format(deletePath))
                    else:
                        print("Do not exist: {}".format(deletePath))

    elif sideRemove == "all":
        for c in range(startDelete, endDelete + 1):
            print("\n ---------- Deleting column: {}".format(c))
            columnThreeDigits = customeFunctions.addZero_threeDigits(c)
            for i in range(1, aptLevelMax + 1):
                levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                search = '{}.{}.{}.{}.{}.{}'.format(state, cityTwoDigits,
                                                    streetTwoDigits,
                                                    columnThreeDigits,
                                                    levelTwoDigits,
                                                    productTwoDigits)

                deletePath = path.format(search)
                deleteList.append(deletePath)

                if os.path.exists(deletePath):
                    os.remove(deletePath)
                    print("Deleted: {}".format(deletePath))
                else:
                    print("Do not exist: {}".format(deletePath))
Exemplo n.º 7
0
def removeColumn(state, city, street, column, level, product, startDelete,
                 endDelete, sideRemove):

    cityTwoDigits = customeFunctions.addZero_twoDigits(city)
    streetTwoDigits = customeFunctions.addZero_twoDigits(street)
    columnThreeDigits = customeFunctions.addZero_threeDigits(column)
    levelTwoDigits = customeFunctions.addZero_twoDigits(level)
    productTwoDigits = customeFunctions.addZero_twoDigits(product)

    if sideRemove == "even":
        for c in range(startDelete, endDelete + 1):
            if c % 2 == 0:
                print("\n ---------- Deleting column: {}".format(c))
                columnThreeDigits = customeFunctions.addZero_threeDigits(c)
                signPath = "C:/personal-git/aresta-barcode/src/app/images/sign_done_single/1.{}.{}.{}.PNG".format(
                    cityTwoDigits, streetTwoDigits, columnThreeDigits)
                if os.path.exists(signPath):
                    os.remove(signPath)
                    print("Deleted: {}".format(signPath))
                else:
                    print("Do not exist: {}".format(signPath))

                for i in range(1, level + 1):
                    levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                    columnThreeDigits = customeFunctions.addZero_threeDigits(c)
                    barcodePath = "C:/personal-git/aresta-barcode/src/app/images/barcode_library/1.{}.{}.{}.{}.{}.PNG".format(
                        cityTwoDigits, streetTwoDigits, columnThreeDigits,
                        levelTwoDigits, productTwoDigits)
                    if os.path.exists(barcodePath):
                        os.remove(barcodePath)
                        print("Deleted: {}".format(barcodePath))
                    else:
                        print("Do not exist: {}".format(barcodePath))

                for i in range(1, level + 1):
                    levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                    columnPath = "C:/personal-git/aresta-barcode/src/app/images/column_done_single/inv-1.{}.{}.{}.{}.{}.PNG".format(
                        cityTwoDigits, streetTwoDigits, columnThreeDigits,
                        levelTwoDigits, productTwoDigits)
                    if os.path.exists(columnPath):
                        os.remove(columnPath)
                        print("Deleted: {}".format(columnPath))
                    else:
                        print("Do not exist: {}".format(columnPath))

    elif sideRemove == "odd":
        for c in range(startDelete, endDelete + 1):
            if c % 2 != 0:
                print("\n ---------- Deleting column: {}".format(c))
                columnThreeDigits = customeFunctions.addZero_threeDigits(c)
                signPath = "C:/personal-git/aresta-barcode/src/app/images/sign_done_single/1.{}.{}.{}.PNG".format(
                    cityTwoDigits, streetTwoDigits, columnThreeDigits)
                print(signPath)
                if os.path.exists(signPath):
                    os.remove(signPath)
                    print("Deleted: {}".format(signPath))
                else:
                    print("Do not exist: {}".format(signPath))

                for i in range(1, level + 1):
                    levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                    columnThreeDigits = customeFunctions.addZero_threeDigits(c)
                    barcodePath = "C:/personal-git/aresta-barcode/src/app/images/barcode_library/1.{}.{}.{}.{}.{}.PNG".format(
                        cityTwoDigits, streetTwoDigits, columnThreeDigits,
                        levelTwoDigits, productTwoDigits)
                    print(barcodePath)
                    if os.path.exists(barcodePath):
                        os.remove(barcodePath)
                        print("Deleted: {}".format(barcodePath))
                    else:
                        print("Do not exist: {}".format(barcodePath))

                for i in range(1, level + 1):
                    levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                    columnPath = "C:/personal-git/aresta-barcode/src/app/images/column_done_single/inv-1.{}.{}.{}.{}.{}.PNG".format(
                        cityTwoDigits, streetTwoDigits, columnThreeDigits,
                        levelTwoDigits, productTwoDigits)
                    if os.path.exists(columnPath):
                        os.remove(columnPath)
                        print("Deleted: {}".format(columnPath))
                    else:
                        print("Do not exist: {}".format(columnPath))

    elif sideRemove == "all":
        for c in range(startDelete, endDelete + 1):
            print("\n ---------- Deleting column: {}".format(c))
            columnThreeDigits = customeFunctions.addZero_threeDigits(c)
            signPath = "C:/personal-git/aresta-barcode/src/app/images/sign_done_single/1.{}.{}.{}.PNG".format(
                cityTwoDigits, streetTwoDigits, columnThreeDigits)
            if os.path.exists(signPath):
                os.remove(signPath)
                print("Deleted: {}".format(signPath))
            else:
                print("Do not exist: {}".format(signPath))

            for i in range(1, level + 1):
                levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                columnThreeDigits = customeFunctions.addZero_threeDigits(c)
                barcodePath = "C:/personal-git/aresta-barcode/src/app/images/barcode_library/1.{}.{}.{}.{}.{}.PNG".format(
                    cityTwoDigits, streetTwoDigits, columnThreeDigits,
                    levelTwoDigits, productTwoDigits)
                if os.path.exists(barcodePath):
                    os.remove(barcodePath)
                    print("Deleted: {}".format(barcodePath))
                else:
                    print("Do not exist: {}".format(barcodePath))

            for i in range(1, level + 1):
                levelTwoDigits = customeFunctions.addZero_twoDigits(i)
                columnPath = "C:/personal-git/aresta-barcode/src/app/images/column_done_single/inv-1.{}.{}.{}.{}.{}.PNG".format(
                    cityTwoDigits, streetTwoDigits, columnThreeDigits,
                    levelTwoDigits, productTwoDigits)
                if os.path.exists(columnPath):
                    os.remove(columnPath)
                    print("Deleted: {}".format(columnPath))
                else:
                    print("Do not exist: {}".format(columnPath))