Simple real-time detection of documents in images using Canny Edge Detection, Hough Transform and Depth First Search.
To install, use pip
or easy_install
:
$ pip install --upgrade docdetect
or
$ easy_install --upgrade docdetect
TBD
Process an image
:
import docdetect
rects = docdetect.process(image)
image = docdetect.draw(rects, image)
Process a video
:
import cv2
import docdetect
video = cv2.VideoCapture(video_path)
cv2.startWindowThread()
cv2.namedWindow('output')
while video.isOpened():
ret, frame = video.read()
if ret:
rects = docdetect.process(frame)
frame = docdetect.draw(rects, frame)
cv2.imshow('output', frame)
cv2.waitKey(1)
video.release()