NVIDIA DeepStream SDK API Reference

9.2 Release
sources/libs/ds3d/datafilter/depth2point/depth2point_filter_impl.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef DS3D_DATAFILTER_DEPTH_2_POINT_FILTER_IMPL_H
19 #define DS3D_DATAFILTER_DEPTH_2_POINT_FILTER_IMPL_H
20 
21 #include "depth2point_filter.h"
22 
23 #include "ds3d/common/helper/memdata.h"
24 #include "ds3d/common/hpp/datafilter.hpp"
25 #include "ds3d/common/impl/impl_datafilter.h"
26 #include "ds3d/glprocess/gl_render_ctx.h"
27 #include "ds3d/glprocess/window.h"
28 
29 #include "depth2point_config.h"
30 
31 namespace ds3d { namespace impl { namespace filter {
32 
33 using MemPtr = std::unique_ptr<MemData>;
34 
36 public:
37  Depth2PointFilter() = default;
38  ~Depth2PointFilter() override;
39 
40 protected:
42  GuardDataMap datamap, OnGuardDataCBImpl outputDataCb,
43  OnGuardDataCBImpl inputConsumedCb) override;
44  ErrCode stopImpl() override;
45  ErrCode flushImpl() override;
46  ErrCode startImpl(const std::string& content, const std::string& path);
47 
48  ErrCode startTask(const Config& config, std::unique_ptr<gl::iGLRender>&& filter);
49 
50  enum class ItemType {
51  kData,
52  kEvent,
53  };
54 
55  struct QueItem {
57  std::function<ErrCode()> process;
58  std::function<void()> failed;
59  };
60 
61 private:
62  ErrCode processDepthToPoint(
63  Frame2DGuard& depthFrame, bool colorDepthAligned, FrameGuard& pointXyzFrame,
64  FrameGuard& pointUvCoord);
65  void timeoutWaitProcess();
66 
67  Config _config;
68  float _depthScale = 1.0;
69  IntrinsicsParam _depthIntrinsics;
70  IntrinsicsParam _colorIntrinsics;
71  ExtrinsicsParam _d2cExtrinsics;
72  std::shared_ptr<BufferPool<MemPtr>> _pointMem;
73  std::shared_ptr<BufferPool<MemPtr>> _uvMem;
74  volatile bool _inProcess = false;
75 };
76 
77 }}} // namespace ds3d::impl::filter
78 
79 
80 #endif // DS3D_DATAFILTER_DEPTH_2_POINT_FILTER_IMPL_H
ds3d::impl::filter::Config
Definition: sources/libs/ds3d/datafilter/alignment/alignment_config.h:35
ds3d::impl::filter::Depth2PointFilter::QueItem::failed
std::function< void()> failed
Definition: sources/libs/ds3d/datafilter/depth2point/depth2point_filter_impl.h:58
ds3d::impl::filter::Depth2PointFilter::~Depth2PointFilter
~Depth2PointFilter() override
ds3d::impl::filter::Depth2PointFilter::startTask
ErrCode startTask(const Config &config, std::unique_ptr< gl::iGLRender > &&filter)
ds3d::impl::filter::MemPtr
std::unique_ptr< MemData > MemPtr
Definition: sources/libs/ds3d/datafilter/alignment/alignment_impl.h:33
ds3d::impl::filter::Depth2PointFilter::ItemType::kData
@ kData
ds3d::impl::filter::Depth2PointFilter
Definition: sources/libs/ds3d/datafilter/depth2point/depth2point_filter_impl.h:35
ds3d::impl::filter::Depth2PointFilter::QueItem
Definition: sources/libs/ds3d/datafilter/depth2point/depth2point_filter_impl.h:55
ds3d::IntrinsicsParam
Definition: includes/ds3d/common/idatatype.h:134
ds3d::impl::BaseImplDataProcessor< abiDataFilter >::OnGuardDataCBImpl
std::function< void(ErrCode, GuardDataMap)> OnGuardDataCBImpl
Definition: includes/ds3d/common/impl/impl_dataprocess.h:33
depth2point_config.h
ds3d::impl::BaseImplDataFilter
Any custom datafilter must derive from BaseImplDataFilter,.
Definition: includes/ds3d/common/impl/impl_datafilter.h:38
ds3d::ErrCode
ErrCode
Definition: includes/ds3d/common/common.h:47
ds3d::impl::filter::Depth2PointFilter::ItemType::kEvent
@ kEvent
ds3d::GuardDataT
Definition: includes/ds3d/common/hpp/obj.hpp:335
ds3d::impl::filter::Depth2PointFilter::QueItem::process
std::function< ErrCode()> process
Definition: sources/libs/ds3d/datafilter/depth2point/depth2point_filter_impl.h:57
ds3d::impl::filter::Depth2PointFilter::Depth2PointFilter
Depth2PointFilter()=default
ds3d::impl::filter::Depth2PointFilter::processImpl
ErrCode processImpl(GuardDataMap datamap, OnGuardDataCBImpl outputDataCb, OnGuardDataCBImpl inputConsumedCb) override
ds3d::impl::filter::Depth2PointFilter::flushImpl
ErrCode flushImpl() override
ds3d::impl::filter::Depth2PointFilter::startImpl
ErrCode startImpl(const std::string &content, const std::string &path)
ds3d::ExtrinsicsParam
Definition: includes/ds3d/common/idatatype.h:144
ds3d::GuardDataMap
Definition: includes/ds3d/common/hpp/datamap.hpp:27
ds3d::impl::filter::Depth2PointFilter::stopImpl
ErrCode stopImpl() override
ds3d
Definition: includes/ds3d/common/abi_dataprocess.h:25
depth2point_filter.h
ds3d::impl::filter::Depth2PointFilter::QueItem::type
ItemType type
Definition: sources/libs/ds3d/datafilter/depth2point/depth2point_filter_impl.h:56
ds3d::impl::filter::Depth2PointFilter::ItemType
ItemType
Definition: sources/libs/ds3d/datafilter/depth2point/depth2point_filter_impl.h:50