NameError:名称“变形”未定义

时间:2019-12-25 10:26:18

标签: python-3.x

我只是试图在棋盘上裁剪任何正方形,为此我使用了在python中不起作用的dewarp。

import scipy
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import cv2
img = cv2.imread('/home/tejas/Pictures/webcam_chess.png')
approx = find_board_contour(img)
fig = plt.figure(1, (8,8))
grid = ImageGrid(fig, 111, nrows_ncols=(8,8), axes_pad=0.1)

board = dewarp(img,approx)
board = cv2.resize(board, (400,400))

for i in range(8*8):
    col = i % 8
    row = i // 8
    square = get_square(board, row, col)
    grid[i].imshow(cv2.cvtColor(square, cv2.COLOR_BGR2RGB))
    #fig[i].show()
plt.show()

0 个答案:

没有答案