I need to find out the word in an image where user has clicked. So far i have succeeded in OCRing the image. I have a picturebox control in my c# app. user can draw a box around any text and drag it to a textbox to fill the textbox with it. I have completed this. But now i have a new requirement saying user can select a textbox and then click on a word in the image so that the word is filled in the text box.
I have no clue on how to proceed. How can i cut the word portion alone from the image and give it to OCR. User can click on any part of the word.
Please give me any pointers. What algorithm should i follow to find the boundaries of the word on which user clicks. IF i found the boundaries i can cut it from the im开发者_如何学编程age using copyfromscreen method and will give it to ocr engine to get the text.
Hope i made my problem clear here.
Thanks and Regards, Dinesh.
If you have the OCR working, my initial approach would be to attempt some sort of search centering on the initial click point.
Ie. Make a small box around where the user clicked, OCR, if all noise, make a bigger box, OCR, repeat until the OCR results in a hit.
If you've got the OCR data, depending on the OCR library, you might be able to perform a reverse lookup and determine the character at the specified pixel coordinates. The OCR libraries I've worked with provide rectangle coordinates for each character, which in turn can be grouped into words (combining the rects). The problem then is simply to determine inside which rectangle the click occurred.
精彩评论