1 //
2 // Copyright 2019 Miral Shah <miralshah2211@gmail.com>
3 //
4 // Use, modification and distribution are subject to the Boost Software License,
5 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 #include <boost/gil.hpp>
9 #include <boost/gil/extension/io/png.hpp>
10 #include <iostream>
11
12 using namespace boost::gil;
13
main()14 int main()
15 {
16 gray8_image_t img;
17 read_image("test_adaptive.png", img, png_tag{});
18 gray8_image_t img_out(img.dimensions());
19
20 boost::gil::threshold_adaptive(const_view(img), view(img_out), 11, threshold_adaptive_method::mean, threshold_direction::regular, 2);
21 write_view("out-threshold-adaptive-mean.png", view(img_out), png_tag{});
22
23 boost::gil::threshold_adaptive(const_view(img), view(img_out), 11, threshold_adaptive_method::mean, threshold_direction::inverse, 2);
24 write_view("out-threshold-adaptive-mean-inv.png", view(img_out), png_tag{});
25
26 boost::gil::threshold_adaptive(const_view(img), view(img_out), 7, threshold_adaptive_method::gaussian, threshold_direction::regular, 2);
27 write_view("out-threshold-adaptive-gaussian.png", view(img_out), png_tag{});
28
29 boost::gil::threshold_adaptive(const_view(img), view(img_out), 11, threshold_adaptive_method::gaussian, threshold_direction::inverse, 2);
30 write_view("out-threshold-adaptive-gaussian-inv.png", view(img_out), png_tag{});
31
32 return 0;
33 }
34