import glob
import os

from src.processing.loader import load_image
from src.processing.linefinder import find_lines
from matplotlib import pyplot as plt

from src.processing.receiptcutter import cut_receipt

for root, dirs, files in os.walk("data"):
    for file in files:
        if file.startswith("receipt-12"):
            image = load_image("data/"+file)
            receipt = cut_receipt(image, draw_steps=True)
            lines = find_lines(receipt, draw_steps=True)
            print("hh", len(lines))
            #continue
            for line in lines:
                plt.imshow(line, cmap="gray")
                plt.show()
