Skip to content

Commit

Permalink
Try to reproduce issue in lagadic#1487 thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-trinh committed Oct 29, 2024
1 parent a65eebc commit 66f8479
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
27 changes: 27 additions & 0 deletions modules/core/test/image/catchImageMorphology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include <catch_amalgamated.hpp>
#include <visp3/core/vpImageFilter.h>
#include <visp3/core/vpImageMorphology.h>
#include <visp3/core/vpCannyEdgeDetection.h>
#include <visp3/io/vpImageIo.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
Expand Down Expand Up @@ -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<unsigned char> I_gray;
vpImageIo::read(I_gray, "canny.png");
REQUIRE(I_gray.getSize() > 0);

vpImage<unsigned char> I_canny_visp;
I_canny_visp = cannyDetector.detect(I_gray);
CHECK(I_canny_visp.getSize() > 0);
}

#else
int main() { return EXIT_SUCCESS; }
#endif
Binary file added modules/core/test/image/data/canny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 66f8479

Please sign in to comment.