Test Gaussian filter.
#include <visp3/core/vpConfig.h>
#if defined(VISP_HAVE_CATCH2)
#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <visp3/core/vpGaussianFilter.h>
#include <visp3/core/vpImageTools.h>
#include <visp3/core/vpIoTools.h>
#include <visp3/io/vpImageIo.h>
TEST_CASE("Test vpGaussianFilter (unsigned char)") {
"Klimt/Klimt.pgm");
std::vector<float> sigmas = {0.5f, 2.0f, 5.0f, 7.0f};
for (auto sigma : sigmas) {
gaussianFilter.apply(I, I_blurred);
"Gaussian-filter/Klimt_gray_Gaussian_blur_sigma=%.1f.png");
char buffer[256];
sprintf(buffer, filepath_ref.c_str(), sigma);
const std::string filename = buffer;
std::cout <<
"sigma: " << sigma <<
" ; I_diff_dbl: " << I_diff_dbl.
getMeanValue() << std::endl;
const double threshold = 1.5;
}
}
TEST_CASE("Test vpGaussianFilter (vpRGBa)") {
"Klimt/Klimt.ppm");
std::vector<float> sigmas = {0.5f, 2.0f, 5.0f, 7.0f};
for (auto sigma : sigmas) {
gaussianFilter.apply(I, I_blurred);
"Gaussian-filter/Klimt_RGB_Gaussian_blur_sigma=%.1f.png");
char buffer[256];
sprintf(buffer, filepath_ref.c_str(), sigma);
const std::string filename = buffer;
std::cout <<
"sigma: " << sigma <<
" ; I_diff_R_dbl: " << I_diff_R_dbl.
getMeanValue() <<
" ; I_diff_G_dbl: " const double threshold = 1.5;
}
}
TEST_CASE("Test vpGaussianFilter (vpRGBa + deinterleave)") {
"Klimt/Klimt.ppm");
std::vector<float> sigmas = {0.5f, 2.0f, 5.0f, 7.0f};
for (auto sigma : sigmas) {
const bool deinterleave = true;
gaussianFilter.apply(I, I_blurred);
"Gaussian-filter/Klimt_RGB_Gaussian_blur_sigma=%.1f.png");
char buffer[256];
sprintf(buffer, filepath_ref.c_str(), sigma);
const std::string filename = buffer;
std::cout <<
"sigma: " << sigma <<
" ; I_diff_R_dbl: " << I_diff_R_dbl.
getMeanValue() <<
" ; I_diff_G_dbl: " const double threshold = 1.5;
}
}
int main(int argc, char *argv[])
{
Catch::Session session;
session.applyCommandLine(argc, argv);
int numFailed = session.run();
return numFailed;
}
#else
int main()
{
return 0;
}
#endif