test_structuring_element.cpp 427 B

1234567891011121314151617
  1. #include "test_precomp.hpp"
  2. namespace opencv_test { namespace {
  3. TEST(MorphShapes, getStructuringElementDiamond)
  4. {
  5. cv::Mat element = cv::getStructuringElement(cv::MORPH_DIAMOND, cv::Size(5,5));
  6. cv::Mat expected = (cv::Mat_<uchar>(5,5) <<
  7. 0,0,1,0,0,
  8. 0,1,1,1,0,
  9. 1,1,1,1,1,
  10. 0,1,1,1,0,
  11. 0,0,1,0,0);
  12. EXPECT_EQ(0, cvtest::norm(element, expected, cv::NORM_INF));
  13. }
  14. }} // namespace