In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what image processing tools there are in Python. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
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 simple and straightforward library. This code is written by an active volunteer community and is of high quality and peer-reviewed nature.
Usage
The package is imported as skimage, and most of the features are found in the sub-modules. Here are some examples of skimage:
Image filtering
Import matplotlib.pyplot as plt
% matplotlib inline
From skimage import data,filters
Image = data.coins ()
#... Or any other NumPy array!
Edges = filters.sobel (image)
Plt.imshow (edges, cmap='gray')
Template matching using match_template function
2. Numpy
Numpy is one of the core libraries of Python programming and provides support for arrays. An 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 images and matplotlib to display images.
Usage
Use Numpy to mask the image.
Import numpy as np
From skimage import data
Import matplotlib.pyplot as plt
% matplotlib inline
Image = data.camera ()
Type (image)
Numpy.ndarray # Image is a numpy array
Mask = image < 87
Image [mask] = 255
Plt.imshow (image, cmap='gray')
3.Scipy
Scipy is another core scientific module of Python similar to Numpy, which can be used for basic image manipulation and processing tasks. In particular, the submodule scipy.ndimage provides functions that operate on the n-dimensional NumPy array. The package currently includes functions such as linear and nonlinear filtering, binary morphology, B-spline interpolation and object measurement.
Usage
Use SciPy to blur through a Gaussian filter:
From scipy import misc,ndimage
Face = misc.face ()
Blurred_face = ndimage.gaussian_filter (face, sigma=3)
Very_blurred = ndimage.gaussian_filter (face, sigma=5)
# Results
Plt.imshow ()
4. PIL/ Pillow
PIL (Python Image Library) is a free library of the Python programming language that supports opening, manipulating, and saving images in many different file formats. However, with its last release in 2009, its development stagnated. But fortunately there is also Pillow, a branch of PIL that is actively developed and easier to install, which runs on all major operating systems and supports Python3. This library contains basic image processing functions, including point operations, filtering using a set of built-in convolution kernels, and color space conversion.
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 the python version of API for OpenCV. The advantages of OpenCV-Python are not only efficient, because its internal composition is written in C _ Python +, but it is also easy to write and deploy (because the front end is wrapped in Python). This makes it a good choice for executing computing-intensive computer vision programs.
This is the end of this article on "what image processing tools are in Python". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.