40#include <visp3/core/vpConfig.h>
43#if defined(VISP_HAVE_CATCH2) && (VISP_HAVE_DATASET_VERSION >= 0x030600) && \
44 defined(HAVE_OPENCV_IMGCODECS) && defined(VISP_HAVE_TINYEXR)
46#include <catch_amalgamated.hpp>
50#include <visp3/core/vpEndian.h>
51#include <visp3/core/vpIoTools.h>
52#include <visp3/io/vpImageIo.h>
54#ifdef ENABLE_VISP_NAMESPACE
60#ifdef VISP_LITTLE_ENDIAN
62 float epsilon = std::numeric_limits<float>::epsilon())
65 for (
unsigned int j = 0;
j < I1.
getWidth();
j++) {
74 float epsilon = std::numeric_limits<float>::epsilon())
77 for (
unsigned int j = 0;
j < I1.
getWidth();
j++) {
85TEST_CASE(
"EXR image read",
"[exr_image_io]")
89#ifdef VISP_LITTLE_ENDIAN
101 const std::string imgPath =
107 CHECK(I.getSize() > 0);
108 checkColorImages(I_ref, I);
113 const std::string imgPath =
119 CHECK(I.getSize() > 0);
120 checkColorImages(I_ref, I, 0.00097656f);
126 const std::string imgPathRef =
136 const std::string imgPath =
142 CHECK(I.getSize() > 0);
143 checkGrayImages(I_ref, I);
148 const std::string imgPath =
154 CHECK(I.getSize() > 0);
155 checkGrayImages(I_ref, I, 0.00097656f);
161TEST_CASE(
"EXR image write",
"[exr_image_io]")
163#ifdef VISP_LITTLE_ENDIAN
165 std::string directory_filename_tmp = tmp_dir +
"/testIoEXR_" +
vpTime::getDateTime(
"%Y-%m-%d_%H.%M.%S");
171 const std::string imgPath =
177 REQUIRE(I.getSize() > 0);
183 REQUIRE(I.getHeight() == I_write.
getHeight());
184 REQUIRE(I.getWidth() == I_write.
getWidth());
186 checkColorImages(I, I_write);
191 const std::string imgPath =
197 REQUIRE(I.getSize() > 0);
203 REQUIRE(I.getHeight() == I_write.
getHeight());
204 REQUIRE(I.getWidth() == I_write.
getWidth());
206 checkGrayImages(I, I_write);
214int main(
int argc,
char *argv[])
216 Catch::Session session;
217 session.applyCommandLine(argc, argv);
218 int numFailed = session.run();
222int main() {
return EXIT_SUCCESS; }
static void readPFM_HDR(vpImage< float > &I, const std::string &filename)
static void readEXR(vpImage< float > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
static void writeEXR(const vpImage< float > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
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")