ExrConverter.cpp
Go to the documentation of this file.
1#include "ExrConverter.h"
2
3// ArmarX
4#include <opencv2/imgcodecs.hpp>
5#include <opencv2/imgproc.hpp>
6#include <opencv2/opencv.hpp>
7
9
11{
14 {
16
18 std::vector<unsigned char> buffer;
19
20 auto shape = data->getShape(); // we know from the extraction that the shape has 3 elements
21 ARMARX_CHECK_EQUAL(shape.size(), 3);
22 ARMARX_CHECK_EQUAL(shape[2], 4);
23
24 cv::imencode(".exr", img, buffer);
25 return {buffer, ""};
26 }
27
30 {
31 cv::Mat img = cv::imdecode(data.data, cv::IMREAD_ANYDEPTH);
33 }
34} // namespace armarx::armem::server::ltm::processor::converter::data::image
ConversionResult _convert(const aron::data::NDArrayPtr &data) final
The Path class.
Definition Path.h:36
static cv::Mat ConvertToMat(const data::NDArrayPtr &)
static data::NDArrayPtr ConvertFromMat(const cv::Mat &, const armarx::aron::Path &={})
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_CHECK_EQUAL(lhs, rhs)
This macro evaluates whether lhs is equal (==) rhs and if it turns out to be false it will throw an E...
std::shared_ptr< NDArray > NDArrayPtr
Definition NDArray.h:46