SoFunction
Updated on 2024-11-17

Detailed tutorial for installing Anaconda and python on windows

When it comes to digital image processing programming, most people probably think of matlab, but matlab has its own drawbacks:

1, not open source, expensive

2, software capacity. General 3G or more, high version even up to 5G or more.

3, can only do research, not easy to convert into software.

Therefore, we are using Python, a scripting language, for digital image processing here.

To use Python, you must first install python, usually version 2.7 or higher, and it is very easy to install, both on windows and on Linux.

To use python for all kinds of development and scientific computing, you also need to install the corresponding packages. This is very similar to matlab, except that in matlab it is called toolbox, while in python it is called library or package. There are many digital image processing packages based on the python scripting language, such as PIL, Pillow, OpenCV, scikit-image, and so on.

Comparing these packages, PIL and Pillow only provide the most basic digital image processing with limited functionality; OpenCV is actually a c++ library that only provides a python interface and is very slow to update. By now python has developed to version 3.5, while opencv only supports up to python version 2.7; scikit-image is an image processing package based on scipy, which processes images as numpy arrays, exactly the same as matlab, therefore, we finally choose scikit-image for digital image processing.

I. Required installation packages

Since scikit-image is based on scipy for computing, installing numpy and scipy is a must. To do the display of the image, you also need to install the matplotlib package, and all together, the packages needed are:

Python >= 2.6
Numpy >= 1.6.1
Cython >= 0.21
Six >=1.4
SciPy >=0.9
Matplotlib >= 1.1.0
NetworkX >= 1.8
Pillow >= 1.7.8
dask[array] >= 0.5.0

Compare that to the fact that it's very fiddly to install, especially scipy, which is basically impossible to install on windows.

But don't be afraid, we just choose an integrated installation environment, here we recommend Anaconda, which integrates all the packages needed above, so we actually only need to install the Anaconda software from the beginning to the end, and nothing else.

Download and install anaconda

come first/downloads Download anaconda, now there are python2.7 and python3.5 versions, download the corresponding version of anaconda, corresponding to the system, it is actually a sh script file, about 280M.

This series takes windows 7+python3.5 as an example, so we download the version in the red box below:

Name: Anaconda3-2.4.1-Windows-x86_64.exe

It's an executable exe file, download it well and double click it directly to install it.

While installing, let's assume that we install in the root directory of the D drive, for example:

And with both options selected, write the installation path to the environment variable.

Then just wait for the installation to complete.

Once the installation is complete, open the windows command prompt:

Type conda list to find out what libraries are installed, including numpy and scipy. If you still have packages that are not installed, you can run the

conda install *** to install. (*** is the name of the required package)

If a package version is not up-to-date, run conda update *** to update it.

III. Simple tests

anaconda comes with an editor, spyder, which we can use to write code later.

Put it in the installation directory under Scripts, for example, mine is D:/Anaconda3/Scripts/, and you can run it by double clicking on it. We can right-click it to send it to the desktop shortcut, so it's easier to run it later.

We simply write a program to test whether the installation is successful, the program is used to open a picture and display. First prepare a picture, then open spyder, write the following code:

from skimage import io
img=('d:/')
(img)

Change d:/ to your image location.

Then click on the green triangle in the toolbar above to run it, which eventually displays

If the "Ipython console" image is displayed in the bottom right corner, it means that our runtime environment has been installed successfully.

We can view the image information by selecting the " variable explorer" in the upper right corner, such as

We can save this program, noting that python script files have the suffix py.

IV. Submodules of the skimage package

The skimage package, known as scikit-image SciKit (toolkit for SciPy), extends the package with additional image processing features. It is written in python and is developed and maintained by the scipy community. skimage consists of a number of sub-modules, each providing different functionality. The main submodules are listed below:

Submodule Name Main Realization Functions
io Read, save and display pictures or videos
data Provide some test pictures and sample data
color Color Space Transformations
filters Image Enhancement, Edge Detection, Sorting Filters, Auto Thresholding, etc.
draw Basic graphic drawing on numpy arrays, including lines, rectangles, circles, text, etc.
transform Geometric or other transformations, such as rotation, stretching, and Radon transformations
morphology Morphological operations such as opening and closing operations, skeleton extraction, etc.
exposure Image intensity adjustments such as brightness adjustment, histogram equalization, etc.
feature Feature detection and extraction, etc.
measure Measurement of image attributes such as similarity or contour lines
segmentation image segmentation
restoration Image Recovery
util general function (math.)

When using some image processing operation functions, you need to import the corresponding sub-module, if you need to import more than one sub-module, then separated by commas, such as:

from skimage import io,data,color

The above is a small introduction to the tutorial details of installing Anaconda and python on windows, I hope it will help you, if you have any questions please leave me a message, I will reply to you in time. Here also thank you very much for your support of my website!