• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 { namespace detail {
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 static constexpr std::array<float, 9> dy_sobel = {{1, 2, 1, 0, 0, 0, -1, -2, -1}};
21 static constexpr std::array<float, 9> dy_scharr = {{1, 1, 1, 0, 0, 0, -1, -1, -1}};
22 
23 template <typename T, typename Allocator>
get_identity_kernel()24 inline detail::kernel_2d<T, Allocator> get_identity_kernel()
25 {
26     detail::kernel_2d<T, Allocator> kernel(1, 0, 0);
27     kernel[0] = 1;
28     return kernel;
29 }
30 
31 }}} // namespace boost::gil::detail
32 
33 #endif
34