Skip to content

Commit

Permalink
Merge pull request #131 from sbrunner/fix-hough_line_out
Browse files Browse the repository at this point in the history
Fix hough line out
  • Loading branch information
sbrunner authored Dec 8, 2021
2 parents c1287c8 + b94b688 commit a6b4b0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions deskew/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def determine_skew_dev(
img = rgb2gray(imagergb) if len(imagergb.shape) == 3 else imagergb
edges = canny(img, sigma=sigma)
out, angles, distances = hough_line(edges, np.linspace(-np.pi / 2, np.pi / 2, num_angles, endpoint=False))
hough_line_out = (out, angles, distances)

_, angles_peaks, _ = hough_line_peaks(
out, angles, distances, num_peaks=num_peaks, threshold=0.05 * np.max(out)
Expand Down Expand Up @@ -111,7 +112,7 @@ def determine_skew_dev(
ans_arr = _get_max_freq_elem(angles_peaks_degree)
angle = np.mean(ans_arr)
else:
return None, angles, average_deviation, (out, angles, distances)
return None, angles, average_deviation, hough_line_out

if 0 <= angle <= 90:
rot_angle = angle - 90
Expand All @@ -120,7 +121,7 @@ def determine_skew_dev(
elif -90 <= angle < -45:
rot_angle = 90 + angle

return rot_angle, angles, average_deviation, (out, angles, distances)
return rot_angle, angles, average_deviation, hough_line_out


def determine_skew(
Expand Down

0 comments on commit a6b4b0d

Please sign in to comment.