Opencv-solver/Sudoku_extractor.py
def infer_grid(img):
        """Infers 81 cell grid from a square image."""
        squares = []
        side = img.shape[:1]
        side = side[0] / 9

        # Note that we swap j and i here so the rectangles are stored in the list reading left-right instead of
        # top-down.
        for j in range(9):
            for i in range(9):
                p1 = (i * side, j * side)  # Top left corner of a bounding box
                p2 = ((i + 1) * side, (j + 1) * side)  # Bottom right corner of bounding box
                squares.append((p1, p2))
        return squares
Infers 81 cell grid from a square image.
Infers 81 cell grid from a square image.
Infers 81 cell grid from a square image .
def infer_grid(img):
        squares = []
        side = img.shape[:1]
        side = side[0] / 9
        for j in range(9):
            for i in range(9):
                p1 = (i * side, j * side)  
                p2 = ((i + 1) * side, (j + 1) * side)  
                squares.append((p1, p2))
        return squares
def infer_grid ( img ) : squares = [ ] side = img . shape [ : 1 ] side = side [ 0 ] / 9 for j in range ( 9 ) : for i in range ( 9 ) : p1 = ( i * side , j * side ) p2 = ( ( i + 1 ) * side , ( j + 1 ) * side ) squares . append ( ( p1 , p2 ) ) return squares
Infers 81 cell grid from a square image.
Infers 81 cell grid from a square image .
"""Infers 81 cell grid from a square image.""" # Note that we swap j and i here so the rectangles are stored in the list reading left-right instead of # top-down. # Top left corner of a bounding box # Bottom right corner of bounding box
img