42 #include <visp3/core/vpConfig.h>
44 #if defined(VISP_HAVE_CATCH2) && (VISP_HAVE_DATASET_VERSION >= 0x030600)
45 #define CATCH_CONFIG_RUNNER
50 #include <visp3/core/vpIoTools.h>
51 #include <visp3/io/vpImageIo.h>
57 for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
58 for (
unsigned int j = 0; j < I1.
getWidth(); j++) {
59 REQUIRE(
vpMath::equal(I1[i][j].R, I2[i][j].R, std::numeric_limits<float>::epsilon()));
60 REQUIRE(
vpMath::equal(I1[i][j].G, I2[i][j].G, std::numeric_limits<float>::epsilon()));
61 REQUIRE(
vpMath::equal(I1[i][j].B, I2[i][j].B, std::numeric_limits<float>::epsilon()));
68 for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
69 for (
unsigned int j = 0; j < I1.
getWidth(); j++) {
70 REQUIRE(
vpMath::equal(I1[i][j], I2[i][j], std::numeric_limits<float>::epsilon()));
76 TEST_CASE(
"HDR PFM image read",
"[hdr_pfm_image_io]")
78 SECTION(
"Little-endian (LSB)")
82 const std::string imgPath =
92 const std::string imgPath =
102 SECTION(
"Big-endian (MSB)")
106 const std::string imgPath =
116 const std::string imgPath =
126 SECTION(
"Endianness")
130 const std::string imgPathLSB =
132 const std::string imgPathMSB =
148 checkColorImages(I_LSB, I_MSB);
152 const std::string imgPathLSB =
154 const std::string imgPathMSB =
170 checkGrayImages(I_LSB, I_MSB);
175 TEST_CASE(
"HDR PFM image write",
"[hdr_pfm_image_io]")
178 std::string directory_filename_tmp = tmp_dir +
"/testIoPFM_" +
vpTime::getDateTime(
"%Y-%m-%d_%H.%M.%S");
184 const std::string imgPath =
199 checkColorImages(I, I_write);
203 const std::string imgPath =
218 checkGrayImages(I, I_write);
225 int main(
int argc,
char *argv[])
227 Catch::Session session;
230 session.applyCommandLine(argc, argv);
232 int numFailed = session.run();
240 int 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")