Skip to content

Commit

Permalink
switch uses of nth_channel_view to boost::gil::index_t
Browse files Browse the repository at this point in the history
  • Loading branch information
striezel committed May 5, 2024
1 parent b9ecb13 commit 0f93276
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ void non_overlapping_interpolated_clahe(
using dst_channel_t = typename channel_type<DstView>::type;
using coord_t = typename SrcView::x_coord_t;

std::size_t const channels = num_channels<SrcView>::value;
coord_t const width = src_view.width();
coord_t const height = src_view.height();
index_t const channels = num_channels<SrcView>::value;
coord_t const width = src_view.width();
coord_t const height = src_view.height();

// Find control points

Expand All @@ -184,7 +184,7 @@ void non_overlapping_interpolated_clahe(

copy_pixels(src_view, subimage_view(view(padded_img), top_left_x, top_left_y, width, height));

for (std::size_t k = 0; k < channels; k++)
for (index_t k = 0; k < channels; k++)
{
std::vector<histogram<source_channel_t>> prev_row(new_width / tile_width_x),
next_row((new_width / tile_width_x));
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/image_processing/convolve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void convolve_2d(SrcView const& src_view, Kernel const& kernel, DstView const& d
typename color_space_type<DstView>::type
>::value, "Source and destination views must have pixels with the same color space");

for (std::size_t i = 0; i < src_view.num_channels(); i++)
for (index_t i = 0; i < src_view.num_channels(); i++)
{
detail::convolve_2d_impl(
nth_channel_view(src_view, i),
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/image_processing/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void median_filter(SrcView const& src_view, DstView const& dst_view, std::size_t
src_view.height()
);

for (std::size_t channel = 0; channel < extended_view.num_channels(); channel++)
for (index_t channel = 0; channel < extended_view.num_channels(); channel++)
{
detail::filter_median_impl(
nth_channel_view(extended_view, channel),
Expand Down
12 changes: 6 additions & 6 deletions include/boost/gil/image_processing/histogram_equalization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ void histogram_equalization(
using dst_channel_t = typename channel_type<DstView>::type;
using coord_t = typename SrcView::x_coord_t;

std::size_t const channels = num_channels<SrcView>::value;
coord_t const width = src_view.width();
coord_t const height = src_view.height();
std::size_t pixel_max = (std::numeric_limits<dst_channel_t>::max)();
std::size_t pixel_min = (std::numeric_limits<dst_channel_t>::min)();
index_t const channels = num_channels<SrcView>::value;
coord_t const width = src_view.width();
coord_t const height = src_view.height();
std::size_t pixel_max = (std::numeric_limits<dst_channel_t>::max)();
std::size_t pixel_min = (std::numeric_limits<dst_channel_t>::min)();

for (std::size_t i = 0; i < channels; i++)
for (index_t i = 0; i < channels; i++)
{
histogram<source_channel_t> h;
fill_histogram(nth_channel_view(src_view, i), h, bin_width, false, false, mask, src_mask);
Expand Down
4 changes: 2 additions & 2 deletions include/boost/gil/image_processing/histogram_matching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ void histogram_matching(
using dst_channel_t = typename channel_type<DstView>::type;
using coord_t = typename SrcView::x_coord_t;

std::size_t const channels = num_channels<SrcView>::value;
index_t const channels = num_channels<SrcView>::value;
coord_t const width = src_view.width();
coord_t const height = src_view.height();
source_channel_t src_pixel_min = (std::numeric_limits<source_channel_t>::min)();
source_channel_t src_pixel_max = (std::numeric_limits<source_channel_t>::max)();
ref_channel_t ref_pixel_min = (std::numeric_limits<ref_channel_t>::min)();
ref_channel_t ref_pixel_max = (std::numeric_limits<ref_channel_t>::max)();

for (std::size_t i = 0; i < channels; i++)
for (index_t i = 0; i < channels; i++)
{
histogram<source_channel_t> src_histogram;
histogram<ref_channel_t> ref_histogram;
Expand Down
4 changes: 2 additions & 2 deletions include/boost/gil/image_processing/morphology.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void morph(SrcView const& src_view, DstView const& dst_view, Kernel const& ker_m

gil::image<typename DstView::value_type> intermediate_img(src_view.dimensions());

for (std::size_t i = 0; i < src_view.num_channels(); i++)
for (index_t i = 0; i < src_view.num_channels(); i++)
{
morph_impl(nth_channel_view(src_view, i), nth_channel_view(view(intermediate_img), i),
ker_mat, identifier);
Expand Down Expand Up @@ -153,7 +153,7 @@ void difference(SrcView const& src_view1, SrcView const& src_view2, DiffView con
gil_function_requires<ColorSpacesCompatibleConcept<
typename color_space_type<SrcView>::type, typename color_space_type<DiffView>::type>>();

for (std::size_t i = 0; i < src_view1.num_channels(); i++)
for (index_t i = 0; i < src_view1.num_channels(); i++)
{
difference_impl(nth_channel_view(src_view1, i), nth_channel_view(src_view2, i),
nth_channel_view(diff_view, i));
Expand Down
2 changes: 1 addition & 1 deletion include/boost/gil/image_processing/threshold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void threshold_optimal
{
if (mode == threshold_optimal_value::otsu)
{
for (std::size_t i = 0; i < src_view.num_channels(); i++)
for (index_t i = 0; i < src_view.num_channels(); i++)
{
detail::otsu_impl
(nth_channel_view(src_view, i), nth_channel_view(dst_view, i), direction);
Expand Down

0 comments on commit 0f93276

Please sign in to comment.