can render 2 cv::mats

This commit is contained in:
Kueffner, Maximilian
2025-03-14 19:32:40 +01:00
parent 5ecc38a9ca
commit 0b541348b0
15 changed files with 290 additions and 12 deletions
+23
View File
@@ -0,0 +1,23 @@
include(${CMAKE_SOURCE_DIR}/cmake/libCZI.cmake)
find_package(OpenCV REQUIRED)
message(STATUS "Found opencv: " ${OpenCV_INCLUDE_DIRS})
message(STATUS "OpenCV_LIBs from: " ${OpenCV_LIBS})
set(IMAGELIBSRC
Image.cpp)
set(IMAGELIBLIBNAME pixelariumimagelib)
add_library(${IMAGELIBLIBNAME}
STATIC ${IMAGELIBSRC})
target_link_libraries(${IMAGELIBLIBNAME}
PUBLIC ${OpenCV_LIBS}
PRIVATE libCZIStatic)
target_include_directories(${IMAGELIBLIBNAME}
PUBLIC ${OpenCV_INCLUDE_DIRS}
PRIVATE ${LIBCZI_INCLUDE_DIR})
+15
View File
@@ -0,0 +1,15 @@
#include "Image.hpp"
#include <filesystem>
#include <opencv2/imgcodecs.hpp>
#include <stdexcept>
pixelarium::imaging::Image::Image(const std::string& uri)
{
if (!std::filesystem::exists(uri))
{
throw std::runtime_error("File not found");
}
this->_img = cv::imread(uri);
}
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <filesystem>
#include <memory>
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <string>
namespace pixelarium::imaging
{
class Image
{
public:
explicit Image(const std::string& uri);
// get back the defaults
Image() = default;
Image(const Image& other) = default;
Image(Image&& other) noexcept = default;
Image& operator=(const Image& other) = default;
Image& operator=(Image&& other) noexcept = default;
~Image() = default;
const cv::Mat& GetImage() const { return this->_img; }
private:
cv::Mat _img;
};
} // namespace pixelarium::imaging