Example #1
0
def encode(sliding_window_size, look_ahead_size, imagePath="test.jpg", encodedFile="encoded"):
    img = cv2.imread(imagePath, cv2.IMREAD_GRAYSCALE).flatten()
    codes = numpy.array([])
    print("Encoding Started")
    numpy.save('original.npy', img)
    codes = e.encode(sliding_window_size,look_ahead_size, img)
    print("Encoding Done:")

    integer_type = 'uint64'

    if sliding_window_size < 256:
        integer_type = 'uint8'
    elif sliding_window_size < 65536:
        integer_type = 'uint16'
    elif sliding_window_size < 4294967296:
        integer_type = 'uint32'

    numpy.save(encodedFile, codes.astype(integer_type)) # save

    print(" ->" + encodedFile + " is created")

    return codes
Example #2
0
def name2lz77(name):
    return LZ77.encode(name.encode())