How to use the deskew.Deskewer function in deskew

To help you get started, we’ve selected a few deskew examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BahmniOCR / BahmniOCR / src / image_preprocessing.py View on Github external
def deskew_image(im, pim):
    cornerdetector = CornerDetector(pim)
    corners = cornerdetector.detect_corners()
    for i in range(0, len(corners)):
        corner = corners[i]
        nextcorner = corners[(i + 1) % len(corners)]
        cv2.circle(im, (corner[0], corner[1]), 25, (210, 210, 210), -1)
        cv2.circle(im, (corner[0], corner[1]), 27, (130, 210, 210), 4)
        cv2.line(im, tuple(corner), tuple(nextcorner), (130, 210, 210), 5)
    plt.imshow(im, cmap='gray')
    plt.show()
    deskewer = deskew.Deskewer(im, corners, 1.414)
    transformedimage = deskewer.deskew()
    return transformedimage

deskew

Skew detection and correction in images containing text

MIT
Latest version published 11 months ago

Package Health Score

65 / 100
Full package analysis

Similar packages