36 #include <visp3/core/vpConfig.h> 44 #if defined(VISP_HAVE_CATCH2) 45 #define CATCH_CONFIG_RUNNER 47 #include <visp3/core/vpGaussianFilter.h> 48 #include <visp3/core/vpImageTools.h> 49 #include <visp3/core/vpIoTools.h> 50 #include <visp3/io/vpImageIo.h> 52 TEST_CASE(
"Test vpGaussianFilter (unsigned char)") {
58 std::vector<float> sigmas = {0.5f, 2.0f, 5.0f, 7.0f};
59 for (
auto sigma : sigmas) {
63 gaussianFilter.apply(I, I_blurred);
67 "Gaussian-filter/Klimt_gray_Gaussian_blur_sigma=%.1f.png");
69 sprintf(buffer, filepath_ref.c_str(), sigma);
70 const std::string filename = buffer;
77 std::cout <<
"sigma: " << sigma <<
" ; I_diff_dbl: " << I_diff_dbl.
getMeanValue() << std::endl;
78 const double threshold = 1.5;
83 TEST_CASE(
"Test vpGaussianFilter (vpRGBa)") {
89 std::vector<float> sigmas = {0.5f, 2.0f, 5.0f, 7.0f};
90 for (
auto sigma : sigmas) {
94 gaussianFilter.apply(I, I_blurred);
98 "Gaussian-filter/Klimt_RGB_Gaussian_blur_sigma=%.1f.png");
100 sprintf(buffer, filepath_ref.c_str(), sigma);
101 const std::string filename = buffer;
114 std::cout <<
"sigma: " << sigma <<
" ; I_diff_R_dbl: " << I_diff_R_dbl.
getMeanValue() <<
" ; I_diff_G_dbl: " 116 const double threshold = 1.5;
123 TEST_CASE(
"Test vpGaussianFilter (vpRGBa + deinterleave)") {
129 std::vector<float> sigmas = {0.5f, 2.0f, 5.0f, 7.0f};
130 for (
auto sigma : sigmas) {
131 const bool deinterleave =
true;
135 gaussianFilter.apply(I, I_blurred);
139 "Gaussian-filter/Klimt_RGB_Gaussian_blur_sigma=%.1f.png");
141 sprintf(buffer, filepath_ref.c_str(), sigma);
142 const std::string filename = buffer;
155 std::cout <<
"sigma: " << sigma <<
" ; I_diff_R_dbl: " << I_diff_R_dbl.
getMeanValue() <<
" ; I_diff_G_dbl: " 157 const double threshold = 1.5;
164 int main(
int argc,
char *argv[])
166 Catch::Session session;
169 session.applyCommandLine(argc, argv);
171 int numFailed = session.run();
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
static void split(const vpImage< vpRGBa > &src, vpImage< unsigned char > *pR, vpImage< unsigned char > *pG, vpImage< unsigned char > *pB, vpImage< unsigned char > *pa=NULL)
static void read(vpImage< unsigned char > &I, const std::string &filename)
Type getMeanValue() const
Return the mean value of the bitmap.
unsigned int getHeight() const