aperrault / DetectText

Detect text with stroke width transform.
GNU General Public License v3.0
331 stars 150 forks source link

in line 528... and after #5

Open gszeleczki opened 10 years ago

gszeleczki commented 10 years ago

...&&((_ptr)/right <= 3.0 || right/(_ptr) <= 3.0)

Correct me if I am wrong, but this is always true. If You have two real numbers, like 'a' and 'b', a/b or b/a should be less than 1. I think because of this, things get connected which should not be, and we will have huge components.

achalddave commented 10 years ago

:+1: This definitely seems to be the case. It seems like you want to check to make sure the values are close to each other, but I'm not sure if that's what they're trying to do.

Perhaps ((*ptr) / right <= 3.0) && (right / (*ptr) <= 3.0)? This would ensure that (*ptr) and right are within a factor of 3 of each other.

aperrault commented 10 years ago

I believe that @achalddave has it right. You will probably need to adjust the other filters if you make this change. I haven't had a chance to test it.

The other piece of feedback I've gotten is to add a check for a minimum height on each component (line 697).

achalddave commented 10 years ago

I've also had luck with eroding the components by a small value and seeing if they still exist; this is not in the paper, but it performed better than the height check as it also gets rid of thin diagonal lines (https://github.com/achalddave/Kannada-Text-Detection/commit/ba0eb48003d55e81201af64c5608f7227f01cf8c)