BusinessCardReader
BusinessCardReader copied to clipboard
IndexError: list index out of range (empty good_points)
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,
Hi @messaoudi-mounir, I'm having same issue, tried a bunch of different cards from the Stanford library linked. Did you ever solve this?
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)