-
Notifications
You must be signed in to change notification settings - Fork 7
Introducing Kinect Fusion as a service #101
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
Comments
|
Work is almost done, I'm writing down extra info here for doc purposes. KinFu performs nicely, but DynaFu throws an assertion error on my machine: opencv/opencv_contrib#2528 (comment) (note OpenGL is a requirement for DynaFu, I had to |
Since this is not documented anywhere, let me stress that OpenCV expects depth frames storing pixel floats that express distances in millimeters. On the other hand, YARP prefers meters. |
Note regarding vision/programs/sceneReconstruction/KinFu.cpp Lines 139 to 145 in d9d0d07
The Anyway, this Phong render is always grayscale. Therefore, I'd rather convert to vision/programs/sceneReconstruction/KinFu.cpp Lines 139 to 146 in a1794ec
|
The following example app queries the point cloud (also with normals) previously generated by this service via manually issued RPC commands ( cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(scene-pc-client LANGUAGES CXX)
find_package(YARP 3.4 REQUIRED os pcl sig)
add_executable(scene-pc-client main.cpp)
target_link_libraries(scene-pc-client YARP::YARP_os YARP::YARP_init YARP::YARP_sig YARP::YARP_pcl ${PCL_LIBRARIES}) #include <yarp/os/LogStream.h>
#include <yarp/os/Network.h>
#include <yarp/os/RpcClient.h>
#include <yarp/os/Vocab.h>
#include <yarp/sig/PointCloud.h>
#include <yarp/pcl/Pcl.h>
constexpr auto VOCAB_GET_POINTS = yarp::os::createVocab('g','p','c');
constexpr auto VOCAB_GET_POINTS_AND_NORMALS = yarp::os::createVocab('g','p','c','n');
int main()
{
yarp::os::Network yarp;
yarp::os::RpcClient rpc;
if (!rpc.open("/sceneClient/rpc:c") || !yarp::os::Network::connect(rpc.getName(), "/sceneReconstruction/rpc:s"))
{
yError() << "unable to establish communication via" << rpc.getName();
return 1;
}
yarp::os::Bottle cmd1 {yarp::os::Value(VOCAB_GET_POINTS, true)};
yarp::sig::PointCloudXYZ cloud;
if (!rpc.write(cmd1, cloud))
{
yError() << "unable to send first command";
return 1;
}
yInfo() << "got cloud of" << cloud.size() << "points";
yarp::pcl::savePCD<yarp::sig::DataXYZ, pcl::PointXYZ>("cloud.pcd", cloud);
yarp::os::Bottle cmd2 {yarp::os::Value(VOCAB_GET_POINTS_AND_NORMALS, true)};
yarp::sig::PointCloudXYZNormal cloudWithNormals;
if (!rpc.write(cmd2, cloudWithNormals))
{
yError() << "unable to send second command";
return 1;
}
yInfo() << "got cloud of" << cloudWithNormals.size() << "points with normals";
yarp::pcl::savePCD<yarp::sig::DataXYZNormal, pcl::PointNormal>("cloudWithNormals.pcd", cloudWithNormals);
return 0;
} Note PCD files can be inspected with |
Done at 44c8df7. The list of RPC commands might be enhanced with a save_to_file command (either PLY or PCD format), which will be addressed in another issue if deemed convenient. |
Found by @jgvictores:
Probably quite equivalent to OpenCV's KinFu (and released two years earlier), also uses TSDF volumes. |
For future reference, OpenCV's rgbd module provides a set of utilities that could render (pun not intended) useful in other applications: docs. Notes: |
Large-scale KinFu implemented at 01598b6. Note OpenCV 4.5.1 is required. |
OpenCV 4.5.3 features colored KinFu: |
Implemented at our end: 26a3a68. Edit: my bad, forgot to set |
OpenCV 4.5.5 (released a few days ago) also features colored point clouds, in addition to colored renders. I have implemented this on our side at 4cd9ed7 (the example has also learned to export colored clouds). It kinda works, but OpenCV does not support GPU colored TSDFs at the time of writing. In result, severely degraded performance can be observed and the algorithm resets on every few frames. Remember to use |
OpenCV 4.0 (mid 2019) features an implementation of the Kinect Fusion algorithm (original paper (2011)). This is a rework of https://github.com/Nerei/kinfu_remake, which is itself a rework of PCL's KinFu. Following new OpenCV's guidelines,
cv::kinfu::KinFu
exploits OpenCL hardware acceleration instead of relying on CUDA alone, thus reaching wider graphics card audiences.In OpenCV 4.2 (Ubuntu Focal),
cv::dynafu::DynaFu
is introduced to target the Dynamic Fusion enhancement (paper (2015), YouTube) for non-rigid scenes. Current master branch (4.5.0-dev) additionally features Kinect Fusion for large scale environments (cv::large_kinfu::LargeKinfu
).These implementations are bundled in the "rgbd" module of https://github.com/opencv/opencv_contrib. It is important to note the original algorithm is patented, therefore OpenCV must be compiled with the
OPENCV_ENABLE_NONFREE
option.The text was updated successfully, but these errors were encountered: