Many ways to process images in Python.
- Other libraries to open propriatery images like - czi, OME-TIFF
Pillow is an image manipulation and processing library. You can use pillow to crop, resize images and to do basic filtering. For advanced tasks that require computer vision or machine elarning we have other packages such as openCV, scikit image and scikit learn.
Matplotlib is a plotting library for the Python programming language. Pyplot is a Matplotlib module which provides a MATLAB-like interface. Pyplot is commonly used not just to generate plots and graphs but also to visualize images because visualizing images is nothing but plotting data in 2D.
Scipy is a python library that is part of numpy stack. It contains modules for linear algebra, FFT, signal processing and image processing. Not designed for image processing but has a few tools
scikit image is an image processing library that includes algorithms for segmentation, geometric transformation, color space manipulation, analysis, filtering, feature detection, and more. A very good package for traditional machine learning, using Random forest or SVM.
openCV is a library of programming functions mainly aimed at computer vision. Very good for images and videos, especially real time videos. It is used extensively for facial recognition, object recognition, motion tracking, optical character recognition, segmentation, and even for artificial neural netwroks.
You can import images in color, grey scale or unchanged using individual commands
- cv2.IMREAD_COLOR : Loads a color image. Any transparency of image will be neglected. It is the default flag.
- cv2.IMREAD_GRAYSCALE : Loads image in grayscale mode
- cv2.IMREAD_UNCHANGED : Loads image as such including alpha channel
Instead of these three flags, you can simply pass integers 1, 0 or -1 respectively.
Note: OpenCV represents RGB images as multi-dimensional NumPy arrays, but as BGR.
we can convert the images from BGR to RGB
We can also change color spaces from RGB to HSV..