Ask Your Question

How to remove border of microsoft word in text image in opencv ?

asked 2017-10-17 07:18:24 -0500

swan gravatar image

I have this picture which the border make by Microsoft word office : image description

I want to remove the border make by Microsoft word office to be like this : image description

so how I can do it ?

edit retag flag offensive close merge delete


In Microsoft Office i don't know ;) but the simples static way using OpenCV is to define a mask, where the inner region (where the text is) is set to 0 and the outer region (where the stripe is) is set to 255. Afterwards call image.setTo(Scalar(255,255,255), mask);

VxW gravatar imageVxW ( 2017-10-17 08:01:34 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-10-17 09:51:41 -0500

moHe gravatar image

I've two ideas, hope they can help you. 1. Use houghline to find the three lines, and then draw white bars to do the cv2.bitwise_or() with the original image to do away with the three borders. 2. Since there are always 3 borders, you can vertically search the image, and count the pixels line by line. Once current line has black pixels, you get the the vertical axis Y, and then draw the white bar as in idea1 for a accent linewidth to cover the horizontal line. And then do the same action to the two vertical borders. I hope these can help you.

edit flag offensive delete link more


greate idea , I will try , thanks for your help

swan gravatar imageswan ( 2017-10-17 12:08:32 -0500 )edit

Question Tools

1 follower


Asked: 2017-10-17 07:18:24 -0500

Seen: 622 times

Last updated: Oct 17 '17