小编dfa*_*daf的帖子

寻找矩形区域的中心线和中心点

我运行以下代码来创建一个矩形轮廓:

#import the necessary packages
import argparse
import imutils
import cv2
import numpy as np

# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
                help="path to the input image")
args = vars(ap.parse_args())

# load the image, convert it to grayscale, blur it slightly, and threshold it
image = cv2.imread(args["image"])
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (5, 5), 0)

# threshold the image, then perform a series of erosions + dilations to remove any …
Run Code Online (Sandbox Code Playgroud)

python opencv image-processing computer-vision scikit-image

2
推荐指数
1
解决办法
1881
查看次数