Coffee Data Science
Imaging to Evaluate Coffee Roast Consistency
A quick look at the HSV domain
A few years ago, I started to look at evaluating coffee roasts with imaging. I know there are color meters, and those have become more prevalent and cheaper. For my own efforts, I ran into some major challenges at the onset, so I didn’t pursue my own algorithm. However, we can talk about what I started with and why I ultimately didn’t move forward.
I originally started this investigation in 2021, and I took these images, but writing this article fell in the backlog as a lower priority.
From an imaging standpoint, I wanted to make life easier, so I added a blue ellipse to define the boundary I was interested in.
Then I isolated the desired area, and I look at the RGB and the HSV color space. HSV stands for Hue, Saturation, and Value (brightness). The beans look really wild when you then display the HSV planes as Red, Green, and Blue:
We can focus on false color of just Hue and Saturation because they have a bunch of interesting things going on.
We can adjust saturation to give more contrast. Some darker beans show up as well as some lighter beans in color saturation.
Then I looked at the histograms of RGB and HSV. Intensity is pretty flat for HSV, but Saturation and Hue have some nice curves.
Challenges to Imaging Coffee Beans
I stopped this investigation because there were some lighting challenges to overcome, and I had higher priority interests. Here are some challenges for imaging coffee beans:
- Controlled and consistent lighting conditions
- No shadows caused by the camera
- Separating chaff from beans in the image
- Distinguishing between the top and bottom of the bean
DiFluid and a few others have come out with coffee bean color analysis using an enclosed capture setup. I love these and think they are great.
The one area I am missing though is an app to help find quakers quickly either in RGB or HSV domain. This would be helpful in picking out beans after roasting especially if it was live so I could see it. Probably a great use-case for a head-mounted display or with a live feed so you can more easily pick out the quakers.
If you like, follow me on Twitter, YouTube, and Instagram where I post videos of espresso shots on different machines and espresso related stuff. You can also find me on LinkedIn. You can also follow me on Medium and Subscribe.
Further readings of mine:
My Second Book: Advanced Espresso
My First Book: Engineering Better Espresso