相关疑难解决方法(0)

在Python中提取外部轮廓或图像轮廓

我想提取图像的轮廓,我正在尝试使用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()
Run Code Online (Sandbox Code Playgroud)

这是我原来的形象:

原版的

这是我的结果:

轮廓

但我只想展示外部轮廓,轮廓.只是这个例子中的读取行.

我该怎么做?我阅读了轮廓功能的文档,但我无法得到我想要的东西.

如果您在Python中知道更好的方法,请告诉我!(MatplotLib,OpenCV等)

python image-processing matplotlib

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

image-processing ×1

matplotlib ×1

python ×1