BusinessCardReader icon indicating copy to clipboard operation
BusinessCardReader copied to clipboard

IndexError: list index out of range (empty good_points)

Open messaoudi-mounir opened this issue 8 years ago • 2 comments

Hello thank you for the code source, i am making some test but i am getni an error

findCard.py", line xxx, in findAndTransform uLeft = uLeftOrder[0] IndexError: list index out of range

good_points is always empty

Can you please help Regards,

messaoudi-mounir avatar Jun 21 '16 12:06 messaoudi-mounir

Hi @messaoudi-mounir, I'm having same issue, tried a bunch of different cards from the Stanford library linked. Did you ever solve this?

davidworkman9 avatar May 02 '18 20:05 davidworkman9

I have solved this issue. Here my solution: In "findAndTransform" function, add one more loop before "for rho, theta in lines[0]" and aslo replae "lines[0]" by "each_line". Fixed code below:

lines = cv2.HoughLines(processed, 1, 2 * np.pi / 180, 33)
my_lines = []

for each_line in lines:
    for rho, theta in each_line:
        a = np.cos(theta)
        b = np.sin(theta)
        x0 = a * rho
        y0 = b * rho
        x1 = int(x0 + 1000 * (-b))
        y1 = int(y0 + 1000 * (a))
        x2 = int(x0 - 1000 * (-b))
        y2 = int(y0 - 1000 * (a))
        # making list of all Hough lines found
        foundLine = line(np.array([x0, y0]), np.array([x1, y1]))
        if foundLine == False:
            continue
        else:
            my_lines.append(foundLine)

hungzr avatar Aug 06 '19 08:08 hungzr