main.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:SudokuVisionSolver 作者: tusharsircar95 项目源码 文件源码
def getTestImage(img,size): 
    size = int(size)
    (x,y) = np.shape(img)
    left,right,bottom,top = x,0,y,0
    count = 0
    for i in range(x):
        for j in range(y):
            if img[i][j] == 255:
                left = min(left,i)
                right = max(right,i)
                top = max(top,j)
                bottom = min(bottom,j)

                count = count + 1
    if count == 0:
        return img

    img = img[left:right,bottom:top]
    cv2.imwrite('template.jpg',img)
    return img

# Divides the grid into 9x9 = 81 cells and does OCR on each after processing it
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号