Cry over spilled milk no more – Axis cameras to the rescue
2025-04-22
Post by:

A large international company in the dairy industry utilizes Axis cameras integrated directly with their SCADA (Supervisory Control And Data Acquisition) system to detect and prevent milk leakage, saving up to dozens of tons (!!) of milk per incident. No need to cry over spilled milk when a simple technical solution can prevent it!
I’ve previously written about how Axis keeps me engaged after 11 years (this year: 13 years—still engaged!) and how Axis devices are small, friendly Linux devices that make it possible for you to add any software you want (within the limits of their processing power and storage capacity). In those Engineering at Axis blog posts, I also wrote about the importance of meeting customers in their environment and how Axis devices can be integrated into industrial control systems. Now as all that sounds good, it means little without tangible real-world examples from the field. Here is the story of how Axis cameras became milk leakage detectors:
A visit two years ago to a forest industry site sparked the creation of the color checker ACAP application (an application I have also mentioned briefly in one of those previous blog posts). The challenge was to monitor the state of an important and expensive analog machine with a status lamp without modifying the machine, or else the warranty would be voided. Since an Axis camera can solve that with only a few lines of custom code, I went back to the office and developed the color checker as a proof-of-concept: The application monitors a predefined area for a specific color (with adjustable tolerance), the area then being the status light, and returns a true/false value. To make it possible to integrate easily with industrial control systems, I chose an OPC UA backend. OPC UA aims to be—and in fact also is— the common communication standard within the industrial control field. Using an OPC UA backend in the color checker application enables direct communication with industrial control systems, which means the application becomes a plug & play component for the manufacturing and process industry.
The color checker uses the OpenCV library to do the image calculations and the standard library open62541 for the OPC UA connectivity.
Most of the application’s (quite small amount of) source code handles configuration options: choosing the area to monitor, setting the target color, and how much the measured mean color value is allowed to differ but still be considered a match. The application has a configuration web UI that looks like this:

With the configuration in place, and the image processing output from OpenCV, the core of the application pretty much boils down to just these four lines of code:
const auto colordiff_r = abs(color_.val[R] - currentavg.val[R]);
const auto colordiff_g = abs(color_.val[G] - currentavg.val[G]);
const auto colordiff_b = abs(color_.val[B] - currentavg.val[B]);
return (tolerance_ > colordiff_r && tolerance_ > colordiff_g && tolerance_ > colordiff_b);
I have a colleague who wisely advocates for always having a clear use case that your technology addresses. If it solves one solid problem, chances are it will solve other problems too. Conversely, technology without a clear purpose is unlikely to suddenly find one. The color checker application is a perfect illustration of this principle:
Coming from the real use case of monitoring control lights, it quickly turned out that Axis’ inventive Sales Engineers found more use cases for this application. Monitoring colors of fluids in process industry was the first one, followed by garbage flow in waste management. And then milk.
Milk? Yes, that is the question I posed to our Field Sales Engineer who asked me if I thought the color checker would be a good choice for monitoring milk. Or, rather, the undesired event of leaking milk in dairies. Could a camera monitor the floor in a dairy and warn if the color of the floor was no longer the expected (but rather filling up with milk)? My response to this Field Sales Engineer colleague was “why not, try and see if it works!”. If it does work, we’ll have a very simple solution to a big and expensive problem. And if it does not work, we’ll learn something from that. Win-win.
The nice and solution-oriented engineers at the dairy company installed the color checker application from Axis’ GitHub space and connected it directly to their SCADA system that talks OPC UA. They calibrated the color of the floor, and some time later we received feedback: not only did it work, it also worked really well and they were super happy.
So here we have a customer that, thanks to purchasing Axis cameras with the capabilities and possibilities that brings, could use a free, unmodified, very lightweight piece of additional example software to create a milk leakage sensor that was easy to integrate directly into their industrial control system.
That’s when the engineer is happy, when technology can make life better. But what does this mean in terms of money? I went online and found public milk price data: As of April 2025, the dairy companies in our part of the world pay a bit more than 6 SEK for one kilogram of milk. This means 10 tons of milk cost them more than 60,000 SEK. Then imagine some dozens of tons: that quickly adds up to substantial money! One liter of low-fat milk retails, as of April 2025, for 15.50 SEK in Swedish grocery stores. Now I don’t know how much they pay the dairy companies per liter, but certainly there is some revenue involved here that would be lost in the event of a milk leak. In the milk leak prevention business, an Axis camera quickly returns the investment!
From a business perspective, this shows how an application like the color checker together with Axis cameras offers a powerful, cost-effective solution for industries like dairy, where preventing product losses can have a significant impact on the bottom line. By leveraging the capabilities of our cameras and the power of open standards like OPC UA, we can help businesses like these protect their investments and improve operational efficiency.
For me as an engineer, it’s rewarding to solve real problems in the field with simple yet effective solutions. Meeting customers, understanding their needs, and addressing them with practical ideas is very valuable, providing valuable insights to bring back as input to the research and development work at the office. I enjoy discovering new ways to apply our existing products and integrating Axis devices into different systems. It’s fulfilling to collaborate with colleagues from both my own department and others, such as our Key Account Managers and Field Sales Engineers, and to see and know that my contributions make a difference.
Would you like to work with these kinds of things too? We are constantly looking for skilled engineers to join our team and the rest of the company. Please keep an eye open on our career page or check out any open positions here.