15 #include <mrpt/containers/yaml.h>
23 const mrpt::containers::yaml& c)
35 "At least one of 'output_layer_low_intensity' or "
36 "'output_layer_low_intensity' or 'output_layer_mid_intensity' must be "
47 MRPT_LOG_DEBUG_STREAM(
"Loading these params:\n" << c);
59 "Input point cloud layer '%s' was not found.",
62 const auto& pc = *pcPtr;
70 pcPtr->GetRuntimeClass()->className);
72 if (outLow) outLow->reserve(outLow->size() + pc.size() / 10);
79 pcPtr->GetRuntimeClass()->className);
81 if (outHigh) outHigh->reserve(outHigh->size() + pc.size() / 10);
88 pcPtr->GetRuntimeClass()->className);
90 if (outMid) outMid->reserve(outMid->size() + pc.size() / 10);
93 outLow || outHigh || outMid,
94 "At least one of 'output_layer_low_intensity' or "
95 "'output_layer_low_intensity' or 'output_layer_mid_intensity' must be "
98 const auto& xs = pc.getPointsBufferRef_x();
101 const auto* ptrI = pc.getPointsBufferRef_intensity();
102 if (!ptrI || ptrI->empty())
105 "Error: this filter needs the input layer '%s' to has an "
111 const auto& Is = *ptrI;
112 ASSERT_EQUAL_(Is.size(), xs.size());
113 const size_t N = xs.size();
115 size_t countLow = 0, countMid = 0, countHigh = 0;
117 for (
size_t i = 0; i < N; i++)
119 const float I = Is[i];
121 mrpt::maps::CPointsMap* trg =
nullptr;
139 if (trg) trg->insertPointFrom(pc, i);
142 MRPT_LOG_DEBUG_STREAM(
143 "[FilterByIntensity] Input points=" << N <<
" low=" << countLow
144 <<
" mid=" << countMid
145 <<
" high=" << countHigh);