How scan document without edges?

asked 2018-01-29 04:39:20 -0600

gyb001 gravatar image

Hello. I would like to make a document scanner but unfortunately, in my images don't have edge of paper.

I tried find edges, but it inst enough.

Someone have any idea how it's possible?

image = cv2.imread('2.jpg')
image = cv2.resize(image, (1500, 880))
orig = image.copy()
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (30,30))
closed = cv2.morphologyEx(blurred, cv2.MORPH_CLOSE, kernel)
edged = cv2.Canny(closed, 0, 100)
orig_edged = edged.copy()

(_,contours, _) = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
contours = sorted(contours, key=cv2.contourArea, reverse=True)

...

this image description

edit retag flag offensive close merge delete

Comments

what is your next step when you scan the document?

sturkmen gravatar imagesturkmen ( 2018-01-29 04:45:04 -0600 )edit

I would like to do something like this [link text] (https://github.com/vipul-sharma20/doc...) After I select the paper, I will split the image, and use the ocr, to read data.

gyb001 gravatar imagegyb001 ( 2018-01-29 04:51:30 -0600 )edit