Files
pixelarium/lib/imaging/Image.cpp
T

18 lines
405 B
C++
Raw Normal View History

2025-03-14 19:32:40 +01:00
#include "Image.hpp"
#include <filesystem>
2025-05-23 15:15:01 +02:00
#include <format>
#include <memory>
2025-03-14 19:32:40 +01:00
#include <opencv2/imgcodecs.hpp>
#include <stdexcept>
2025-05-23 15:15:01 +02:00
#include <string_view>
2025-03-14 19:32:40 +01:00
pixelarium::imaging::Image::Image(const std::string& uri)
{
if (!std::filesystem::exists(uri))
{
2025-05-23 15:15:01 +02:00
throw std::runtime_error(std::format("File not {} found", uri));
2025-03-14 19:32:40 +01:00
}
2025-05-23 15:15:01 +02:00
this->_img = std::make_unique<cv::Mat>(cv::imread(uri));
2025-03-14 19:32:40 +01:00
}