40 #include <visp3/core/vpConfig.h>
42 #if defined(VISP_HAVE_CATCH2) && (VISP_HAVE_DATASET_VERSION >= 0x030600)
43 #define CATCH_CONFIG_RUNNER
48 #include <visp3/core/vpIoTools.h>
49 #include <visp3/io/vpImageIo.h>
51 #ifdef ENABLE_VISP_NAMESPACE
59 for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
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()));
70 for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
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()));
78 TEST_CASE(
"HDR PFM image read",
"[hdr_pfm_image_io]")
80 SECTION(
"Little-endian (LSB)")
84 const std::string imgPath =
94 const std::string imgPath =
104 SECTION(
"Big-endian (MSB)")
108 const std::string imgPath =
118 const std::string imgPath =
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);
177 TEST_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 =
201 checkColorImages(I, I_write);
205 const std::string imgPath =
220 checkGrayImages(I, I_write);
227 int main(
int argc,
char *argv[])
229 Catch::Session session;
232 session.applyCommandLine(argc, argv);
234 int numFailed = session.run();
242 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")