14#include <lagrange/fs/filesystem.h>
15#include <lagrange/image/ImageView.h>
16#include <lagrange/image_io/api.h>
19#include <lagrange/utils/warnoff.h>
20#include <spdlog/common.h>
21#include <lagrange/utils/warnon.h>
32 image::ImagePrecision precision = image::ImagePrecision::unknown;
33 image::ImageChannel channel = image::ImageChannel::unknown;
34 std::shared_ptr<image::ImageStorage> storage =
nullptr;
39load_image(
const fs::path& path, spdlog::level::level_enum error_lvl = spdlog::level::err);
43load_image_stb(
const fs::path& path, spdlog::level::level_enum error_lvl = spdlog::level::err);
48load_image_exr(
const fs::path& path, spdlog::level::level_enum error_lvl = spdlog::level::err);
52load_image_bin(
const fs::path& path, spdlog::level::level_enum error_lvl = spdlog::level::err);
59 if (!result.valid)
return false;
61 if (image::ImageTraits<T>::precision == result.precision &&
62 image::ImageTraits<T>::channel == result.channel) {
65 result.storage->get_full_size()(0) /
sizeof(T),
66 result.storage->get_full_size()(1),
73 bool valid_conversion =
false;
74#define LAGRANGE_TMP(PRECISION, CHANNEL, TYPE) \
75 if (image::ImagePrecision::PRECISION == result.precision && \
76 image::ImageChannel::CHANNEL == result.channel) { \
77 image::ImageView<TYPE> temp_image_view( \
79 result.storage->get_full_size()(0) / sizeof(TYPE), \
80 result.storage->get_full_size()(1), \
85 valid_conversion = img.convert_from(temp_image_view, 1); \
87#define LAGRANGE_TMP_COMMA ,
88 LAGRANGE_TMP(uint8, one,
unsigned char)
89 else LAGRANGE_TMP(uint8, three, Eigen::Matrix<unsigned char LAGRANGE_TMP_COMMA 3 LAGRANGE_TMP_COMMA 1>)
else LAGRANGE_TMP(
94 unsigned char LAGRANGE_TMP_COMMA 4 LAGRANGE_TMP_COMMA 1>) else LAGRANGE_TMP(float32, one,
float) else LAGRANGE_TMP(float32, three, Eigen::Vector3f) else LAGRANGE_TMP(float32, four, Eigen::Vector4f) else LAGRANGE_TMP(float64, one,
double) else LAGRANGE_TMP(float64, three, Eigen::Vector3d) else LAGRANGE_TMP(float64, four, Eigen::Vector4d) return valid_conversion;
96#undef LAGRANGE_TMP_COMMA
Definition ImageView.h:56
Main namespace for Lagrange.
Definition load_image.h:28