diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index 6571aa581a..5295533b57 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -332,6 +332,7 @@ vp_add_tests(CTEST_EXCLUDE_PATH network DEPENDS_ON visp_io visp_gui PRIVATE_INCL # copy data for testing vp_glob_module_copy_data("test/math/data/*.pgm" "modules/core" NO_INSTALL) +vp_glob_module_copy_data("test/image/data/*.png" "modules/core" NO_INSTALL) # copy font vp_glob_module_copy_data("src/image/private/Rubik-Regular.ttf" "data/font") diff --git a/modules/core/test/image/catchImageMorphology.cpp b/modules/core/test/image/catchImageMorphology.cpp index 9b965073c5..a4627ec74a 100644 --- a/modules/core/test/image/catchImageMorphology.cpp +++ b/modules/core/test/image/catchImageMorphology.cpp @@ -45,6 +45,8 @@ #include #include #include +#include +#include #ifdef ENABLE_VISP_NAMESPACE using namespace VISP_NAMESPACE_NAME; @@ -428,6 +430,31 @@ int main(int argc, char *argv[]) return numFailed; } +TEST_CASE("Canny", "[contour]") +{ + int gaussianKernelSize = 3; + float gaussianStdev = 0.5f; + int apertureSize = 3; + // Canny parameters + float lowerThresh = -1.; + float upperThresh = -1.; + float lowerThreshRatio = 0.6f; + float upperThreshRatio = 1.5f; + vpImageFilter::vpCannyFilteringAndGradientType filteringType = vpImageFilter::CANNY_GBLUR_SOBEL_FILTERING; + + vpCannyEdgeDetection cannyDetector(gaussianKernelSize, gaussianStdev, apertureSize, + lowerThresh, upperThresh, lowerThreshRatio, upperThreshRatio, + filteringType); + + vpImage I_gray; + vpImageIo::read(I_gray, "canny.png"); + REQUIRE(I_gray.getSize() > 0); + + vpImage I_canny_visp; + I_canny_visp = cannyDetector.detect(I_gray); + CHECK(I_canny_visp.getSize() > 0); +} + #else int main() { return EXIT_SUCCESS; } #endif diff --git a/modules/core/test/image/data/canny.png b/modules/core/test/image/data/canny.png new file mode 100644 index 0000000000..e0518b8b16 Binary files /dev/null and b/modules/core/test/image/data/canny.png differ