I plan to detect endpoints of lines generated from characters (OCR) in C#. I want something like this:
What I mean by "endpoint" is I want to get the ends of any lines in the characters... for example a 'C' has two endpoints (one at the top and one at the bottom) as seen in the above image represented as a red pixel. I can extract the single lines from the "fatter" existing scanned characters, I can do edge detection and also Flood-fill analysis, but I can't seem to replicate the above! Any pointers to articles or existing code would be much appreciated! Any code samples will be fine as I can easily convert C++ or any .NET language to C#.
Thanks, Josh
Since you don't have a definition of "endpoint" yet, I suggest:
Finding the angle to each neighboring black point should not be too difficult. Sorting these angles and finding the range is also not difficult, although you need to be careful of the discontinuity (where the angle suddenly changes by 360 degrees). It may be slightly faster to sort by slope without actually calculating angle. An additional speedup can be obtained with early-exit logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With