mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-14 11:18:06 +08:00
use sat_sum for performance improvement
This commit is contained in:
committed by
Stefan van der Walt
parent
da6c93bac4
commit
0bf8ecc65a
@@ -5,7 +5,7 @@
|
||||
|
||||
import numpy as np
|
||||
from scipy import sqrt, pi, arctan2, cos, sin
|
||||
|
||||
from ..transform import sat_sum
|
||||
|
||||
def hog(image, n_orientations=9, pixels_per_cell=(8, 8),
|
||||
cells_per_block=(3, 3), visualise=False, normalise=False):
|
||||
@@ -147,12 +147,11 @@ def hog(image, n_orientations=9, pixels_per_cell=(8, 8),
|
||||
for y in range(0, n_cellsy):
|
||||
for o in range(0, n_orientations):
|
||||
# compute the histogram from integral image
|
||||
#print x, y, o
|
||||
A = integral_images[o][x * cx, y * cy]
|
||||
B = integral_images[o][(x + 1) * cx - 1, y * cy]
|
||||
C = integral_images[o][(x + 1) * cx - 1, (y + 1) * cy - 1]
|
||||
D = integral_images[o][x * cx, (y + 1) * cy - 1]
|
||||
orientation_histogram[x, y, o] = A + C - D - B
|
||||
orientation_histogram[x, y, o] = sat_sum(integral_images[o],
|
||||
y * cy,
|
||||
x * cx,
|
||||
(y + 1) * cy - 1,
|
||||
(x + 1) * cx - 1)
|
||||
|
||||
if visualise:
|
||||
centre = tuple([y * cy + cy // 2, x * cx + cx // 2])
|
||||
|
||||
Reference in New Issue
Block a user