Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
3430:4c45e018bd3d | 3431:e0841192d7d0 |
---|---|
218 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 0, 0)); | 218 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 0, 0)); |
219 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 0, 6)); | 219 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 0, 6)); |
220 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 6, 6)); | 220 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 6, 6)); |
221 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 6, 0)); | 221 ASSERT_FLOAT_EQ(128, TestFixture::ImageTraits::GetFloatPixel(image, 6, 0)); |
222 | 222 |
223 // 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) | 223 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 1)); |
224 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 2)); | 224 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 2)); |
225 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 5)); | |
225 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 2, 4)); | 226 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 2, 4)); |
227 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 5, 5)); | |
226 } | 228 } |
227 | 229 |
228 TYPED_TEST(TestIntegerImageTraits, FillPolygonLargerThanImage) | 230 TYPED_TEST(TestIntegerImageTraits, FillPolygonLargerThanImage) |
229 { | 231 { |
230 ImageAccessor& image = this->GetImage(); | 232 ImageAccessor& image = this->GetImage(); |
252 points.push_back(ImageProcessing::ImagePoint(image.GetWidth() - 1,image.GetHeight() - 1)); | 254 points.push_back(ImageProcessing::ImagePoint(image.GetWidth() - 1,image.GetHeight() - 1)); |
253 points.push_back(ImageProcessing::ImagePoint(0,image.GetHeight() - 1)); | 255 points.push_back(ImageProcessing::ImagePoint(0,image.GetHeight() - 1)); |
254 | 256 |
255 Orthanc::ImageProcessing::FillPolygon(image, points, 255); | 257 Orthanc::ImageProcessing::FillPolygon(image, points, 255); |
256 | 258 |
257 // 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) | 259 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 0, 0)); |
258 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, 1, 1)); | 260 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, image.GetWidth() - 1, image.GetHeight() - 1)); |
259 ASSERT_FLOAT_EQ(255, TestFixture::ImageTraits::GetFloatPixel(image, image.GetWidth() - 2, image.GetHeight() - 2)); | 261 } |
260 } |