Message Boards Message Boards

1
|
6415 Views
|
7 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Extracting digits from the image a hydrometer dashboard

Posted 11 years ago
Hi !

I am trying to pick the numbers that an hydrometer shows, but the images generally are blurry and not so perfect...
I intend to have  a monthly data set of the water consuption, automactly done through an mathematica code.


So I have 2 challenges: 

1 - cleaning (using filters) the pics
2- taking just the numbers that are shown through the metering reading.

Any suggestion?


I use an very cheap smartphone, 5 megapixels of resolution.
(how  can I attached images here??)
POSTED BY: Marcelo De Cicco
7 Replies
If the camera doesn't move you could just crop a hand made mask around it and then use TextRecognize[] to read off the numbers themselves.
Hi folks!

First I´ll try Perdesen´s suggestion.
POSTED BY: Marcelo De Cicco
I used the following code:
i= image....

table = Transpose@
   {{"Gaussian", GaussianFilter[i, 5]},
    {"bilateral", BilateralFilter[i, 5, .1]},
    {"gradient", GradientFilter[i, 5] // ImageAdjust},
    {"Gabor", GaborFilter[i, 5, {1, 1}] // ImageAdjust}};
Row[MapThread[Panel[#2, #1, ImageSize -> 200] &, table]]
So I can choose the best Image X filtering

And the then It seems to me that
{"Gaussian", GaussianFilter[i, 5]}
It works fine. See te last picture.

But now I want to get the numbers, how ?
POSTED BY: Marcelo De Cicco
Posted 11 years ago
Hello Marcelo,

I am no expert on this area, but how about aquirering an excerpt or "template" of each individual number on the hydrometer (From 0-9)? Therenext supply it to ImageCorrelate[]. Get the result of ImageCorrelate[], Binarize, ColorNegate, and finally supply it to MorphologicalComponents. Using MorphologicalComponenets, it seems you can get the locations using ComponentMeasurements[] (http://reference.wolfram.com/mathematica/ref/ComponentMeasurements.html?q=ComponentMeasurements&lang=en).  That shoult at least, if you're lucky and I am correct, give you the position of the numbers. That might make them easier to isolate :-)
POSTED BY: Simon P.
Hello Marcelo,

The Wolfram Broadcast
 
contains a very impressive example where Markus van Almsick demonstrates a method of extracting notes from an image of a musical score.  It is worth watching even if it doesn't solve your problem perfectly. Also, you may be able to utilize the TextRecognize function after a bit more image pre-processing.
POSTED BY: W. Craig Carter
Hi Vitaly, I have been testing the filters. And also I read the tutorials and guides. But I am litlle confuse to use morphological imaging to pick the numbers. I am attaching the image.



And now what I got after some tries. How to isolate the numbers?

POSTED BY: Marcelo De Cicco
For pasting images into posts, please see this guide. For improving images you could start from basic functions like Sharpen and ImageAdjust. If more sophisticated filters are needed you may want to take look at the guides and examples in Image Processing & Analysis . 
POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract