mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-11 03:02:19 +08:00
Code valid for all image dtypes
This commit is contained in:
@@ -80,11 +80,11 @@ def hog(image, orientations=9, pixels_per_cell=(8, 8),
|
||||
# to avoid problems with subtracting unsigned numbers in np.diff()
|
||||
image = image.astype('float')
|
||||
|
||||
gx = np.empty_like(image)
|
||||
gx = np.empty(image.shape)
|
||||
gx[:, 0] = 0
|
||||
gx[:, -1] = 0
|
||||
gx[:, 1:-1] = image[:, 2:] - image[:, :-2]
|
||||
gy = np.empty_like(image)
|
||||
gy = np.empty(image.shape)
|
||||
gy[0, :] = 0
|
||||
gy[-1, :] = 0
|
||||
gy[1:-1, :] = image[2:, :] - image[:-2, :]
|
||||
|
||||
Reference in New Issue
Block a user