scikit图像 是一个图像处理Python包,它与NumPy数组一起工作,NumPy数组是图像处理算法的集合。让我们讨论一下如何将图像处理成一组信息,以及它在现实世界中的一些应用。 scikit图像的重要功能:
null
简单有效的图像处理和计算机视觉技术工具。 每个人都可以访问,并且可以在各种环境中重复使用。 建立在NumPy、SciPy和matplotlib之上。 开源,商业化使用——BSD许可证。
注: 在安装scikit映像之前,请确保预装了NumPy和SciPy。现在,安装scikit映像最简单的方法是使用pip:
pip install -U scikit-image
浏览的大部分功能都在子模块中找到。图像表示为NumPy阵列,例如灰度二维图像的二维阵列。 代码#1:
Python3
# Python3 program to process # images using scikit-image # importing data from skimage from skimage import data camera = data.camera() # An image with 512 rows # and 512 columns type (camera) print (camera.shape) |
输出:
numpy.ndarray(512, 512)
代码#2: 撇渣。数据子模块提供一组返回示例图像的函数。
python
# Python3 program to process # images using scikit-image # importing filters and # data from skimage from skimage import filters from skimage import data # Predefined function to fetch data coins = data.coins() # way to find threshold threshold_value = filters.threshold_otsu(coins) print (threshold_value) |
输出:
107
代码#3: 从图像文件中以NumPy数组的形式加载自己的图像。
python
# Python3 program to process # images using scikit-image import os # importing io from skimage import skimage from skimage import io # way to load car image from file file = os.path.join(skimage.data_dir, 'cc.jpg' ) cars = io.imread( file ) # way to show the input image io.imshow(cars) io.show() |
输出:
应用:
- 医学图像分析。
- 用于检测的图像分类。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END