test_slic.cpp 719 B

12345678910111213141516171819202122
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #include "test_precomp.hpp"
  5. namespace opencv_test { namespace {
  6. TEST(ximgproc_SuperpixelSLIC, smoke)
  7. {
  8. Mat img = imread(cvtest::findDataFile("cv/shared/lena.png"), IMREAD_COLOR);
  9. Mat labImg;
  10. cvtColor(img, labImg, COLOR_BGR2Lab);
  11. Ptr< SuperpixelSLIC> slic = createSuperpixelSLIC(labImg);
  12. slic->iterate(5);
  13. Mat outLabels;
  14. slic->getLabels(outLabels);
  15. EXPECT_FALSE(outLabels.empty());
  16. int numSuperpixels = slic->getNumberOfSuperpixels();
  17. EXPECT_GT(numSuperpixels, 0);
  18. }
  19. }} // namespace