Open hbh112233abc opened 2 months ago
Can confirm.
The problem occurs due to lines 30 and 31:
l_corresponds = -0.02 <= (x1i - x1j) / (x2i - x1i) <= 0.02
r_corresponds = -0.02 <= (x2i - x2j) / (x2i - x1i) <= 0.02
with, at line 22:
x1i, y1i, x2i, y2i = h_lines_arr[i][:]
Basically, if the x coordinates of a horizontal line match (i.e. the line is 1 pixel wide), this generates a division by 0.
In the example ablve, for instance, h_lines_arr
contains the following line:
[1703, 2498, 1703, 2498],
Commenting the @njit(...)
wrapper at line 11 just turns the ZeroDivisionError
into a RuntimeWarning
on my end.
Ideally, one-pixel-wide horizontal lines (i.e. points) shouldn't have been identified as horizontal lines in the first place. A quick fix would be to add this before line 30:
if x1i == x2i:
continue
test data
remove it's wrapper
@njit("int64[:,:](int64[:,:],int64[:,:])", cache=True, fastmath=True)
,exception not raise