]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/core/image_processing/hessian.cpp
2 // Copyright 2019 Olzhas Zhumabek <anonymous.from.applecity@gmail.com>
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)
8 #include <boost/gil/image.hpp>
9 #include <boost/gil/image_view.hpp>
10 #include <boost/gil/image_processing/numeric.hpp>
11 #include <boost/gil/image_processing/hessian.hpp>
13 #include <boost/core/lightweight_test.hpp>
15 namespace gil
= boost::gil
;
17 bool are_equal(gil::gray32f_view_t expected
, gil::gray32f_view_t actual
) {
18 if (expected
.dimensions() != actual
.dimensions())
21 for (long int y
= 0; y
< expected
.height(); ++y
)
23 for (long int x
= 0; x
< expected
.width(); ++x
)
25 if (expected(x
, y
) != actual(x
, y
))
35 void test_blank_image()
37 const gil::point_t
dimensions(20, 20);
38 gil::gray16s_image_t
dx(dimensions
, gil::gray16s_pixel_t(0), 0);
39 gil::gray16s_image_t
dy(dimensions
, gil::gray16s_pixel_t(0), 0);
41 gil::gray32f_image_t
m11(dimensions
);
42 gil::gray32f_image_t
m12_21(dimensions
);
43 gil::gray32f_image_t
m22(dimensions
);
44 gil::gray32f_image_t
expected(dimensions
, gil::gray32f_pixel_t(0), 0);
45 gil::compute_hessian_entries(
52 BOOST_TEST(are_equal(gil::view(expected
), gil::view(m11
)));
53 BOOST_TEST(are_equal(gil::view(expected
), gil::view(m12_21
)));
54 BOOST_TEST(are_equal(gil::view(expected
), gil::view(m22
)));
56 gil::gray32f_image_t
hessian_response(dimensions
, gil::gray32f_pixel_t(0), 0);
57 auto unnormalized_mean
= gil::generate_unnormalized_mean(5);
58 gil::compute_hessian_responses(
63 gil::view(hessian_response
)
65 BOOST_TEST(are_equal(gil::view(expected
), gil::view(hessian_response
)));
68 int main(int argc
, char* argv
[])
71 return boost::report_errors();