Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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