Scikit-image 简明教程
Scikit Image - Introduction
Scikit-image(也称为 skimage )是 Python 编程语言中的一种开源图像处理库。它提供了一个强大的算法和函数工具箱,用于各种图像处理和计算机视觉任务。它基于流行的科学库构建,如 NumPy 和 SciPy.ndimage。
Scikit-image (also known as skimage) is one of the open-source image-processing libraries for the Python programming language. It provides a powerful toolbox of algorithms and functions for various image processing and computer vision tasks. And it is built on top of popular scientific libraries like NumPy and SciPy.ndimage.
Features of scikit-image
以下是 Scikit Image 的主要特性:
Following are the main features of Scikit Image −
-
Scikit-image is an open-source package in Python. This means that it is available free of charge and free of restriction.
-
Easy to read and write images of various formats. The library offers multiple plugins and methods to read and write images of various formats, such as JPEG, PNG, TIFF, and more.
-
Images in scikit-image are represented by NumPy ndarrays (multidimentional containers). Hence, many common operations can be achieved using standard NumPy methods for manipulating arrays.
-
It provides a vast collection of image Processing Algorithms such as filtering, segmentation, feature extraction, morphology, and more.
-
And it offers a user-friendly API that simplifies the process of performing image processing tasks.
History of scikit-image
Scikit-image 最初是由一个活跃的国际研究人员和贡献者团队开发的。它源自几个现有图像处理项目的结合,包括 scipy.ndimage 、matplotlib 等。
Scikit-image was initially developed by an active, international team of researchers and contributors. It originated from the combination of several existing image processing projects, including scipy.ndimage, matplotlib, and others.
Advantages of scikit-image
scikit-image 提供了几个优点,使它成为图像处理任务的宝贵工具 −
scikit-image offers several advantages that make it a valuable tool for image processing tasks −
-
Easy Integration with Python’s Scientific Tools − It is built on top of NumPy, SciPy, and other scientific libraries. This enables users to combine image processing with other scientific computing tasks, such as data analysis, machine learning, and visualization.
-
Comprehensive Image Processing Tools − scikit-image provides a wide range of tools and algorithms for image processing tasks. It includes comprehensive image filters, morphological operations, image transformations, feature extraction, and more. These tools allow users to perform complex image processing operations with ease and flexibility.
-
User-Friendly Visualization − scikit-image includes a simple graphical user interface (GUI) for visualizing results and exploring parameters.
Scikit Image - Environmental setup
为了设置 scikit-image 的环境,建议使用 pip 或 conda 等包管理器来安装 scikit-image 及其依赖项。 pip 是 Python 的默认包管理器,而 Conda 是在 Anaconda 环境中管理包的常用选择。
To set up the environment for scikit-image, it is recommended to use a package manager such as pip or conda to install scikit-image and its dependencies. pip is the default package manager for Python, while Conda is a popular choice for managing packages in Anaconda environments.
Installing scikit-image using pip
要使用 pip 安装 scikit-image,只需在命令提示符中运行以下命令 −
To install scikit-image using pip, just run the below command in your command prompt −
pip install scikit-image
这将下载 scikit-image 包,等待下载完成。如果您看到任何 pip 升级错误,只需通过以下命令升级 pip −
This will download the scikit-image package, wait for download completion. If you see any pip up-gradation error, then just upgrade the pip by the following command −
python -m pip install --upgrade pip
然后再次运行 “pip install scikit-image” 命令,这次将起作用。
And run *"pip install scikit-image" *command again, this time it will work.
Installing scikit-image using Conda
如果您已经在系统中使用了 Anaconda 发行版,则可以直接使用 conda 包管理器来安装 scikit-image。以下是命令 −
If you’re using the Anaconda distribution already in your system then you can directly use the conda package manager to install scikit-image. Following is the command −
conda install scikit-image
如果 scikit-image 包已安装在您的计算机上,则运行 conda install scikit-image 命令将显示以下消息 −
If the scikit-image package is already installed on your computer, running the conda install scikit-image command will display the below message −
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
# All requested packages already installed.
Retrieving notices: ...working... done
Note: you may need to restart the kernel to use updated packages.
Verification
要检查 scikit-image 是否已安装,或者验证安装是否成功,您可以在 Python shell 或 Jupyter Notebook 中执行以下代码 −
To check whether scikit-image is already installed or to verify if an installation has been successful, you can execute the following code in a Python shell or Jupyter Notebook −
import skimage
# Check the version of scikit-image
print("scikit-image version:", skimage.__version__)
如果以上代码执行时没有任何错误,则表示 scikit-image 已成功安装并可以使用。
If the above code executes without any errors, it means that scikit-image is installed successfully and ready to be used.