Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / gil / detail / math.hpp
1 //
2 // Copyright 2019 Olzhas Zhumabek <anonymous.from.applecity@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 #ifndef BOOST_GIL_IMAGE_PROCESSING_DETAIL_MATH_HPP
9 #define BOOST_GIL_IMAGE_PROCESSING_DETAIL_MATH_HPP
10
11 #include <array>
12 #include <boost/gil/extension/numeric/kernel.hpp>
13
14 namespace boost { namespace gil {
15
16 static constexpr double pi = 3.14159265358979323846;
17
18 static constexpr std::array<float, 9> dx_sobel = {-1, 0, 1, -2, 0, 2, -1, 0, 1};
19 static constexpr std::array<float, 9> dx_scharr = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
20
21 static constexpr std::array<float, 9> dy_sobel = {1, 2, 1, 0, 0, 0, -1, -2, -1};
22 static constexpr std::array<float, 9> dy_scharr = {1, 1, 1, 0, 0, 0, -1, -1, -1};
23
24 template <typename T, typename Allocator>
25 inline detail::kernel_2d<T, Allocator> get_identity_kernel()
26 {
27     detail::kernel_2d<T, Allocator> kernel(1, 0, 0);
28     kernel[0] = 1;
29     return kernel;
30 }
31
32 }} // namespace boost::gil
33
34 #endif