Being able to check how clean your water is, is crucial for many people - especially people in developing countries that often lack access to clean water sources. However, test sticks covered with chemicals that change color depending on the properties of the water (like the famous Litmus test for the ph-value) are very cheap to produce and easy to use. However, reading out the correct values can be a bit tricky and since many people actually own smartphones anyway we wanted to come up with a way to combine the two.

What it does

Our App automates the process of reading out the values from the color coding of a mock up test stick. Just focus with your camera and the app will tell you the ph-value associated with the sample you provided.

How we built it

We used OpenCv in C++ for the technical part of the app. First we normalize the input image (similar to what happens when you scan QR codes). This means that even slightly tilted or rotated input works fine with the algorithm (most of the time :P). As the next step we extract the color values from the normalized image by averaging over certain areas.

We have stored a table containing color codes for various chemicals and ph values, so that then we are able to perform a simple optimization in order to find the ph value that matches the theoretical data best.

The app itself is written in a mix of Swift 3 (for the interface) and ObjectiveC (to communicate with our C++ code).

Challenges we ran into

Neither of us had experience in mobile development, so getting to grips with Swift and ObjectiveC was a struggle. Doing a whitebalance like color correction for bad lighting was also harder than expected.

Accomplishments that we're proud of

Writing our first app and being able to do realtime image processing of a video feed on mobile device.

What we learned

Basics of image processing with OpenCV and mobile app development.

What's next for WhatTheColor

We'd like to improve the accuracy for the normalization of the image, both the perspective and the color.

Built With

Share this project: