1

This will be a long question to make clear my point, I hope you can understand it :)

So I am making an app to write letters correctly, and to test if the letter is correctly drawn I use an algorithm that count the pixels and does the math.

The problem is that the algorithm doesn't work so well as I was wondering, so I will explain.

Here is the image before draw:

Letter before draw

Then I ask the user to draw the letter as the image shows, and suppose he draws something like this:

Letter after draw

The algorithm should say that the letter was successfully written.

This is how I am using the algorithm now:

int letterGreyPixels = 0;
int letterYellowPixels = 0;

// Then I count the letterGreyPixels before draw
// After the draw I count the letterYellowPixels


float percentage_yellow_on_grey = (float) letterYellowPixels/letterGreyPixels

//Then I count the percentage of yellow pixels on the grey pixels of the letter, and I test if its above 60%, and if it is, I say that the letter matches correctly


**//BUT there is a problem ! the user can easily do a drawn like this one:** 

Letter partial filled

And the algorithm will say: "oh yes, the percentage of yellow pixels on the grey pixels are above the 60% ! But the letter is not well drawn"

Did you guys understood?

I can't make the algorithm like this, there must be a better way to calculate the matching of the letter.

Can someone advice me?

Thanks a lot in advance ;)

Petros Koutsolampros
  • 2,790
  • 1
  • 14
  • 20
TiagoM
  • 3,458
  • 4
  • 42
  • 83
  • 1
    Why don't you just use a higher threshold? – Mohsen Kamrani Mar 19 '14 at 10:58
  • 1
    One problem is that you don't calculate the percentage of yellow pixels regionally. For example: in *every* grey area (e.g a rectangle with a certain width) inside the shape, there's at least a certain number of yellow pixels. – Mahm00d Mar 19 '14 at 11:09
  • I can't use a higher threshold because that will be harder to draw would demand for to draw twice or maybe more times. Because I can't increase the width of the stroke, because would make the draw to be outside of the region.. – TiagoM Mar 19 '14 at 11:14
  • Mahm00d that is an interesting solution, can you give some more details ? – TiagoM Mar 19 '14 at 11:15
  • wont that be too much for an android tablet process ? – TiagoM Mar 19 '14 at 11:17

0 Answers0