One exciting application of *k*-means clustering is the compression of image color spaces.
Although True-color images come with a 24-bit color depth (allowing 16,777,216 color variations), a large number of colors within any particular image will typically be unused—and many of the pixels in the image will have similar or identical colors.
In this post I am going to show you how you can use *k*-means clustering via OpenCV and Python to reduce the color palette of an image to a total of 16 colors.

##
Saturday, July 29, 2017

### How to compress color spaces using k-means clustering

##
Thursday, July 20, 2017

### Machine Learning for OpenCV now available

My new book Machine Learning for OpenCV is now available via Packt Publishing Ltd. The book features 382 pages filled with machine learning and image processing goodness, teaching you how to master key concepts of statistical learning using Python Anaconda, OpenCV, and scikit-learn.

This will be an introductory book for folks who are already familiar with OpenCV, but now want to dive into the world of machine learning. The goal is to illustrate the fundamental machine learning concepts using practical, hands-on examples.

As always, all source code is available for free on GitHub. The book is packed with examples on how to implement different techniques in OpenCV—such as classification, regression, k-NN, support vectort machines, decision trees, random forests, Bayes classifiers, k-means clustering, and neural networks.

By the end of this book, you will be ready to take on your own Machine Learning problems, either by building on the existing source code or developing your own algorithm from scratch!

**Get it while it's hot! In fact, if you act fast you can get the book for $10 on Packt's website as part of their Skill up sale!** Or get it on Amazon and leave a review to tell me what you think!

The foreword to the book was written by Ariel Rokem, Senior Data Scientist at the University of Washington eScience Institute, a close colleague, collaborator, and mentor of mine. You can find out what he has to say about this book here.

The outline of the book is as follows:

- A Gentle Introduction to Machine Learning
- Working with Data Using OpenCV and Python
- First Steps in Supervised Learning
- Representing Data and Engineering Features
- Using Decision Trees to Make a Medical Diagnosis
- Detecting Pedestrians with Support Vector Machines
- Implementing a Spam Filter with Bayesian Learning
- Discovering Hidden Structures with Unsupervised Learning
- Using Deep Learning to Classify Handwritten Digits
- Combining Different Algorithms into an Ensemble
- Selecting the Right Model with Hyperparameter Tuning
- Wrapping Up

Stay tuned for example chapters and code samples!