Fix an error in the centre calculation

This commit is contained in:
ivoflipse
2015-12-04 10:42:09 +01:00
committed by Korijn van Golen
parent c1722d8709
commit 8b7920ea13
+1 -3
View File
@@ -127,13 +127,11 @@ def hog(image, orientations=9, pixels_per_cell=(8, 8),
orientations_arr = np.arange(orientations)
dx_arr = radius * np.cos(orientations_arr / orientations * np.pi)
dy_arr = radius * np.sin(orientations_arr / orientations * np.pi)
cr2 = cy + cy
cc2 = cx + cx
hog_image = np.zeros((sy, sx), dtype=float)
for x in range(n_cellsx):
for y in range(n_cellsy):
for o, dx, dy in zip(orientations_arr, dx_arr, dy_arr):
centre = tuple([y * cr2 // 2, x * cc2 // 2])
centre = tuple([y * cy + cy // 2, x * cx + cx // 2])
rr, cc = draw.line(int(centre[0] - dx),
int(centre[1] + dy),
int(centre[0] + dx),