40#include <visp3/core/vpConfig.h>
42#if defined(VISP_HAVE_CATCH2) && (VISP_HAVE_DATASET_VERSION >= 0x030600)
44#include <catch_amalgamated.hpp>
48#include <visp3/core/vpIoTools.h>
49#include <visp3/io/vpImageIo.h>
51#ifdef ENABLE_VISP_NAMESPACE
60 for (
unsigned int j = 0;
j < I1.
getWidth();
j++) {
61 REQUIRE(
vpMath::equal(I1[i][j].R, I2[i][j].R, std::numeric_limits<float>::epsilon()));
62 REQUIRE(
vpMath::equal(I1[i][j].G, I2[i][j].G, std::numeric_limits<float>::epsilon()));
63 REQUIRE(
vpMath::equal(I1[i][j].B, I2[i][j].B, std::numeric_limits<float>::epsilon()));
71 for (
unsigned int j = 0;
j < I1.
getWidth();
j++) {
72 REQUIRE(
vpMath::equal(I1[i][j], I2[i][j], std::numeric_limits<float>::epsilon()));
78TEST_CASE(
"HDR PFM image read",
"[hdr_pfm_image_io]")
80 SECTION(
"Little-endian (LSB)")
84 const std::string imgPath =
90 CHECK(I.getSize() > 0);
94 const std::string imgPath =
100 CHECK(I.getSize() > 0);
104 SECTION(
"Big-endian (MSB)")
108 const std::string imgPath =
114 CHECK(I.getSize() > 0);
118 const std::string imgPath =
124 CHECK(I.getSize() > 0);
128 SECTION(
"Endianness")
132 const std::string imgPathLSB =
134 const std::string imgPathMSB =
150 checkColorImages(I_LSB, I_MSB);
154 const std::string imgPathLSB =
156 const std::string imgPathMSB =
172 checkGrayImages(I_LSB, I_MSB);
177TEST_CASE(
"HDR PFM image write",
"[hdr_pfm_image_io]")
180 std::string directory_filename_tmp = tmp_dir +
"/testIoPFM_" +
vpTime::getDateTime(
"%Y-%m-%d_%H.%M.%S");
186 const std::string imgPath =
192 REQUIRE(I.getSize() > 0);
198 REQUIRE(I.getHeight() == I_write.
getHeight());
199 REQUIRE(I.getWidth() == I_write.
getWidth());
201 checkColorImages(I, I_write);
205 const std::string imgPath =
211 REQUIRE(I.getSize() > 0);
217 REQUIRE(I.getHeight() == I_write.
getHeight());
218 REQUIRE(I.getWidth() == I_write.
getWidth());
220 checkGrayImages(I, I_write);
227int main(
int argc,
char *argv[])
229 Catch::Session session;
230 session.applyCommandLine(argc, argv);
231 int numFailed = session.run();
235int main() {
return EXIT_SUCCESS; }
static void readPFM_HDR(vpImage< float > &I, const std::string &filename)
static void writePFM_HDR(const vpImage< float > &I, const std::string &filename)
Definition of the vpImage class member functions.
unsigned int getWidth() const
unsigned int getSize() const
unsigned int getHeight() const
static bool equal(double x, double y, double threshold=0.001)
VISP_EXPORT std::string getDateTime(const std::string &format="%Y/%m/%d %H:%M:%S")