Merge pull request #8 from ClinicalGraphics/fasthog

Fasthog
This commit is contained in:
Tim Sheerman-Chase
2015-06-19 18:02:43 +01:00
+22 -21
View File
@@ -10,7 +10,7 @@ cdef float cell_hog(double[:, ::1] magnitude,
float orientation_start, float orientation_end,
int cell_columns, int cell_rows,
int column_index, int row_index,
int size_columns, int size_rows):
int size_columns, int size_rows) nogil:
"""Calculation of the cell's HOG value
Parameters
@@ -116,26 +116,27 @@ def hog_histograms(double[:, ::1] gradient_columns,
cr = cell_columns * number_of_cells_columns
number_of_orientations_per_180 = 180. / number_of_orientations
# compute orientations integral images
for i in range(number_of_orientations):
# isolate orientations in this range
orientation_start = number_of_orientations_per_180 * (i + 1)
orientation_end = number_of_orientations_per_180 * i
x = x0
y = y0
yi = 0
xi = 0
while y < cc:
xi = 0
with nogil:
# compute orientations integral images
for i in range(number_of_orientations):
# isolate orientations in this range
orientation_start = number_of_orientations_per_180 * (i + 1)
orientation_end = number_of_orientations_per_180 * i
x = x0
y = y0
yi = 0
xi = 0
while x < cr:
orientation_histogram[yi, xi, i] = cell_hog(magnitude,
orientation, orientation_start, orientation_end,
cell_columns, cell_rows, x, y, size_columns, size_rows)
xi += 1
x += cell_columns
while y < cc:
xi = 0
x = x0
yi += 1
y += cell_rows
while x < cr:
orientation_histogram[yi, xi, i] = cell_hog(magnitude,
orientation, orientation_start, orientation_end,
cell_columns, cell_rows, x, y, size_columns, size_rows)
xi += 1
x += cell_columns
yi += 1
y += cell_rows