1//
2// Copyright 2020 Debabrata Mandal <mandaldebabrata123@gmail.com>
3//
4// Distributed under the Boost Software License, Version 1.0
5// See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt
7//
8
9#include <boost/gil.hpp>
10#include <boost/gil/extension/io/png.hpp>
11#include <boost/gil/image_processing/histogram_equalization.hpp>
12
13using namespace boost::gil;
14
15// Demonstrates Histogram Equalization
16
17// See also:
18// histogram.cpp - General use of histograms in GIL
19// adaptive_histogram_equalization.cpp - Adaptive Histogram Equalization
20// histogram_matching.cpp - Reference-based histogram computation
21
22int main()
23{
24 gray8_image_t img;
25
26 read_image(file_name: "test_adaptive.png", img, tag: png_tag{});
27 gray8_image_t img_out(img.dimensions());
28
29 // Consider changing image to independent color space, e.g. cmyk
30 boost::gil::histogram_equalization(src_view: view(img),dst_view: view(img&: img_out));
31
32 write_view(file_name: "histogram_gray_equalized.png", view: view(img&: img_out), tag: png_tag{});
33
34 return 0;
35}
36

source code of boost/libs/gil/example/histogram_equalization.cpp