2

Hello I want to extract text-blocks from images and pass it to ocr for better accuracy. I have been searching on internet but not able to find suitable example for this. I am very new to this concept can anyone please help me out on the same?

enter image description here

enter image description here

This is what I want to achieve. Note I am using EMGUCV for opencv and ocr. I want to scan receipt mostly. If you can help with that it would be great.

Manoj
  • 2,799
  • 5
  • 30
  • 49
  • Possible duplicate of [Split text lines in scanned document](http://stackoverflow.com/questions/34981144/split-text-lines-in-scanned-document) – Miki Aug 27 '16 at 10:42
  • Also look at [this](http://stackoverflow.com/a/35603061/5008845) – Miki Aug 27 '16 at 10:42

2 Answers2

0

Is your text always in the same location? If yes, you will have the location of the region of interest.

//Create the rectangle
cv::Rect roi(0, 0, 500, 500);
//Create the cv::Mat with the ROI you need
cv::Mat imageRoi = image(roi)

Then you can send to the ocr this images

user1705996
  • 119
  • 1
  • 3
  • 12
  • Hi No it wont be at exact location. I want to scan receipts using ocr. – Manoj Aug 26 '16 at 07:48
  • Do you have any example? – user1705996 Aug 26 '16 at 07:50
  • 1
    This may help you: [link1](http://www.danvk.org/2015/01/07/finding-blocks-of-text-in-an-image-using-python-opencv-and-numpy.html) [link2](http://stackoverflow.com/questions/23506105/extracting-text-opencv) – user1705996 Aug 26 '16 at 08:19
  • I have already looked into those link. Since I am new. I cannot port that code for c#. Can you please help me with that? – Manoj Aug 26 '16 at 09:08
0

You can threshold your image into a binary image. After that you can use the morphologic operation "DILATE" (repeatedly) do join the letters. When the letters are joined us the "findContours()" function to extract the contour and the bounding boy of it.

Sebastian
  • 5
  • 1
  • 4