Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 RGBD Node #1198

Open
wants to merge 76 commits into
base: v3_develop
Choose a base branch
from
Open

V3 RGBD Node #1198

wants to merge 76 commits into from

Conversation

Serafadam
Copy link
Contributor

@Serafadam Serafadam commented Dec 18, 2024

  • Host RGBD Node
  • Basalt fixes
  • Using stock TBB for Basalt
  • Added optional Kompute support for performing calculations on GPU devices with Vulkan support

@Serafadam Serafadam requested a review from moratom December 18, 2024 15:44
Copy link
Collaborator

@moratom moratom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Tested it out and it seems to work well:)

I left a few comments for the new additions, but LGTM otherwise.

Comment on lines 303 to 339
// Get the color and depth frames
auto group = inSync.get<MessageGroup>();
if(group == nullptr) continue;
if(!initialized) {
initialize(group);
}
auto colorFrame = std::dynamic_pointer_cast<ImgFrame>(group->group.at(inColor.getName()));
if(colorFrame->getType() != ImgFrame::Type::RGB888i) {
throw std::runtime_error("RGBD node only supports RGB888i frames");
}
auto depthFrame = std::dynamic_pointer_cast<ImgFrame>(group->group.at(inDepth.getName()));

// Create the point cloud
auto pc = std::make_shared<PointCloudData>();
pc->setTimestamp(colorFrame->getTimestamp());
pc->setTimestampDevice(colorFrame->getTimestampDevice());
pc->setSequenceNum(colorFrame->getSequenceNum());
pc->setInstanceNum(colorFrame->getInstanceNum());
auto width = colorFrame->getWidth();
auto height = colorFrame->getHeight();
pc->setSize(width, height);

std::vector<Point3fRGB> points;
// Fill the point cloud
auto* depthData = depthFrame->getData().data();
auto* colorData = colorFrame->getData().data();
// Use GPU to compute point cloud
pimpl->computePointCloud(depthData, colorData, points);

pc->setPointsRGB(points);
pcl.send(pc);
auto rgbdData = std::make_shared<RGBDData>();
rgbdData->depthFrame = *depthFrame;
rgbdData->rgbFrame = *colorFrame;
rgbd.send(rgbdData);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe best to detect for each output RGBD and PCL if it is connected anywhere and only make the PCL / RGBD message if it will be used to save resources.

Comment on lines 20 to 21
ImgFrame rgbFrame;
ImgFrame depthFrame;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it would be best to make this in a similar way as MessageGroup is done for performance reasons.
(so these two would be pointers and serialization would require a specialization)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playing around with it, at least for me, 640x400 provides a better overall experience (the PCLs are dense enough but everything runs at 30 FPS)
Same goes for other examples.

/**
* Output RGBD frames.
*/
Output rgbd{*this, {"rgbd", DEFAULT_GROUP, {{DatatypeEnum::RGBDData, true}}}};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bindings are missing for this one

py::arg("autoCreateCameras"),
py::arg("presetMode") = StereoDepth::PresetMode::HIGH_DENSITY)
py::arg("presetMode") = StereoDepth::PresetMode::HIGH_DENSITY,
py::arg("size") = std::pair<int, int>{1280, 720})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's default to 1280x800 instead, it's the most common resolution for mono cameras.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pointcloud seems to be upside down for me at the beginning, is it upright on your side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in RDF frame convention, maybe that's why?
image

dai::Pipeline pipeline;
auto rgbd = pipeline.create<dai::node::RGBD>()->build(true);

auto outQ = rgbd->pcl.createOutputQueue();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add a test for rgbd as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants