Ask Your Question

bohdan.inhliziian's profile - activity

2020-04-06 14:14:36 -0600 received badge  Notable Question (source)
2019-11-10 20:56:32 -0600 received badge  Popular Question (source)
2018-10-17 06:27:10 -0600 commented answer Line detection with OpenCV Python and Hough transform

Thank you so much! I am confused of it, mistake in argument maxLineGap.

2018-10-17 06:26:13 -0600 received badge  Supporter (source)
2018-10-17 06:25:40 -0600 marked best answer Line detection with OpenCV Python and Hough transform

I am trying to detect table lines and extract full table from an image with Python OpenCV and with Hough Transform algorithm. I need to have all coordinates of each line with the aim for draw the same table with same proportions. I understand theory how Hough transform works and tried to implement it without OpenCV, but it is very slow on big images.

Here is the code from example OpenCV Hough Transfrom

import cv2
import numpy as np

img = cv2.imread('image1.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 50, 150, apertureSize=3)
cv2.imshow("image", edges)
cv2.waitKey(0)
minLineLength = 100
maxLineGap = 10
lines = cv2.HoughLinesP(edges, 1, np.pi / 180, 50, minLineLength, maxLineGap)
for line in lines:
    for x1, y1, x2, y2 in line:
        cv2.line(img, (x1, y1), (x2, y2), (0, 255, 0), 2)

cv2.imwrite('houghlines5.jpg', img)

Canny edge detection returned an image Canne edge detection

But the result of detection is Resulf of Housh Transform

I do not know why Hough Transform left some lines of the table. Can you recommend something to do? Maybe another way to extract table from image? Thank you!

2018-10-17 06:25:40 -0600 received badge  Scholar (source)
2018-10-15 07:03:24 -0600 edited question Line detection with OpenCV Python and Hough transform

Line detection with OpenCV Python and Hough transform I am trying to detect table lines and extract full table from an i

2018-10-15 07:00:38 -0600 received badge  Editor (source)
2018-10-15 07:00:38 -0600 edited question Line detection with OpenCV Python and Hough transform

Line detection with OpenCV Python and Hough transform I am trying to detect table lines and extract full table from an i

2018-10-15 07:00:12 -0600 asked a question Line detection with OpenCV Python and Hough transform

Line detection with OpenCV Python and Hough transform 0 down vote favorite I am trying to detect table lines and extract