Member-only story
RGB Color Image Compression Using Principal Component Analysis
PCA in Action for Dimensionality Reduction
Previously, we’ve discussed how we can use PCA to compress grayscale images in the MNIST digits dataset. You can read that article here.
This is an advanced version of the previously published article. This time, we apply the same concepts to compress an RGB color image, not a grayscale image.
The difference between RGB and grayscale images
The primary difference between RGB and grayscale images is the number of color channels that the image has. An RGB image has three color channels: Red, Green and Blue while a grayscale image has only a single color channel.
Another difference is the representation of RGB and grayscale images in ML and DL. A grayscale image is represented by a two-dimensional (2D) NumPy array. It can also be represented by a flattened one-dimensional (1D) NumPy array.