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
8
#include <
RobotAPI/libraries/aron/converter/opencv/OpenCVConverter.h
>
9
10
namespace
armarx::armem::server::ltm::processor::converter::data::image
11
{
12
ExrConverter::ConversionResult
13
ExrConverter::_convert
(
const
aron::data::NDArrayPtr
&
data
)
14
{
15
ARMARX_CHECK_NOT_NULL
(
data
);
16
17
auto
img =
aron::data::converter::AronOpenCVConverter::ConvertToMat
(
data
);
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
28
aron::data::NDArrayPtr
29
ExrConverter::_convert
(
const
ConversionResult
&
data
,
const
armarx::aron::Path
& p)
30
{
31
cv::Mat img = cv::imdecode(
data
.data, cv::IMREAD_ANYDEPTH);
32
return
aron::data::converter::AronOpenCVConverter::ConvertFromMat
(img, p);
33
}
34
}
// namespace armarx::armem::server::ltm::processor::converter::data::image
ExrConverter.h
ARMARX_CHECK_NOT_NULL
#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...
Definition:
ExpressionException.h:206
armarx::aron::data::NDArrayPtr
std::shared_ptr< NDArray > NDArrayPtr
Definition:
NDArray.h:46
armarx::aron::Path
The Path class.
Definition:
Path.h:36
armarx::aron::data::converter::AronOpenCVConverter::ConvertFromMat
static data::NDArrayPtr ConvertFromMat(const cv::Mat &, const armarx::aron::Path &={})
Definition:
OpenCVConverter.cpp:52
data
uint8_t data[1]
Definition:
EtherCATFrame.h:68
OpenCVConverter.h
armarx::aron::data::converter::AronOpenCVConverter::ConvertToMat
static cv::Mat ConvertToMat(const data::NDArrayPtr &)
Definition:
OpenCVConverter.cpp:33
armarx::armem::server::ltm::processor::converter::data::image
Definition:
ExrConverter.cpp:10
armarx::armem::server::ltm::processor::DataConverter::ConversionResult
Definition:
Converter.h:25
ARMARX_CHECK_EQUAL
#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...
Definition:
ExpressionException.h:130
armarx::armem::server::ltm::processor::converter::data::image::ExrConverter::_convert
ConversionResult _convert(const aron::data::NDArrayPtr &data) final
Definition:
ExrConverter.cpp:13
RobotAPI
libraries
armem
server
ltm
processors
converter
data
image
exr
ExrConverter.cpp
Generated on Sat Oct 12 2024 09:14:08 for armarx_documentation by
1.8.17