This article describes how to install Anaconda and python on windows. it is very good and has reference value, for more information about how to install Anaconda and python on windows, see this article.
When it comes to digital image processing programming, most people may think of matlab, but matlab also has its own shortcomings:
1. not open-source, expensive
2. large software capacity. Generally, it is 3G or above, and the version is later than 5g.
3. you can only do research and it is not easy to convert it into software.
Therefore, we use the Python script language for digital image processing.
To use Python, you must first install python, which is generally version 2.7 or later. the installation is very simple in both windows and Linux systems.
To use python for various development and scientific computing, you also need to install the corresponding package. This is very similar to matlab, but matlab is called toolbox, while python is called Library or package. There are many digital image processing packages developed based on the python script language, such as PIL, Pillow, OpenCV, and scikit-image.
Compared with these packages, PIL and Pillow only provide the most basic digital image processing and have limited functions. OpenCV is actually a c ++ library, but only provides python interfaces, and the update speed is very slow. Now python has developed to version 3.5, while opencv only supports python 2.7. scikit-image is an image processing package based on scipy, which processes images as numpy arrays, just like matlab, we finally chose scikit-image for digital image processing.
1. required installation packages
Because scikit-image is based on scipy, it is certain to install numpy and scipy. To display images, you also need to install the matplotlib package. in combination, the required packages include:
Python >= 2.6Numpy >= 1.6.1Cython >= 0.21Six >=1.4SciPy >=0.9Matplotlib >= 1.1.0NetworkX >= 1.8Pillow >= 1.7.8dask[array] >= 0.5.0
Compared, it is very troublesome to install, especially scipy, which is basically not installed on windows.
But don't worry, we just need to select an integrated installation environment. Here we recommend Anaconda, which integrates all the preceding packages, therefore, we only need to install the Anaconda software from start to end, and nothing else needs to be installed.
2. download and install anaconda
First go to www. continuum. io/downloads anaconda. The current versions include python2.7 and python3.5. download the corresponding version and the anaconda of the system. it is actually a sh script file, which is about MB.
This series uses Windows 7 + python3.5 as an example. Therefore, we download the version in the red box:
We simply write a program to test whether the installation is successful. The program is used to open an image and display it. First, prepare an image, open spyder, and write the following code:
from skimage import ioimg=io.imread('d:/dog.jpg')io.imshow(img)
Change d:/dog.jpg to your image location.
Click the green triangle in the toolbar to run the task.
We can save this program. Note that the suffix of the python script file is py.
IV. submodules of the skimage package
The full name of the skimage package is scikit-image SciKit (toolkit for SciPy). it extends scipy. ndimage and provides more image processing functions. It is written in python and developed and maintained by the scipy Community. The skimage package consists of many sub-modules. each sub-module provides different functions. The list of main sub-modules is as follows:
Sub-module name |
Main functions |
Io |
Read, save, and display images or videos |
Data |
Provides some test images and sample data |
Color |
Color space transformation |
Filters |
Image enhancement, edge detection, sorting filter, automatic threshold, etc. |
Draw |
Allows you to draw basic images on the numpy array, including lines, rectangles, circles, and texts. |
Transform |
Geometric or other transformations, such as rotation, stretching, and Laidong transformation |
Morphology |
Morphological operations, such as open/closed operations and skeleton extraction |
Exposure |
Image intensity adjustment, such as brightness adjustment and histogram balancing |
Feature |
Feature detection and extraction |
Measure |
Measure Image attributes, such as similarity or contour lines. |
Segmentation |
Image segmentation |
Restoration |
Image restoration |
Util |
Common functions |
When using image processing functions, you need to import the corresponding sub-modules. if you need to import multiple sub-modules, separate them with commas, for example:
from skimage import io,data,color
The above describes how to install Anaconda and python on windows. For more information, see other related articles in the first PHP community!