Ten commonly used python image processing tools

This article is taken from: https://cloud.tencent.com/developer/article/1457030    as an essay

1.scikit-image

scikit-image is an open source Python package for numpy arrays. It implements algorithms and practical tools for research, education and industrial applications. Even for those new to the Python ecosystem, it is a fairly straightforward library. This code is written by an active volunteer community and is of high quality and peer-reviewed nature.

Resources

The document records a wealth of examples and actual use cases, read the following documents:

http://scikit-image.org/docs/stable/user_guide.html

usage

The package is imported as skimage, most of the functions are found in the submodules. Here are some examples of skimage:

2.Numpy

Numpy is one of the core libraries for Python programming and provides support for arrays. The image is essentially a standard Numpy array containing pixels of data points. Therefore, we can modify the pixel values ​​of the image by using basic NumPy operations such as slicing, masking, and fancy indexing. You can use skimage to load the image and use matplotlib to display the image.

Resources   Numpy's official documentation page provides a complete list of resources and documentation:
http://www.numpy.org/

 

 

3.Scipy

Scipy is another core scientific module similar to Numpy in Python, which can be used for basic image manipulation and processing tasks. In particular, the submodule scipy.ndimage provides functions to operate on n-dimensional NumPy arrays. The package currently includes functional functions such as linear and nonlinear filtering, binary morphology, B-spline interpolation, and object measurement.

Resources

For a complete list of functions provided by the scipy.ndimage package, please refer to the following link:

https://docs.scipy.org/doc/scipy/reference/tutorial/ndimage.html#correlation-and-convolution

usage

Blur through Gaussian filter using SciPy:

from scipy import misc, Image 

face = misc.face () 
blurred_face = image.gaussian_filter (face, sigma = 3) 
very_blurred = image.gaussian_filter (face, sigma = 5) 

#Results 
plt.imshow (<image to be displayed>

4. PIL/ Pillow

PIL (Python Image Library) is a free library for the Python programming language that supports opening, manipulating, and saving images in many different file formats. However, with the last release in 2009, its development has stalled. Fortunately, there is Pillow, a branch actively developed by PIL and easier to install. It runs on all major operating systems and supports Python 3. This library contains basic image processing functions, including point operations, filtering using a set of built-in convolution kernels, and color space conversion.

Resources

The documentation contains installation instructions and examples of each module covering the library:

https://pillow.readthedocs.io/en/3.1.x/index.html

usage

Use ImageFilter to enhance the image in Pillow:

from PIL import Image, ImageFilter
#Read image
im = Image.open( 'image.jpg' )
#Display image
im.show()

from PIL import ImageEnhance
enh = ImageEnhance.Contrast(im)
enh.enhance(1.8).show("30% more contrast")

5. OpenCV-Python

OpenCV (Open Source Computer Vision Library) is one of the most widely used libraries in computer vision applications. OpenCV-Python is OpenCV's Python API. The advantages of OpenCV-Python are not only efficient, but because its internal composition is written in C / C ++, and it is also easy to write and deploy (because the front end is wrapped in Python). This makes it a good choice for executing computationally intensive computer vision programs.

Resources

The OpenCV-Python-Guide guide makes it easier for you to use OpenCV-Python:

https://github.com/abidrahmank/OpenCV2-Python-Tutorials

usage

The following is an example that demonstrates the function of OpenCV-Python to create a new fruit image fusion named "Orapple" using the pyramid method.

6. SimpleCV

SimpleCV is also an open source framework for building computer vision applications. With it, you can access several high-performance computer vision libraries, such as OpenCV, without the need to learn bit depth, file format, color space, etc. first.

Its learning curve is much smaller than OpenCV, as their slogan says "computer vision becomes simple". Some views supporting SimpleCV are:

  • Even beginners can write simple machine vision tests
  • Cameras, video files, images and video streams are all interoperable

Resources

The official documentation is very easy to understand, and there are a lot of examples and use cases to learn:

https://simplecv.readthedocs.io/en/latest/

7. Mahotas

Mahotas is another Python library for computer vision and image processing. It includes traditional image processing functions such as filtering and morphological operations and more modern computer vision functions for feature calculations, including point of interest detection and local descriptors. The interface is in Python language, suitable for rapid development, but the algorithm is implemented in C language and is tuned according to speed. The Mahotas library is fast, the code is concise, and even has minimal dependencies. Read their official papers through the original text to get more understanding.

Resources

The documentation includes installation instructions, examples, and some tutorials, which can better help you start using mahotas.

https://mahotas.readthedocs.io/en/latest/install.html

usage

The Mahotas library relies on using simple code to complete tasks. Regarding the question of 'Finding Wally', Mahotas did a very good job with a small amount of code. Here is the source code:

https://mahotas.readthedocs.io/en/latest/wally.html

 

8. SimpleITK

ITK or Insight Segmentation and Registration Toolkit is an open source cross-platform system that provides developers with a wide range of image analysis software tools. Among them, SimpleITK is a simplified layer built on ITK, which aims to promote its application in rapid prototyping, education, and interpreted languages. SimpleITK is an image analysis toolkit that contains a large number of components that support general filtering operations, image segmentation and matching. SimpleITK itself is written in C ++, but it is available for most programming languages ​​including Python.

Resources

A large number of Jupyter Notebooks show that SimpleITK has been used in the field of education and research. Notebook demonstrates the use of SimpleITK in Python and R programming languages ​​for interactive image analysis.

http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/

usage

The animation below is a visualization of the rigid CT / MR matching process created with SimpleITK and Python. Here is the source code:

https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Utilities/intro_animation.py

9. pgmagick

pgmagick is a python-based wrapper of GraphicsMagick library. The GraphicsMagick image processing system is sometimes called the Swiss Army knife for image processing. It provides a powerful and efficient collection of tools and libraries that support reading, writing, and Operate the image.

Resources

There is a Github library dedicated to PgMagick, which contains installation and requirements instructions. There is also a detailed user guide on this:

https://github.com/hhatto/pgmagick

usage

There are few image processing activities that can be performed with pgmagick,

10. Pycairo

Pycairo is a set of Python bundles for the image processing library cairo. Cairo is a 2D graphics library for drawing vector graphics. Vector graphics are interesting because they do not lose clarity when resized or converted. Pycairo is a set of cairo bindings that can be used to call cairo commands from Python.

Resources

Pycairo's GitHub repository is a good resource with detailed instructions on installation and use. There is also a getting started guide with a short tutorial about Pycairo.

  • Library: https://github.com/pygobject/pycairo
  • Guide: https://pycairo.readthedocs.io/en/latest/tutorial.html

usage

Use Pycairo to draw lines, basic shapes and radial gradients

Published 18 original articles · won praise 1 · views 2668

Guess you like

Origin blog.csdn.net/taochengwu123/article/details/105597637