Goto

Collaborating Authors

 color quantization


Color Quantization -- Using K Means Clustering

#artificialintelligence

In simpler terms, it is the quantization of color spaces. Color spaces are a way to characterize the shade channels existing in the photo that offers the photograph that precise hue. This is a useful image compression technique which is quite useful for devices that can show a limited number of colors due to memory restriction. Each image can be represented by three features: the R, G and B values for each pixel. Given that our image has pixel values ranging from 0 to 255, we can say that each image has 256 * 256 * 256 colors. Our goal now is to reduce the number of colors to a manageable number.


Top 5 AI Articles of February 2022 Every Data Scientist Should Read

#artificialintelligence

I explain Artificial Intelligence terms and news to non-experts. Here are the five best HackerNoon articles related to artificial intelligence in February. I hope they will help you learn more about machine learning this year. Note that the five articles you will see were curated by myself amongst hundred of other super interesting ones that you might enjoy even more. So please feel free to look at the AI tag on HackerNoon and keep learning!


Learn How To Do K-Means Clustering On An Image

#artificialintelligence

If you've ever read anything related to data science, machine learning or data mining, there is a high probability of you coming across clustering. Clustering is a process of classifying data in clusters based on how similar the data is. There are many clustering algorithms. One of the most known is the K-means algorithm. K-means clusters the data into a determined number of clusters.


Turn Photos into Cartoons Using Python

#artificialintelligence

To create a cartoon effect, we need to pay attention to two things; edge and color palette. Those are what make the differences between a photo and a cartoon. Before jumping to the main steps, don't forget to import the required libraries in your notebook, especially cv2 and NumPy. The first main step is loading the image. Define the read_file function, which includes the cv2_imshow to load our selected image in Google Colab.


#007 Color quantization using K-means clustering

#artificialintelligence

Highlight: This post can come as a very interesting and surprising one. You will see how we can apply a machine learning algorithm on the pixel intensity color with a so-called K-means clustering algorithm. In this way, we would be able to create a compressed version of our image that will have much fewer colors. The picture will be preserved in a lower color resolution, whereas the number of pixels will remain the same. This technique is very exciting, so we hope that you will enjoy it.


Color quantization using k-means

#artificialintelligence

The idea is to give a grasp on some concepts that are necessary to understand what comes next without being too much detailed as a more detailed explanation is out of the scope of this post. Feel free to skip these parts if you already know what they're talking about. As previously anticipated a color can be represented as a point in an n-dimensional space called color space. Most commonly the space is 3-dimensional and the coordinates in that space can be used to encode a color. There are many color spaces for different purposes and with different gamut (range of colors), and in each of them it is possibile to define a distance metric that quantifies the color difference. The most common and easiest distance metric used is the Euclidean distance which is used in RGB and Lab color spaces. The RGB (abbreviation of red-green-blue) color space is by far the most common and used color space. The idea is that it is possibile to create colors by combining red, green and blue. A color in RGB is usually encoded as a 3-tuple of 8 bits each, hence each dimension takes a value within the range [0, 255] where 0 stands for absence of color while 255 stands for full presence of color.