Use the SDK interface to transform different coordinate systems.
Pipeline is a pipeline for processing data streams, providing multi-channel stream configuration, switching, frame aggregation, and frame synchronization functions
Frameset is a combination of different types of Frames
-
Enable color stream
auto colorProfiles = pipe.getStreamProfileList(OB_SENSOR_COLOR); if(colorProfiles) { colorProfile = colorProfiles->getVideoStreamProfile(1280, OB_HEIGHT_ANY, OB_FORMAT_RGB, 30); } config->enableStream(colorProfile);
-
Enable depth stream
auto depthProfiles = pipe.getStreamProfileList(OB_SENSOR_DEPTH); std::shared_ptr<ob::VideoStreamProfile> depthProfile = nullptr; if(depthProfiles) { depthProfile = depthProfiles->getVideoStreamProfile(640, OB_HEIGHT_ANY, OB_FORMAT_Y16, 30); } config->enableStream(depthProfile);
-
Get frame data
auto colorFrame = frameSet->colorFrame(); auto depthFrame = frameSet->depthFrame();
-
Get get stream profile
auto colorProfile = colorFrame->getStreamProfile(); auto depthProfile = depthFrame->getStreamProfile();
-
Get the extrinsic parameters
auto extrinsicD2C = depthProfile->getExtrinsicTo(colorProfile); auto extrinsicC2D = colorProfile->getExtrinsicTo(depthProfile);
-
Get the intrinsic parameters
auto colorIntrinsic = colorProfile->as<ob::VideoStreamProfile>()->getIntrinsic(); auto colorDistortion = colorProfile->as<ob::VideoStreamProfile>()->getDistortion();
-
Get the distortion parameters
auto depthIntrinsic = depthProfile->as<ob::VideoStreamProfile>()->getIntrinsic(); auto depthDistortion = depthProfile->as<ob::VideoStreamProfile>()->getDistortion();
-
Processing
if(testType == "1") { transformation2dto2d(colorFrame, depthFrame); } else if (testType == "2") { transformation2dto3d(colorFrame, depthFrame); } else if (testType == "3") { transformation3dto3d(colorFrame, depthFrame); } else if (testType == "4") { transformation3dto2d(colorFrame, depthFrame); } else { std::cout << "Invalid command" << std::endl; }
Press the Esc key to exit the program. Press the 1 key - transformation 2d to 2d Press the 2 key - transformation 2d to 3d Press the 3 key - transformation 3d to 3d Press the 4 key - transformation 3d to 2d