Skip to content

Commit

Permalink
Fix interpolation pixel selection (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bidski authored Jun 18, 2021
1 parent d0c5776 commit 2af8047
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp/visualmesh/engine/cpu/pixel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ namespace engine {
const Scalar y = P[1];
const int x1 = std::max(int(std::floor(P[0])), 0);
const int y1 = std::max(int(std::floor(P[1])), 0);
const int x2 = std::max(x1 + 1, dimensions[0]);
const int y2 = std::max(y1 + 1, dimensions[1]);
const int x2 = std::min(x1 + 1, dimensions[0] - 1);
const int y2 = std::min(y1 + 1, dimensions[1] - 1);
const vec4<Scalar> Q1 = get_pixel<Scalar>(vec2<int>{x1, y1}, image, dimensions, format);
const vec4<Scalar> Q2 = get_pixel<Scalar>(vec2<int>{x2, y1}, image, dimensions, format);
const vec4<Scalar> Q3 = get_pixel<Scalar>(vec2<int>{x1, y2}, image, dimensions, format);
Expand Down

0 comments on commit 2af8047

Please sign in to comment.