40 #include <visp3/core/vpConfig.h>
42 #if defined(VISP_HAVE_SIMDLIB) && defined(VISP_HAVE_CATCH2) && (VISP_HAVE_DATASET_VERSION >= 0x030400)
43 #define CATCH_CONFIG_RUNNER
45 #include <visp3/core/vpGaussianFilter.h>
46 #include <visp3/core/vpImageTools.h>
47 #include <visp3/core/vpIoTools.h>
48 #include <visp3/io/vpImageIo.h>
50 #ifdef ENABLE_VISP_NAMESPACE
54 TEST_CASE(
"Test vpGaussianFilter (unsigned char)")
60 std::vector<float> sigmas = { 0.5f, 2.0f, 5.0f, 7.0f };
61 for (
auto sigma : sigmas) {
65 gaussianFilter.apply(I, I_blurred);
70 char buffer[FILENAME_MAX];
71 snprintf(buffer, FILENAME_MAX, filepath_ref.c_str(), sigma);
72 const std::string filename = buffer;
79 std::cout <<
"sigma: " << sigma <<
" ; I_diff_dbl: " << I_diff_dbl.
getMeanValue() << std::endl;
80 const double threshold = 1.5;
85 TEST_CASE(
"Test vpGaussianFilter (vpRGBa)")
91 std::vector<float> sigmas = { 0.5f, 2.0f, 5.0f, 7.0f };
92 for (
auto sigma : sigmas) {
96 gaussianFilter.apply(I, I_blurred);
101 char buffer[FILENAME_MAX];
102 snprintf(buffer, FILENAME_MAX, filepath_ref.c_str(), sigma);
103 const std::string filename = buffer;
116 std::cout <<
"sigma: " << sigma <<
" ; I_diff_R_dbl: " << I_diff_R_dbl.
getMeanValue()
118 <<
" ; I_diff_B_dbl: " << I_diff_B_dbl.
getMeanValue() << std::endl;
119 const double threshold = 1.5;
126 TEST_CASE(
"Test vpGaussianFilter (vpRGBa + deinterleave)")
132 std::vector<float> sigmas = { 0.5f, 2.0f, 5.0f, 7.0f };
133 for (
auto sigma : sigmas) {
134 const bool deinterleave =
true;
138 gaussianFilter.apply(I, I_blurred);
143 char buffer[FILENAME_MAX];
144 snprintf(buffer, FILENAME_MAX, filepath_ref.c_str(), sigma);
145 const std::string filename = buffer;
158 std::cout <<
"sigma: " << sigma <<
" ; I_diff_R_dbl: " << I_diff_R_dbl.
getMeanValue()
160 <<
" ; I_diff_B_dbl: " << I_diff_B_dbl.
getMeanValue() << std::endl;
161 const double threshold = 1.5;
168 int main(
int argc,
char *argv[])
170 Catch::Session session;
173 session.applyCommandLine(argc, argv);
175 int numFailed = session.run();
183 int main() {
return EXIT_SUCCESS; }
static void split(const vpImage< vpRGBa > &src, vpImage< unsigned char > *pR, vpImage< unsigned char > *pG, vpImage< unsigned char > *pB, vpImage< unsigned char > *pa=nullptr)
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
unsigned int getWidth() const
unsigned int getHeight() const
double getMeanValue(const vpImage< bool > *p_mask=nullptr, unsigned int *nbValidPoints=nullptr) const
Return the mean value of the bitmap.