This applications main objective was to count the number of objects of a certain kind placed on the surface. May be say the number of pennies, quarters, coins, pills, pencils. It was pretty much straightforward though things became intense when we actually started the adventure. It was an app for the aged, since it is very difficult for them to determine if they have taken up the correct number of pills in a day.

There were some couple of assumptions to make down the line therefore.
1. The surface had to be plain
2. The mobile had to be kept at a distance in order to capture all the data present before it
3. There should have been good lightning conditions

I will talk about each one of them and why it was necessary to make these assumptions. But before that , I will talk about the processing that was done on the raw (captured image).

OpenCV was used in this application, which existed in both the native c form and even as a jni library. The java wrapper sdk is what we used. And hough transforms which have hough circle as a method too. So i will just brief the steps performed on the image.

  1. Convert the colored image to black and white
  2. Perform gaussian blur in order to remove noise
  3. Perform edge detection
  4. Count the edges which form a circle using HoughCircles or count the semi circles formed or even the ovals.

In order to perform a count of coins including pennies and quarters, a radius is used which covers all the different kinds of circular objects.

So, this brings us to the assumptions:
#1. It is necessary for the surface to be plain since it it contained patterns there were chances that the patterns would be converted to edges which would be considered as the target if it were circular, semi-circular or even oval in shape.

#2. It is important that the device be kept at a distance in order for the targets to be captured correctly. Else you might have one pill next to the corner of the camera surface edge and you might miss it completely when performing image processing

#3. Lastly, lightining conditions matter since we perform image processing. Image there was less amount of brigtness, then in that case converting an image to black and white would have been really dark, and also when performing gaussian blur and sharpenning the dark object would have merged with the surface, thus negating your chances of considering that target.

It would have been possible to get a solution to these, if at all Native C or NDK was used with chances of modifying OpenCVs code to suit the needs.

This is not available on the playstore.

Advertisements