Skip to content

Commit

Permalink
Variable initializing improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Scramjet911 committed Jan 31, 2021
1 parent 800c797 commit e955589
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions example/hessian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ gil::gray8_image_t to_grayscale(gil::rgb8_view_t original)

void apply_gaussian_blur(gil::gray8_view_t input_view, gil::gray8_view_t output_view)
{
constexpr static auto filter_height = 5ull;
constexpr static auto filter_width = 5ull;
constexpr static std::ptrdiff_t filter_height = 5ull;
constexpr static std::ptrdiff_t filter_width = 5ull;
constexpr static double filter[filter_height][filter_width] =
{
{ 2, 4, 6, 4, 2 },
Expand All @@ -80,9 +80,9 @@ void apply_gaussian_blur(gil::gray8_view_t input_view, gil::gray8_view_t output_
for (std::ptrdiff_t y = 0; y < height; ++y)
{
double intensity = 0.0;
for (std::ptrdiff_t filter_y = 0; filter_y < static_cast<std::ptrdiff_t>(filter_height); ++filter_y)
for (std::ptrdiff_t filter_y = 0; filter_y < filter_height; ++filter_y)
{
for (std::ptrdiff_t filter_x = 0; filter_x < static_cast<std::ptrdiff_t>(filter_width); ++filter_x)
for (std::ptrdiff_t filter_x = 0; filter_x < filter_width; ++filter_x)
{
int image_x = x - filter_width / 2 + filter_x;
int image_y = y - filter_height / 2 + filter_y;
Expand Down
6 changes: 3 additions & 3 deletions include/boost/gil/image_processing/harris.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void compute_harris_responses(
" tensor from the same image");
}

auto const window_length = weights.size();
std::ptrdiff_t const window_length = weights.size();
auto const width = m11.width();
auto const height = m11.height();
auto const half_length = window_length / 2;
Expand All @@ -57,10 +57,10 @@ void compute_harris_responses(
float dxdy = 0;
float ddyy = 0;
for (gil::gray32f_view_t::coord_t y_kernel = 0;
y_kernel < static_cast<std::ptrdiff_t>(window_length);
y_kernel < window_length;
++y_kernel) {
for (gil::gray32f_view_t::coord_t x_kernel = 0;
x_kernel < static_cast<std::ptrdiff_t>(window_length);
x_kernel < window_length;
++x_kernel) {
ddxx += m11(x + x_kernel - half_length, y + y_kernel - half_length)
.at(std::integral_constant<int, 0>{}) * weights.at(x_kernel, y_kernel);
Expand Down

0 comments on commit e955589

Please sign in to comment.