Boost logo

Boost :

From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2019-07-23 00:04:38


On Mon, 22 Jul 2019 at 20:14, Miral Shah <miralshah2211_at_[hidden]> wrote:
>
> 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.
>
> [1]: https://github.com/miralshah365/gil/blob/a3054bc49324183fae6894d14acbda1d53b0a390/include/boost/gil/image_processing/threshold.hpp#L384

It is about the constness difference between
   boost::gil::image_view<boost::gil::gray8c_loc_t>
and
   boost::gil::image_view<boost::gil::gray8_loc_t>

Notice the `c` in `gray8c_loc_t`.

The `temp_view` is the latter, without `c`, mutable, so it is
acceptable by convolve_rows, etc.
The `temp_conv` is the former, with `c` as that is required due to
signature of your
`adaptive_impl` function, which (simplified) looks like this

template <typename SrcView>
void adaptive_impl
(
    SrcView const& src_view,
    SrcView const& convolved_view,
)

As you can see, `convolved_view` is expected to be the same type as `src_view`.
It has to be that const/immutable
`boost::gil::image_view<boost::gil::gray8c_loc_t>`.

Does that make sense now?

You could have modified the signature of `adaptive_impl` a bit to
allow `tmp_view` in.

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

Boost list run by Boost-Gil-Owners