Python 如何删除不必要的轮廓?
Python 如何删除不必要的轮廓?,python,opencv,image-processing,Python,Opencv,Image Processing,你好,第一张图,图上有突起,我不想得到这些轮廓。我想要的结果轮廓在第二张图片中。我正在等待您的帮助,谢谢。这是一种方法: 填充轮廓线。对图像进行形态学打开以去除小叶子,并从最后一张图像中减去被侵蚀的图像,以仅保留其轮廓 尝试轮廓近似。根据需要调整ε # epsilon is the maximum distance from contour to approximated contour. It is an accuracy parameter. # A wise selection of
你好,第一张图,图上有突起,我不想得到这些轮廓。我想要的结果轮廓在第二张图片中。我正在等待您的帮助,谢谢。这是一种方法: 填充轮廓线。对图像进行形态学打开以去除小叶子,并从最后一张图像中减去被侵蚀的图像,以仅保留其轮廓
尝试轮廓近似。根据需要调整ε
# epsilon is the maximum distance from contour to approximated contour. It is an accuracy parameter.
# A wise selection of epsilon is needed to get the correct output.
epsilon = 0.1 * cv2.arcLength(contour, True)
approx_contour = cv2.approxPolyDP(contour, epsilon, True)
另存为.svg并在Illustrator/Affinity中编辑?上帝保佑你兄弟:)
# epsilon is the maximum distance from contour to approximated contour. It is an accuracy parameter.
# A wise selection of epsilon is needed to get the correct output.
epsilon = 0.1 * cv2.arcLength(contour, True)
approx_contour = cv2.approxPolyDP(contour, epsilon, True)