|
Boost : |
From: Miral Shah (miralshah2211_at_[hidden])
Date: 2019-07-22 18:13:56
Although I used the solution provided by you and it works fine. I am still
unclear why FIX2[1] is required and why tmp_view can't be used directly
further in the code.
On Wed, Jun 26, 2019 at 4:20 PM Mateusz Loskot <mateusz_at_[hidden]> wrote:
> Hi Miral,
>
> Looking briefly at your
> https://github.com/miralshah365/gil/blob/adaptive_mean/,
> since it's not yet PR-ed, commenting here.
>
> Two immediate issues related to compilation failure:
>
> 1. `SrcView temp_conv(src_view);` is copy of `const_view(img)`, in
>
>
> https://github.com/miralshah365/gil/blob/adaptive_mean/include/boost/gil/image_processing/threshold.hpp#L251
>
> `const_view`-ed can not be a destination/output as it is used, in
>
>
> https://github.com/miralshah365/gil/blob/adaptive_mean/include/boost/gil/image_processing/threshold.hpp#L253-L254
>
> See FIX 1 part in code pasted below.
>
> 2 The detail::adaptive_impl in turn expects `const_view`-ed
>
>
> https://github.com/miralshah365/gil/blob/adaptive_mean/include/boost/gil/image_processing/threshold.hpp#L258
>
> See FIX 2 part below.
>
> Summary, `SrcView` is used in dual-nature way:
> as `view_t` and `const_view_t`, that causes ambiguity.
>
> ----------------------------------
>
> Below is a combined modification of this part
>
> https://github.com/miralshah365/gil/blob/adaptive_mean/include/boost/gil/image_processing/threshold.hpp#L251-L254
> which should help to illustrate what view types are expected and where:
>
> ```
> //SrcView temp_conv(src_view); // BUG: src_view comes from
> const_view(img), can not be a destination
>
> // FIX 1
> // tmp_img is a shortcut for illustration, you need to consider if such
> image as
> // temporary buffer or in-place convolution is a valid idea - to be
> honest, I have not looked
> // into details of the numeric extension w.r.t to the in-place
> convolution and its limitations.
> image<typename SrcView::value_type> tmp_img;
> image<typename SrcView::value_type>::view_t tmp_view = view(tmp_img);
> // end of FIX 1
> kernel_1d<short> kernel(mean, kernel_size, kernel_size / 2);
> convolve_rows<pixel<float, SrcView::value_type::layout_t>>(src_view,
> kernel, tmp_view);
> convolve_cols<pixel<float, SrcView::value_type::layout_t>>(src_view,
> kernel, tmp_view);
>
> // FIX 2
> SrcView temp_conv(tmp_view);
> // end of FIX 2
> ```
>
> Let's discuss if anything is still unclear.
> I hope it helps.
>
> Best regards,
> --
> Mateusz Åoskot, http://mateusz.loskot.net
> --
> Boost-gil mailing list
> Boost-gil_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-gil
>
-- Thank you, Miral Shah
Boost list run by Boost-Gil-Owners