Hello everyone,
I’m executing the example “PointCloud” with the camera connected by Ethernet but the points coordinates take two values combination: (0,0,0) or (inf, -inf, z value).
I want to show the correct 3D world coordinates… what I wrong?
ob::Context obCtx;
std::string ip = "192.168.1.10";
auto device = obCtx.createNetDevice(ip.c_str(), 8090);
auto pipeline= std::make_shared<ob::Pipeline>(device);
std::shared_ptr<ob::Config> config = std::make_shared<ob::Config>();
auto depthProfileList = pipeline.getStreamProfileList(OB_SENSOR_DEPTH);
auto depthProfile = depthProfileList->getProfile(0)->as<ob::VideoStreamProfile>();
config->enableStream(depthProfile);
ob::PointCloudFilter pointCloud;
pointCloud.setCreatePointFormat(OB_FORMAT_POINT);
auto cameraParam = pipeline.getCameraParam();
pointCloud.setCameraParam(cameraParam);
pipeline.start(config);
while(true) {
auto frameset = pipeline.waitForFrames(100);
if(frameset != nullptr && frameset->depthFrame() != nullptr) {
try {
std::shared_ptr<ob::Frame> frame = pointCloud.process(frameset);
int pointsSize = frame->dataSize() / sizeof(OBPoint);
OBPoint *point = (OBPoint *)frame->data();
for(int i = 0; i < pointsSize; i++) {
fprintf(fp, "%.3f %.3f %.3f\n", point->x, point->y, point->z);
point++;
}
}
catch(std::exception &e) {
std::cout << "Get point cloud failed" << std::endl;
}
break;
}
}
pipeline->stop();