Skip to content

Commit fdf0f5e

Browse files
committed
Re-enable bin interpolation
1 parent 6d85367 commit fdf0f5e

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

src/hog.cpp

+12-18
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ void build_histogram(const double *magnitude, const double *orientation, int nro
103103
const int n_cells_y = nrows / rows_per_cell;
104104
const int n_cells_x = ncols / cols_per_cell;
105105
memset(hist, 0, n_cells_x * n_cells_y * n_bins * sizeof(double));
106-
constexpr bool interp = false;
107106

108107
for (int y = 0; y < ncols; ++y) {
109108
const int y_cell = y / rows_per_cell;
@@ -114,23 +113,18 @@ void build_histogram(const double *magnitude, const double *orientation, int nro
114113

115114
const double angle = orientation[y * ncols + x];
116115
const double mag = magnitude[y * ncols + x];
117-
if (interp) {
118-
int high_bin = angle + 0.5;
119-
int low_bin = high_bin - 1;
120-
121-
const double low_vote = mag * (high_bin + 0.5 - angle);
122-
const double high_vote = mag - low_vote;
123-
if (high_bin < 1)
124-
low_bin = n_bins - 1;
125-
if (high_bin >= n_bins)
126-
high_bin = 0;
127-
128-
hist[hist_offset + low_bin] += low_vote;
129-
hist[hist_offset + high_bin] += high_vote;
130-
} else {
131-
int bin = angle;
132-
hist[hist_offset + bin] += mag;
133-
}
116+
int high_bin = angle + 0.5;
117+
int low_bin = high_bin - 1;
118+
119+
const double low_vote = mag * (high_bin + 0.5 - angle);
120+
const double high_vote = mag - low_vote;
121+
if (high_bin < 1)
122+
low_bin = n_bins - 1;
123+
if (high_bin >= n_bins)
124+
high_bin = 0;
125+
126+
hist[hist_offset + low_bin] += low_vote;
127+
hist[hist_offset + high_bin] += high_vote;
134128
}
135129
}
136130
}

0 commit comments

Comments
 (0)