Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何删除不必要的轮廓?_Python_Opencv_Image Processing - Fatal编程技术网

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)