请写出python opencv 为二值化图片轮廓点每一百个取一个样点,并获取样点坐标的具体代码
时间: 2023-03-08 18:16:40 浏览: 67
import cv2
img = cv2.imread('image.png', 0)
ret, thresh = cv2.threshold(img, 127, 255, 0)
contours, hierarchy = cv2.findContours(thresh, 1, 2)
cnt = contours[0]
step_size = 100
sample_points = []
for i in range(0, len(cnt), step_size):
sample_points.append(cnt[i])
for i in sample_points:
print(i[0])
阅读全文