我需要用python得到一个矩阵,其中包含下图轮廓的坐标(x,y)。
我试着用opencv canny探测器找到轮廓,但我得到了很多轮廓,我不知道如何得到我想要的。import numpy as np
from matplotlib import pyplot as plt
import cv2
#from skimage import measure, feature, io
#from skimage import img_as_ubyte
x1 = 330
xf = 690
y1 = 0
yf = 400
img = cv2.imread('test.tif')
img = img[y1:yf, x1:xf]
edge = cv2.Canny(img, 100, 200)
image, contours, hierarchy = cv2.findContours(edge, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
我只需要一个有轮廓(x,y)坐标的数组。我认为它在cv2.findContours()的轮廓输出中,但是我没有找到我想要的轮廓
我还尝试了matplotlib.pyplot.contour函数:import cv2
import