Fix depth filter process when frame is nullptr

This commit is contained in:
Joe Dong
2024-05-11 15:28:19 +08:00
parent e2fec5a2a2
commit 5646cae16f
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -117,6 +117,7 @@ set(COMMON_LIBRARIES
-lOrbbecSDK
-L${ORBBEC_LIBS_DIR}
Threads::Threads
-lrt
)
if (USE_RK_HW_DECODER)
list(APPEND COMMON_LIBRARIES
+4 -4
View File
@@ -1255,7 +1255,7 @@ std::shared_ptr<ob::Frame> OBCameraNode::processDepthFrameFilter(
for (size_t i = 0; i < filter_list->count(); i++) {
auto filter = filter_list->getFilter(i);
CHECK_NOTNULL(filter.get());
if (filter->isEnabled()) {
if (filter->isEnabled() && frame != nullptr) {
frame = filter->process(frame);
if (frame == nullptr) {
RCLCPP_ERROR_STREAM(logger_, "Depth filter process failed");
@@ -1286,9 +1286,9 @@ void OBCameraNode::onNewFrameSetCallback(std::shared_ptr<ob::FrameSet> frame_set
auto device_info = device_->getDeviceInfo();
CHECK_NOTNULL(device_info.get());
auto pid = device_info->pid();
auto color_frame = frame_set->getFrame(OB_FRAME_COLOR);
if (isGemini335PID(pid)) {
if (depth_registration_ && align_filter_ && depth_frame_) {
if (depth_registration_ && align_filter_ && depth_frame_ && color_frame) {
auto new_frame = align_filter_->process(frame_set);
if (new_frame) {
auto new_frame_set = new_frame->as<ob::FrameSet>();
@@ -1298,7 +1298,7 @@ void OBCameraNode::onNewFrameSetCallback(std::shared_ptr<ob::FrameSet> frame_set
}
depth_frame_ = processDepthFrameFilter(depth_frame_);
}
auto color_frame = frame_set->getFrame(OB_FRAME_COLOR);
if (enable_stream_[COLOR] && color_frame) {
std::unique_lock<std::mutex> lock(color_frame_queue_lock_);
color_frame_queue_.push(frame_set);