小编Geo*_*rgy的帖子

如何检测图像中的游戏板

我需要找到一个围棋游戏板并在 python 上使用 opencv2 检测照片上的芯片,但现在我在棋盘检测方面遇到问题,同一轮廓中有奇怪的点,我不明白如何删除它们。这就是我现在所拥有的:

from skimage import exposure
import numpy as np
import argparse
import imutils
import cv2

ap = argparse.ArgumentParser()
ap.add_argument("-r", required = True,
    help = "ratio", type=int, default = 800)
args = vars(ap.parse_args())

img = cv2.imread('3.jpg') #upload image and change resolution
ratio = img.shape[0] / args["r"]
orig = img.copy()
img = imutils.resize(img, height = args["r"])

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 
gray = cv2.bilateralFilter(gray, 11, 17, 17)
edged = cv2.Canny(gray, 30, 200)

cnts= cv2.findContours(edged.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) #search contours and …
Run Code Online (Sandbox Code Playgroud)

python opencv image image-processing computer-vision

4
推荐指数
1
解决办法
1722
查看次数