Mercurial > hg > orthanc
diff UnitTestsSources/ImageProcessingTests.cpp @ 3431:e0841192d7d0
improved FillPolygon
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 17 Jun 2019 23:36:37 +0200 |
parents | 7a4d586caf2d |
children | 46cf170ba121 |
line wrap: on
line diff
--- a/UnitTestsSources/ImageProcessingTests.cpp Mon Jun 17 23:35:46 2019 +0200 +++ b/UnitTestsSources/ImageProcessingTests.cpp Mon Jun 17 23:36:37 2019 +0200 @@ -220,9 +220,11 @@ ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 6, 6)); ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 6, 0)); - // inside polygon (note: we don't test too close from the edges since the current algo is taking some margin from the edges and might be improved in that sense) + ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 1)); ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 2)); + ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 5)); ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 2, 4)); + ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 5, 5)); } TYPED_TEST(TestIntegerImageTraits, FillPolygonLargerThanImage) @@ -254,7 +256,6 @@ Orthanc::ImageProcessing::FillPolygon(image, points, 255); - // inside polygon (note: we don't test too close from the edges since the current algo is taking some margin from the edges and might be improved in that sense) - ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 1)); - ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, image.GetWidth() - 2, image.GetHeight() - 2)); + ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 0, 0)); + ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, image.GetWidth() - 1, image.GetHeight() - 1)); }