-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappend.py
26 lines (18 loc) · 920 Bytes
/
append.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import cv2
import os
fileDir = os.path.dirname(os.path.abspath(__file__))
def writeOnImage(sudokuSolution, sudokuUnsolved, additionalName = ""):
image = cv2.imread(fileDir + "/sudoku-resized.png")
cv2.imwrite(fileDir + "/outputs/sudoku" + additionalName + "-out.png", image)
image = cv2.imread(fileDir + "/outputs/sudoku" + additionalName + "-out.png")
font = cv2.FONT_HERSHEY_SIMPLEX
fontScale = 6
fontColor = (0,0,0)
lineType = 10
cellDiemensions = int(1600 / 9)
for x in range(9):
for y in range(9):
if sudokuSolution[y][x] != sudokuUnsolved[y][x]:
bottomLeftCornerOfText = (cellDiemensions * x + 30,cellDiemensions * (y + 1) - 20)
cv2.putText(image, str(sudokuSolution[y][x]), bottomLeftCornerOfText, font, fontScale, fontColor, lineType)
cv2.imwrite(fileDir + "/outputs/sudoku" + additionalName + "-out.png", image)