Test image I/O for EXR file format.
#include <visp3/core/vpConfig.h>
#if defined(VISP_HAVE_CATCH2) && (VISP_HAVE_DATASET_VERSION >= 0x030600) && \
defined(HAVE_OPENCV_IMGCODECS) && defined(VISP_HAVE_TINYEXR)
#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <iostream>
#include <limits>
#include <visp3/core/vpEndian.h>
#include <visp3/core/vpIoTools.h>
#include <visp3/io/vpImageIo.h>
#ifdef ENABLE_VISP_NAMESPACE
#endif
namespace
{
#ifdef VISP_LITTLE_ENDIAN
float epsilon = std::numeric_limits<float>::epsilon())
{
for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
for (
unsigned int j = 0; j < I1.
getWidth(); j++) {
}
}
}
float epsilon = std::numeric_limits<float>::epsilon())
{
for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
for (
unsigned int j = 0; j < I1.
getWidth(); j++) {
}
}
}
#endif
}
TEST_CASE("EXR image read", "[exr_image_io]")
{
#ifdef VISP_LITTLE_ENDIAN
SECTION("Color")
{
SECTION("32-bits")
{
const std::string imgPath =
checkColorImages(I_ref, I);
}
SECTION("16-bits")
{
const std::string imgPath =
checkColorImages(I_ref, I, 0.00097656f);
}
}
SECTION("Gray")
{
const std::string imgPathRef =
SECTION("32-bits")
{
const std::string imgPath =
checkGrayImages(I_ref, I);
}
SECTION("16-bits")
{
const std::string imgPath =
checkGrayImages(I_ref, I, 0.00097656f);
}
}
#endif
}
TEST_CASE("EXR image write", "[exr_image_io]")
{
#ifdef VISP_LITTLE_ENDIAN
std::string directory_filename_tmp = tmp_dir +
"/testIoEXR_" +
vpTime::getDateTime(
"%Y-%m-%d_%H.%M.%S");
SECTION("Color")
{
const std::string imgPath =
checkColorImages(I, I_write);
}
SECTION("Gray")
{
const std::string imgPath =
checkGrayImages(I, I_write);
}
#endif
}
int main(int argc, char *argv[])
{
Catch::Session session;
session.applyCommandLine(argc, argv);
int numFailed = session.run();
return numFailed;
}
#else
int main() { return EXIT_SUCCESS; }
#endif
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")