from visual_sudoku_solver import extractor

import numpy as np
import cv2.cv2 as cv2

# load sudoku image
img = cv2.imread('data/image.jpg')

# crop and save
crop = extractor.sudoku_image(img, 400)
cv2.imwrite('data/cropped.jpg', crop)

# read digits and save
digits = extractor.digits_from_sudoku_image(crop)
np.savetxt('data/digits.txt', digits.astype(int), fmt='%s')

# show cropped sudoku
cv2.imshow('Sudoku', crop)
cv2.waitKey(0)
cv2.destroyAllWindows()


from visual_sudoku_solver import extractor

import numpy as np
import cv2.cv2 as cv2

# load sudoku image
img = cv2.imread('data/image.jpg')

# crop and save
crop = extractor.sudoku_image(img, 400)
cv2.imwrite('data/cropped.jpg', crop)

# read digits and save
digits = extractor.digits_from_sudoku_image(crop)
np.savetxt('data/digits.txt', digits.astype(int), fmt='%s')

# show cropped sudoku
cv2.imshow('Sudoku', crop)
cv2.waitKey(0)
cv2.destroyAllWindows()


# load sudoku image # crop and save # read digits and save # show cropped sudoku