pytesseract.pytesseract.tesseract_cmd = "C:/Program Files/Tesseract-OCR/tesseract.exe"

    # load the digit classifier from disk
    print("[INFO] loading digit classifier...")
    model = load_model("Model/train_digit_classifier.h5")
    # train_digit_classifier
    # digitClassifierModel

    # load the Input image from disk and resize it
    print("[INFO] processing image...")
    image = cv2.imread("resources/fig2.PNG")
    image = imutils.resize(image, width=600)

    # find the puzzle in the image and then
    # if debug = true, it shows the image
    (puzzleImage, warped) = find_puzzle(image, debug=True)

    # initialize our 9x9 sudoku board
    board = np.zeros((9, 9), dtype="int")

    # a sudoku puzzle is a 9x9 grid (81 individual cells), so we can
    # infer the location of each cell by dividing the warped image
    # into a 9x9 grid
    stepX = warped.shape[1] // 9
    stepY = warped.shape[0] // 9

    # initialize a list to store the (x, y)-coordinates of each cell
    # location
    cellLocs = []

    # loop over the grid locations
Exemplo n.º 2
0
                help="path to input sudoku puzzle image")
ap.add_argument("-d", "--debug", type=int, default=-1,
                help="whether or not we are visualizing each step of the pipeline")
args = vars(ap.parse_args())

# load the digit classifier from disk
print("[INFO] loading digit classifier...")
model = load_model(args["model"])

# load the input image from disk and resize it
print("[INFO] processing image...")
image = cv2.imread(args["image"])
image = imutils.resize(image, width=600)

# find the puzzle in the image and then
(puzzleImage, warped) = find_puzzle(image, debug=args["debug"] > 0)

# initialize our 9x9 sudoku board
board = np.zeros((9, 9), dtype="int")

# a sudoku puzzle is a 9x9 grid (81 individual cells), so we can
# infer the location of each cell by dividing the warped image
# into a 9x9 grid
stepX = warped.shape[1] // 9
stepY = warped.shape[0] // 9

# initialize a list to store the (x, y)-coordinates of each cell
# location
cellLocs = []

# loop over the grid locations
Exemplo n.º 3
0
# load the digit classifier from disk
print("[INFO] loading digit classifier...")
model = load_model(args["model"])

# load the input image from disk and resize it
print("[INFO] processing image...")
image = cv2.imread(args["image"])
cv2.imshow('sudoku', image)

image = imutils.resize(image, width=600)

# find the puzzle in the image and then
# puzzleImage là ảnh thường , warped là ảnh xám
(puzzleImage, warped) = find_puzzle(
    image,
    debug=args["debug"] > 0)  #debug default hiện đang là -1 < 0 nên là false

# initialize our 9x9 sudoku board
board = np.zeros((9, 9), dtype="int")

# a sudoku puzzle is a 9x9 grid (81 individual cells), so we can
# infer the location of each cell by dividing the warped image
# into a 9x9 grid

# ảnh xám có tọa độ y , x
stepX = warped.shape[1] // 9
stepY = warped.shape[0] // 9

arr = np.zeros((9, 9))
for y in range(9):