Python: scikit-image canny 边缘检测
2016-01-15 16:40
826 查看
这个用例说明canny 边缘检测的用法
参考来源: http://scikit-image.org/docs/dev/auto_examples/
import numpy as np import matplotlib.pyplot as plt from scipy import ndimage as ndi from skimage import feature # Generate noisy image of a square im = np.zeros((128, 128)) im[32:-32, 32:-32] = 1 im = ndi.rotate(im, 15, mode='constant') im = ndi.gaussian_filter(im, 4) im += 0.2 * np.random.random(im.shape) # Compute the Canny filter for two values of sigma edges1 = feature.canny(im) edges2 = feature.canny(im, sigma=3) # display results fig, (ax1, ax2, ax3) = plt.subplots(nrows=1, ncols=3, figsize=(8, 3), sharex=True, sharey=True) ax1.imshow(im, cmap=plt.cm.jet) ax1.axis('off') ax1.set_title('noisy image', fontsize=20) ax2.imshow(edges1, cmap=plt.cm.gray) ax2.axis('off') ax2.set_title('Canny filter, $\sigma=1$', fontsize=20) ax3.imshow(edges2, cmap=plt.cm.gray) ax3.axis('off') ax3.set_title('Canny filter, $\sigma=3$', fontsize=20) fig.subplots_adjust(wspace=0.02, hspace=0.02, top=0.9, bottom=0.02, left=0.02, right=0.98) plt.show()
参考来源: http://scikit-image.org/docs/dev/auto_examples/
相关文章推荐
- 【Python模块】命令行解析--argparse
- 自学Python五 爬虫基础练习之SmartQQ协议
- python 常用模块
- python __call__ 函数
- 一段有趣的python小代码(将numpy中的数组转化为可哈希的字典)
- [python]类与类中的列表
- Python常用模块的安装方法
- webdriver+python 对三大浏览器的支持
- NumPy的详细教程
- python实现图文格式的服务器性能报表邮件(qq)
- python实现图文格式的服务器性能报表邮件(qq)
- python 列表函数
- AWS EC2上传文件到S3(python boto)
- Python fromkeys()的'bug'
- Python 3.1 使用模块
- Python 引号
- python中if __name__ == '__main__': 的解析
- Python 中文编码
- python爬虫爬取糗事百科
- python 特殊语法map,filter,reduce