Image Processing: Color Conversions
Published in
5 min readApr 24, 2022
Image processing is needed in many applications. This article (and several to follow) is dedicated to highlighting how to perform classic image processing techniques in Python. Specifically, in this article, we will cover some color conversions/separations:
- Take a Red-Green-Blue (RGB) image as input into Python and separate individual color channels
- Recombine RGB color channels to reconstruct the initial image
- Convert an RGB image and convert it to a grayscale image in Python
- Convert an RGB image to a Hue-Saturation-Value (HSV) image in Python. Note, sometimes HSV is referred to HSI Hue-Saturation-Intensity
Our input image will be an image of one of the desserts I’ve made (see below) and took a photo of-crème brûlée!
Load Image
We will need to import libraries numpy and matplotlib.pyplot. Reading in images, can be done using the command: plt.imread. Images can be in .png, .tif, .jpg, or .svg formats.
# load our libraries:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure