In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what tools does Python have to make the image simple, intuitive and attractive". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Scikit Image
Scikit-image is an open source package for Python that treats pictures as an array of numpy. It enables algorithms and utilities to be used in research, education, and industry applications. Even for those who are not familiar with the Python environment, this library is very simple and straightforward. This code, written by an active team of volunteers, is of high quality and has been reviewed.
Usage: this package is imported as skimage, and most features can be found in sub-modules. For example:
(1) Image filtering
Import matplotlib.pyplot as plt% matplotlib inline from skimage import data,filters image = data.coins () #... Or any other NumPy arrayweights = filters.sobel (image) plt.imshow (edges, cmap='gray')
(2) use match_template function for template matching
2. Numpy
Numpy is a core library of Python programming that provides support for arrays. An image is essentially a standard Numpy array of data pixels. Therefore, you can modify the pixel values of an image by using basic NumPy operations, such as slicing, masking, and matching indexes. You can also load images with skimage and display images with matplotlib.
Use: use Numpy to achieve image masks.
Import numpy as npfrom skimage import dataimport matplotlib.pyplot as plt% matplotlib inline image = data.camera () type (image) numpy.ndarray # Image is a numpy array mask = image
< 87image[mask]=255plt.imshow(image, cmap='gray') 3. Scipy 和Numpy一样,scipy是Python的另一个核心模块,可用于图像的基本处理和加工。 特别是子模块scipy.ndimage提供了可在n维NumPy数组上运行的函数。该包目前包括线性和非线性滤波法、二值图像形态学、B样条插值和对象测量等功能。 用处:使用SciPy的高斯滤波对图片进行模糊处理: from scipy import misc,ndimage face = misc.face()blurred_face = ndimage.gaussian_filter(face, sigma=3)very_blurred = ndimage.gaussian_filter(face, sigma=5) #Resultsplt.imshow()4. PIL/ Pillow
PIL (Python Image processing Library) is a free Python programming language library that supports opening, processing and saving image files in multiple formats. But its development has long been stagnant, and the latest release was in 2009. Fortunately, there is Pillow, an actively developed branch of PIL, and it is easier to install, runs on all major operating systems, and supports Python 3. The library includes basic image processing functions such as point manipulation, image filtering using a set of built-in convolution kernels, and color space conversion.
Use: use ImageFilter in Pillow to enhance the image:
From PIL import Image, ImageFilter#Read imageim = Image.open ('image.jpg') # Display imageim.show () from PIL import ImageEnhanceImageEnhanceenh = ImageEnhance.Contrast (im) enh.enhance. 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 interface of OpenCV. OpenCV-Python is not only fast because the background is made up of code written in C / C + +, but also because the front-end Python wrapper makes coding and deployment easy. Therefore, it has become an excellent choice for computing-intensive computer vision programs.
Utorials
Usefulness: in the image below, OpenCV-Python uses the image pyramid in image fusion to create a new fruit called 'Orapple'.
6. SimpleCV
SimpleCV is also an open source framework for building computer vision applications. With SimpleCV, you can access several high-performance computer visual libraries such as OpenCV without prior knowledge of bit depth, file format, and color space. Its learning curve is much smaller than that of OpenCV, and as its slogan goes, "SimpleCV makes computer vision easier." The advantages of SimpleCV are:
Even junior programmers can write simple machine vision tests.
Cameras, video files, images and video streams are all interoperable
Use:
7. Mahotas
Mahotas is another computer vision and image processing library in Python, which contains traditional image processing functions such as filtering and morphological operations, and modern computer vision functions such as point of interest detection and local descriptors for feature computing. The interface uses Python, which is suitable for rapid development, but the algorithm is implemented by C + +, and the speed is adjusted. The Mahotas library is fast because of its simple code and minimal dependencies.
Usefulness: the Mahotas library does its work with simple code. For the problem of "finding Wally", Mahotas solves it well and has the least code.
8. SimpleITK
ITK or Insight Segmentation and Registration Toolkit is an open source cross-platform system that provides developers with a complete set of software tools for image analysis. Among them, SimpleITK is a simplification layer based on ITK, which aims to facilitate its application in rapid prototyping, education and interpretation language. SimpleITK is an image analysis toolkit with a large number of components that supports general filtering operations, image segmentation and image registration. SimpleITK itself is written in C + +, but can be used in a variety of programming languages, including Python.
Usefulness: the following animation is used to visualize the strict CT / MR positioning process using SimpleITK and Python.
9. Pgmagick
Pgmagick is a Python-based wrapper for the GraphicsMagick library. The GraphicsMagick image processing system is sometimes called the Swiss Army knife for image processing. It provides a powerful and efficient set of tools and libraries that support reading, writing, and manipulating more than 88 image formats, including important formats such as DPX,GIF,JPEG,JPEG-2000,PNG,PDF,PNM and TIFF.
Usefulness: the amount of image processing that can be done with pgmagick is limited, including:
(1) Image zooming:
(2) Edge extraction:
10. Pycairo
Pycairo is a set of python packages for the graphics library cairo. Cairo is a 2D graphics library for drawing vector graphics. Vector graphics are interesting and their sharpness is not affected when resized or transformed. Pycairo can call the cairo command from Python for cairo.
Useful: Pycairo can be used to draw lines, basic shapes, and radial gradients:
This is the end of the content of "what tools does Python have to make the image simple, intuitive and attractive"? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.