@@ -252,6 +252,34 @@ VISP_TEST(image_blur) {
252252 CHECK_IMAGES_EQUAL (output, expected);
253253}
254254
255+ VISP_TEST (image_erosion) {
256+ constexpr i32x2 extent{6 , 6 };
257+ std::array<float , extent[0 ] * extent[1 ]> input_data = {
258+ 0 .0f , 0 .5f , 0 .0f , 0 .0f , 0 .0f , 0 .0f , //
259+ 0 .0f , 1 .0f , 0 .0f , 0 .0f , 0 .0f , 1 .0f , //
260+ 0 .8f , 0 .8f , 1 .0f , 0 .5f , 0 .0f , 1 .0f , //
261+ 0 .8f , 0 .8f , 1 .0f , 0 .5f , 0 .5f , 0 .0f , //
262+ 0 .8f , 1 .0f , 1 .0f , 0 .5f , 0 .5f , 0 .0f , //
263+ 0 .0f , 1 .0f , 1 .0f , 0 .2f , 0 .5f , 0 .0f //
264+ };
265+ std::array<float , extent[0 ] * extent[1 ]> expected_data = {
266+ 0 .0f , 0 .0f , 0 .0f , 0 .0f , 0 .0f , 0 .0f , //
267+ 0 .0f , 0 .0f , 0 .0f , 0 .0f , 0 .0f , 0 .0f , //
268+ 0 .0f , 0 .0f , 0 .0f , 0 .0f , 0 .0f , 0 .0f , //
269+ 0 .8f , 0 .8f , 0 .5f , 0 .0f , 0 .0f , 0 .0f , //
270+ 0 .0f , 0 .0f , 0 .2f , 0 .2f , 0 .0f , 0 .0f , //
271+ 0 .0f , 0 .0f , 0 .2f , 0 .2f , 0 .0f , 0 .0f //
272+ };
273+ std::array<float , extent[0 ] * extent[1 ]> output_data{};
274+
275+ auto input = image_view (extent, input_data);
276+ auto output = image_span (extent, output_data);
277+ image_erosion (input, output, 1 );
278+
279+ auto expected = image_view (extent, expected_data);
280+ CHECK_IMAGES_EQUAL (output, expected);
281+ }
282+
255283VISP_TEST (tile_merge) {
256284 std::array<std::array<f32x3, 5 * 5 >, 4 > tiles;
257285 for (int t = 0 ; t < 4 ; ++t) {
0 commit comments