Skip to content

Instantly share code, notes, and snippets.

@cancan101
Created May 1, 2014 23:48
Show Gist options
  • Save cancan101/e19982815e4d3b2b3b95 to your computer and use it in GitHub Desktop.
Save cancan101/e19982815e4d3b2b3b95 to your computer and use it in GitHub Desktop.
Automatic perspective correction for quadrilateral objects
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mistiansen
Copy link

Hello,

I have tried running this but it only ever finds one line in the card. Specifically, it grabs the right edge of the card. Do you have any thoughts as to what could be causing this?

@RAMIRO-GM
Copy link

RAMIRO-GM commented Nov 13, 2018

As lines has shape of (x,y,z) we have to iterate in to two for loops, as well as indicate inside of the HoughLinesP arguments th np.array[], as it follows:

lines = cv2.HoughLinesP(bw_canny, 1, np.pi/180, 70, np.array([]), minLineLength=30, maxLineGap=10)
line_image = np.copy(image)
for line in lines:
for x1,y1,x2,y2 in line:
cv2.line(line_image,(x1,y1),(x2,y2),(255,0,0),3)

@sumit1996
Copy link

I am also getting line in right part of the image. Any solution for that?
@RAMIRO-GM , @mistiansen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment