mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-09 11:33:41 +08:00
fix hog.py - orientation and visualization
This commit is contained in:
committed by
Stefan van der Walt
parent
6410905b3b
commit
25d94b36c6
@@ -96,7 +96,7 @@ def hog(image, orientations=9, pixels_per_cell=(8, 8),
|
||||
"""
|
||||
|
||||
magnitude = sqrt(gx**2 + gy**2)
|
||||
orientation = arctan2(gy, (gx + 1e-15)) * (180 / pi) + 90
|
||||
orientation = arctan2(gy, (gx + 1e-15)) * (180 / pi) % 180
|
||||
|
||||
sy, sx = image.shape
|
||||
cx, cy = pixels_per_cell
|
||||
@@ -137,8 +137,8 @@ def hog(image, orientations=9, pixels_per_cell=(8, 8),
|
||||
centre = tuple([y * cy + cy // 2, x * cx + cx // 2])
|
||||
dx = radius * cos(float(o) / orientations * np.pi)
|
||||
dy = radius * sin(float(o) / orientations * np.pi)
|
||||
rr, cc = draw.bresenham(centre[0] - dx, centre[1] - dy,
|
||||
centre[0] + dx, centre[1] + dy)
|
||||
rr, cc = draw.bresenham(centre[0] - dy, centre[1] - dx,
|
||||
centre[0] + dy, centre[1] + dx)
|
||||
hog_image[rr, cc] += orientation_histogram[y, x, o]
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user