DepthImageExtractor.cpp
Go to the documentation of this file.
1
#include "
DepthImageExtractor.h
"
2
3
4
namespace
armarx::armem::server::ltm::processor::extractor
5
{
6
void
DepthImageExtractorVisitor::visitDictOnEnter
(
Input
&
data
)
7
{
8
ARMARX_CHECK_NOT_NULL
(
data
);
9
10
auto
dict =
aron::data::Dict::DynamicCastAndCheck
(
data
);
11
for
(
const
auto
& [key, child] : dict->getElements())
12
{
13
if
(child && child->getDescriptor() ==
aron::data::Descriptor::NDARRAY
)
14
{
15
auto
ndarray =
aron::data::NDArray::DynamicCastAndCheck
(child);
16
auto
shape = ndarray->getShape();
17
if
(shape.size() == 3 && shape[2] == 4 && std::accumulate(std::begin(shape), std::end(shape), 1, std::multiplies<int>()) > 200)
// must be big enough to assume an image (instead of 4x4x4 poses)
18
{
19
depthImages
[key] = ndarray;
20
dict->setElement(key,
nullptr
);
21
}
22
}
23
}
24
}
25
26
void
DepthImageExtractorVisitor::visitUnknown
(
Input
&)
27
{
28
// A member is null. Simply ignore...
29
}
30
31
Extractor::ExtractionResult
DepthImageExtractor::extract
(
aron::data::DictPtr
&
data
)
32
{
33
DepthImageExtractorVisitor
visitor;
34
aron::data::VariantPtr
var = std::static_pointer_cast<aron::data::Variant>(
data
);
35
aron::data::VariantPtr
p;
36
aron::data::visitRecursive
(visitor, var);
37
38
ExtractionResult
encoding;
39
encoding.
dataWithoutExtraction
=
data
;
40
encoding.
extraction
= visitor.
depthImages
;
41
return
encoding;
42
}
43
44
aron::data::DictPtr
DepthImageExtractor::merge
(
ExtractionResult
& encoding)
45
{
46
return
encoding.
dataWithoutExtraction
;
47
}
48
}
armarx::armem::server::ltm::processor::extractor::DepthImageExtractor::merge
aron::data::DictPtr merge(ExtractionResult &encoding) override
Definition:
DepthImageExtractor.cpp:44
armarx::aron::data::Descriptor::NDARRAY
@ NDARRAY
armarx::armem::server::ltm::processor::extractor::DepthImageExtractorVisitor
Definition:
DepthImageExtractor.h:10
armarx::armem::server::ltm::processor::Extractor::ExtractionResult::dataWithoutExtraction
aron::data::DictPtr dataWithoutExtraction
Definition:
Extractor.h:20
armarx::armem::server::ltm::processor::extractor
Definition:
DepthImageExtractor.cpp:4
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::RecursiveVisitor< data::VariantPtr >::Input
typename VisitorBase< data::VariantPtr >::Input Input
Definition:
RecursiveVisitor.h:39
armarx::aron::data::detail::SpecializedVariantBase< data::dto::Dict, Dict >::DynamicCastAndCheck
static PointerType DynamicCastAndCheck(const VariantPtr &n)
Definition:
SpecializedVariant.h:135
armarx::armem::server::ltm::processor::extractor::DepthImageExtractorVisitor::visitDictOnEnter
void visitDictOnEnter(Input &data)
Definition:
DepthImageExtractor.cpp:6
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition:
forward_declarations.h:11
armarx::armem::server::ltm::processor::extractor::DepthImageExtractor::extract
ExtractionResult extract(aron::data::DictPtr &data) override
Definition:
DepthImageExtractor.cpp:31
data
uint8_t data[1]
Definition:
EtherCATFrame.h:68
armarx::armem::server::ltm::processor::extractor::DepthImageExtractorVisitor::depthImages
std::map< std::string, aron::data::VariantPtr > depthImages
Definition:
DepthImageExtractor.h:13
armarx::armem::server::ltm::processor::Extractor::ExtractionResult
Definition:
Extractor.h:18
DepthImageExtractor.h
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition:
Dict.h:41
armarx::armem::server::ltm::processor::extractor::DepthImageExtractorVisitor::visitUnknown
void visitUnknown(Input &data)
Definition:
DepthImageExtractor.cpp:26
armarx::armem::server::ltm::processor::Extractor::ExtractionResult::extraction
std::map< std::string, aron::data::VariantPtr > extraction
Definition:
Extractor.h:21
armarx::aron::data::visitRecursive
requires isRecursiveVisitor< RecursiveVisitorImplementation, typename RecursiveVisitorImplementation::Input > void visitRecursive(RecursiveVisitorImplementation &v, typename RecursiveVisitorImplementation::Input &o)
Definition:
RecursiveVisitor.h:146
RobotAPI
libraries
armem
server
ltm
processors
extractor
imageExtractor
DepthImageExtractor.cpp
Generated on Sat Oct 12 2024 09:14:08 for armarx_documentation by
1.8.17