【发布时间】:2012-11-15 05:15:06
【问题描述】:
我想提取图像的轮廓,我正在尝试使用 MatplotLib 的轮廓函数。这是我的代码:
from PIL import Image
from pylab import *
# read image to array
im = array(Image.open('HOJA.jpg').convert('L'))
# create a new figure
figure()
# show contours with origin upper left corner
contour(im, origin='image')
axis('equal')
show()
这是我的原图:
这是我的结果:
但我只想展示外部轮廓,轮廓。只是本例中的读取行。
我该怎么做?我阅读了contour 函数的文档,但我无法得到我想要的。
如果您知道在 Python 中执行此操作的更好方法,请告诉我! (MatplotLib、OpenCV等)
【问题讨论】:
标签: python image-processing matplotlib