I tried everything including the Hough Transform with different inputs; Laplacian and Sobel and Canny edge detector were run on filtered image but cv2.HoughLinesP and cv2.HoughLines both give me wrong answers. For example, I am able to get the following image: enter image description here

However, I can't get the line from this image though HoughLines from cv2. I even tried dilating the image which would make the lines more bolder but nothing.

Source image is:

enter image description here

  • $\begingroup$ do you have a chance to correct the lens distortion prior to line detection? would make your lines become straight lines $\endgroup$ Commented Jul 9, 2021 at 18:09
  • $\begingroup$ Unfortunately, I don't; You are right, the lens is distorted so that's making problem. I tried some more complicated hand-made filters and it seemed to work for now. $\endgroup$
    – Alex
    Commented Jul 10, 2021 at 16:32
  • $\begingroup$ Do you have a better sample of the image (The file itself)? $\endgroup$
    – Royi
    Commented Jul 18, 2021 at 15:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.