| 1 | // |
|---|---|
| 2 | // Copyright 2019 Mateusz Loskot <mateusz at loskot dot net> |
| 3 | // Copyright 2021 Pranam Lashkari <plashkari628@gmail.com> |
| 4 | // |
| 5 | // Distributed under the Boost Software License, Version 1.0 |
| 6 | // See accompanying file LICENSE_1_0.txt or copy at |
| 7 | // http://www.boost.org/LICENSE_1_0.txt |
| 8 | // |
| 9 | #include <boost/gil.hpp> |
| 10 | #include <boost/gil/image_processing/kernel.hpp> |
| 11 | #include <boost/assert.hpp> |
| 12 | |
| 13 | #include <initializer_list> |
| 14 | #include <type_traits> |
| 15 | |
| 16 | namespace boost { namespace gil { |
| 17 | |
| 18 | namespace test { namespace fixture { |
| 19 | |
| 20 | template <typename T> |
| 21 | auto create_kernel(std::initializer_list<T> const& values) |
| 22 | -> gil::kernel_1d<T> |
| 23 | { |
| 24 | static_assert(std::is_arithmetic<T>::value, |
| 25 | "kernel value type should be integral or floating-point type"); |
| 26 | BOOST_ASSERT_MSG((values.size() - 1) % 2 == 0, "expected odd number of kernel values"); |
| 27 | gil::kernel_1d<T> kernel(values.begin(), values.size(), (values.size() - 1) / 2); |
| 28 | return kernel; |
| 29 | } |
| 30 | |
| 31 | }}}} // namespace boost::gil::test::fixture |
| 32 |
