novalagung
novalagung

Reputation: 11502

OCR: scan specific part of image

I'm quite new in computer vision, currently learning about google cloud vision SDK using Go. And right now I have one problem.

So I have an image scanned using the DetectTexts() method. The result was great! all of the texts are scanned.

However, I don't actually need all of those texts. I only need some of it. Below is the image I use as a sample. What I want to get is the two blocks highlighted in red.

Images

Result

WE-2
Sam WHO
Time
PM 1:57
SYS
mmHg
mmHg
DIA
mmHg
90
62
82
mmHg
PUL
/MIN
MR AVGA
SET
START
STOP
MEM

I do not know what is the best approach to do it. What's in my mind right now is these approaches:

Can somebody please help what is the correct and best approach to solves this problem?

Upvotes: 2

Views: 1342

Answers (1)

Aaron Jones
Aaron Jones

Reputation: 1170

You mentioned that you were using Go, which unfortunately I dont have any experience with, but I have approached this problem in other languages like Python and C#. What I would recommend is just create an ROI, or Region of Interest. Basically what that means is you would be cropping the image to only the highlighted region that you want to detect text from. Like I said, I'm not entirely sure if you can do that in Go, so you might have to do some raw pixel manipulation rather than just using a member function. I assumed that the position of the regions that you wanted to detect text from would remain the same. If your open to it, you could just create a simple python script that generates a ROI, and pipes the cropped image to GO.

import cv2
img = cv2.imread('inputImg.png')
output = img[c1:c1+25,r1:r1+25]

#You could do something like this
cv2.imwrite("path/to/output/outputimg.png", output)

Upvotes: 4

Related Questions