Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convolve_2d fails with image types using channel type float32_t #575

Closed
harshitpant1 opened this issue Mar 9, 2021 · 1 comment · Fixed by #577
Closed

convolve_2d fails with image types using channel type float32_t #575

harshitpant1 opened this issue Mar 9, 2021 · 1 comment · Fixed by #577

Comments

@harshitpant1
Copy link
Contributor

harshitpant1 commented Mar 9, 2021

Actual behavior

convolve_2d fails to convolve images of type with channel type float32_t.

Expected behavior

It should work, as it does for other image types.

C++ Minimal Working Example

#include <boost/gil.hpp>
#include <vector>
namespace gil = boost::gil;
int main()
{
    gil::gray32f_image_t img_in(25, 25);
    gil::gray32f_image_t img_out(img_in.dimensions());
    std::vector<float> vec{0,0,0,0,1,0,0,0,0};
    gil::detail::kernel_2d<float> kernel(vec.begin(), vec.size(), 1, 1);
    gil::detail::convolve_2d(view(img_in), kernel, view(img_out));
    return 0; 
}

Environment

  • Compiler version: MS Visual C++ version 19.28.29333
  • Version (Git ref or <boost/version.hpp>): 107500
@harshitpant1
Copy link
Contributor Author

harshitpant1 commented Mar 9, 2021

adding [0], on line 376, seems to work. Perhaps the compiler doesn't like doing two implicit conversions.

aux_total +=
      src_view(col_boundary, row_boundary)[0] *
      kernel.at(flip_ker_row, flip_ker_col); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant