I was referring to the example which demonstrates how to visualize an on-device created point cloud using DepthAI in C++ and was able to visualize the point cloud (without color data) in PCL Visualizer.
Now, I want to create and visualize the point cloud with color data in C++. I modified the original example script to add a color camera pipeline and synced the the color and pointcloud stream
auto pipeline = dai::Pipeline();
auto camrgb = pipeline.create<dai::node::ColorCamera>();
auto monoLeft = pipeline.create<dai::node::MonoCamera>();
auto monoRight = pipeline.create<dai::node::MonoCamera>();
auto depth = pipeline.create<dai::node::StereoDepth>();
auto pointcloud = pipeline.create<dai::node::PointCloud>();
auto sync = pipeline.create<dai::node::Sync>();
auto xout = pipeline.create<dai::node::XLinkOut>();
xout->input.setBlocking(false);
auto xoutDepth = pipeline.create<dai::node::XLinkOut>();
camrgb->setResolution(dai::ColorCameraProperties::SensorResolution::THE_800_P);
camrgb->setBoardSocket(dai::CameraBoardSocket::CAM_A);
monoLeft->setResolution(dai::MonoCameraProperties::SensorResolution::THE_400_P);
monoLeft->setCamera("left");
monoRight->setResolution(dai::MonoCameraProperties::SensorResolution::THE_400_P);
monoRight->setCamera("right");
// Create a node that will produce the depth map (using disparity output as // it's easier to visualize depth this way)
depth->setDefaultProfilePreset(dai::node::StereoDepth::PresetMode::HIGH_DENSITY);
depth->initialConfig.setMedianFilter(dai::MedianFilter::KERNEL_7x7);
depth->setLeftRightCheck(true); depth->setExtendedDisparity(false);
depth->setSubpixel(true); depth->setDepthAlign(dai::CameraBoardSocket::CAM_A);
xoutDepth->setStreamName("depth");
monoLeft->out.link(depth->left);
monoRight->out.link(depth->right);
depth->depth.link(pointcloud->inputDepth);
camrgb->isp.link(sync->inputs["rgb"]);
pointcloud->outputPointCloud.link(sync->inputs["pcl"]);
sync->out.link(xout->input);
xout->setStreamName("out");
When I try to get the output point cloud data by doing the following, I get the output as "No data" which means that its not able to get the point cloud with color data from the device.
auto q = device.getOutputQueue("out", 8, false);
auto pclMsg = q->get<dai::PointCloudData>();
std::cout << "Got data" << std::endl;
if(!pclMsg)
{
std::cout << "No data" << std::endl;
continue;
}
Also, if the above problem is resolved and I get the point cloud with color data, how do I visualize the point cloud data in PCL visualizer since the getPclData() method only contains points with x,y and z information?