Files
pixelarium/lib/imaging/impl/PixelariumTiff.cpp
T

35 lines
731 B
C++
Raw Normal View History

2025-10-12 21:47:17 +02:00
#include "PixelariumTiff.hpp"
#include <filesystem>
#include <memory>
#include <opencv2/imgcodecs.hpp>
#include <string>
pixelarium::imaging::PixelariumTiff::PixelariumTiff(const std::string& uri, const Log& log) : log_(log)
{
if (!std::filesystem::exists(uri))
{
throw std::runtime_error("Render file not found.");
}
this->is_empty_ = false;
this->uri_ = std::filesystem::path(uri);
}
2026-01-23 23:00:35 +00:00
std::optional<cv::Mat> pixelarium::imaging::PixelariumTiff::TryGetImage()
2025-10-12 21:47:17 +02:00
{
try
{
2026-01-23 23:00:35 +00:00
auto img = cv::Mat(cv::imread(this->uri_.string()));
2025-10-12 21:47:17 +02:00
this->is_empty_ = false;
return img;
}
catch (const std::exception& e)
{
this->is_empty_ = true;
return {};
}
}