Ask Your Question
0

how to enhance text in this image

asked 2019-07-23 16:31:03 -0600

aspenlin gravatar image

updated 2019-07-24 08:26:45 -0600

I have an image here: image description

How do I enhance the text in this image?

I tried the below:

img = cv2.imread(imgpath, 0)

height, width = img.shape[0], img.shape[1]

scale = 2000/width

img = cv2.resize(img, (0,0), fx=scale, fy=scale)

img = cv2.adaptiveThreshold(img,255,cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY,11,21)

But no matter how I adjust the parameters (block size and constant, 11 and 21 above), I couldn't enhance the text in these images well. Does anyone know a good way to do this? I'm using opencv-python. Thanks very much for your help.

edit retag flag offensive close merge delete

Comments

1

please insert your image in question not with an external link

LBerger gravatar imageLBerger ( 2019-07-24 00:05:04 -0600 )edit

I don't think adaptivethreshold can help you because background is uniform. Try a gaussianblur with sigma=0.35 and automatic threshold using OTSU

result : image description

LBerger gravatar imageLBerger ( 2019-07-24 09:35:32 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-07-24 03:41:44 -0600

Ziri gravatar image

updated 2019-07-24 03:42:41 -0600

Try Contrast Limited Adaptive Histogram Equalization CLAHE before thresholding.

edit flag offensive delete link more

Comments

Tried that already. What I need is more specific guide about how to tune the parameters.

aspenlin gravatar imageaspenlin ( 2019-07-24 08:28:33 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-07-23 16:31:03 -0600

Seen: 2,030 times

Last updated: Jul 24 '19