Test image I/O for PFM file format.
#include <visp3/core/vpConfig.h>
#if defined(VISP_HAVE_CATCH2) && (VISP_HAVE_DATASET_VERSION >= 0x030600)
#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <iostream>
#include <limits>
#include <visp3/core/vpIoTools.h>
#include <visp3/io/vpImageIo.h>
#ifdef ENABLE_VISP_NAMESPACE
#endif
namespace
{
{
for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
for (
unsigned int j = 0; j < I1.
getWidth(); j++) {
REQUIRE(
vpMath::equal(I1[i][j].R, I2[i][j].R, std::numeric_limits<float>::epsilon()));
REQUIRE(
vpMath::equal(I1[i][j].G, I2[i][j].G, std::numeric_limits<float>::epsilon()));
REQUIRE(
vpMath::equal(I1[i][j].B, I2[i][j].B, std::numeric_limits<float>::epsilon()));
}
}
}
{
for (
unsigned int i = 0; i < I1.
getHeight(); i++) {
for (
unsigned int j = 0; j < I1.
getWidth(); j++) {
REQUIRE(
vpMath::equal(I1[i][j], I2[i][j], std::numeric_limits<float>::epsilon()));
}
}
}
}
TEST_CASE("HDR PFM image read", "[hdr_pfm_image_io]")
{
SECTION("Little-endian (LSB)")
{
SECTION("Color")
{
const std::string imgPath =
}
SECTION("Gray")
{
const std::string imgPath =
}
}
SECTION("Big-endian (MSB)")
{
SECTION("Color")
{
const std::string imgPath =
}
SECTION("Gray")
{
const std::string imgPath =
}
}
SECTION("Endianness")
{
SECTION("Color")
{
const std::string imgPathLSB =
const std::string imgPathMSB =
checkColorImages(I_LSB, I_MSB);
}
SECTION("Gray")
{
const std::string imgPathLSB =
const std::string imgPathMSB =
checkGrayImages(I_LSB, I_MSB);
}
}
}
TEST_CASE("HDR PFM image write", "[hdr_pfm_image_io]")
{
std::string directory_filename_tmp = tmp_dir +
"/testIoPFM_" +
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);
}
}
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 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")