|
5 | 5 | // v. 2.0. If a copy of the MPL was not distributed with this file,
|
6 | 6 | // You can obtain one at https://mozilla.org/MPL/2.0/.
|
7 | 7 |
|
8 |
| -#include "aliceVision/image/all.hpp" |
| 8 | +#include <aliceVision/image/Image.hpp> |
| 9 | +#include <aliceVision/image/colorspace.hpp> |
| 10 | +#include <aliceVision/image/filtering.hpp> |
| 11 | +#include <aliceVision/image/io.hpp> |
9 | 12 |
|
10 | 13 | #include <iostream>
|
11 | 14 |
|
@@ -100,42 +103,3 @@ BOOST_AUTO_TEST_CASE(Image_Convolution_Scharr_X_Y)
|
100 | 103 | writeImage("out_ScharrY.png", outFilteredCast, image::ImageWriteOptions().toColorSpace(image::EImageColorSpace::NO_CONVERSION)));
|
101 | 104 | }
|
102 | 105 |
|
103 |
| -BOOST_AUTO_TEST_CASE(Image_Convolution_Sobel_X_Y) |
104 |
| -{ |
105 |
| - Image<float> in(40, 40, true); |
106 |
| - in.block(10, 10, 20, 20).fill(255.f); |
107 |
| - |
108 |
| - Image<float> outFiltered(40, 40, true); |
109 |
| - |
110 |
| - imageSobelXDerivative(in, outFiltered); |
111 |
| - |
112 |
| - // X dir |
113 |
| - BOOST_CHECK_EQUAL(127.5f, outFiltered(20, 10)); |
114 |
| - BOOST_CHECK_EQUAL(-127.5f, outFiltered(20, 30)); |
115 |
| - // Y dir |
116 |
| - BOOST_CHECK_EQUAL(0.f, outFiltered(10, 20)); |
117 |
| - BOOST_CHECK_EQUAL(0.f, outFiltered(30, 20)); |
118 |
| - // Check it exist a vertical black band |
119 |
| - BOOST_CHECK_EQUAL(0.f, outFiltered.block(0, 10 + 3, 40, 20 - 2 * 3).array().abs().sum()); |
120 |
| - |
121 |
| - Image<unsigned char> inCast = Image<unsigned char>(in.cast<unsigned char>()); |
122 |
| - Image<unsigned char> outFilteredCast = Image<unsigned char>(outFiltered.cast<unsigned char>()); |
123 |
| - BOOST_CHECK_NO_THROW(writeImage("in_Scharr.png", inCast, image::ImageWriteOptions().toColorSpace(image::EImageColorSpace::NO_CONVERSION))); |
124 |
| - BOOST_CHECK_NO_THROW( |
125 |
| - writeImage("out_SobelX.png", outFilteredCast, image::ImageWriteOptions().toColorSpace(image::EImageColorSpace::NO_CONVERSION))); |
126 |
| - |
127 |
| - outFiltered.fill(0.0f); |
128 |
| - imageSobelYDerivative(in, outFiltered); |
129 |
| - |
130 |
| - // X dir |
131 |
| - BOOST_CHECK_EQUAL(0.f, outFiltered(20, 10)); |
132 |
| - BOOST_CHECK_EQUAL(0.f, outFiltered(20, 30)); |
133 |
| - // Y dir |
134 |
| - BOOST_CHECK_EQUAL(127.5f, outFiltered(10, 20)); |
135 |
| - BOOST_CHECK_EQUAL(-127.5f, outFiltered(30, 20)); |
136 |
| - // Check it exist a horizontal black band |
137 |
| - BOOST_CHECK_EQUAL(0.f, outFiltered.block(10 + 3, 0, 20 - 2 * 3, 40).array().abs().sum()); |
138 |
| - outFilteredCast = Image<unsigned char>(outFiltered.cast<unsigned char>()); |
139 |
| - BOOST_CHECK_NO_THROW( |
140 |
| - writeImage("out_SobelY.png", outFilteredCast, image::ImageWriteOptions().toColorSpace(image::EImageColorSpace::NO_CONVERSION))); |
141 |
| -} |
0 commit comments