Skip to content

Instantly share code, notes, and snippets.

@jolesinski
Created December 22, 2014 11:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jolesinski/8664fe63ff5014c74495 to your computer and use it in GitHub Desktop.
Save jolesinski/8664fe63ff5014c74495 to your computer and use it in GitHub Desktop.
pcl_kinfu_app for NVIDIA Jetson TK1 - git diff to PCL trunk
diff --git a/cmake/pcl_find_cuda.cmake b/cmake/pcl_find_cuda.cmake
index 2f0425e..765f8aa 100644
--- a/cmake/pcl_find_cuda.cmake
+++ b/cmake/pcl_find_cuda.cmake
@@ -35,7 +35,7 @@ if(CUDA_FOUND)
# Find a complete list for CUDA compute capabilities at http://developer.nvidia.com/cuda-gpus
if(${CUDA_VERSION_STRING} VERSION_GREATER "4.1")
- set(CUDA_ARCH_BIN "2.0 2.1(2.0) 3.0" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
+ set(CUDA_ARCH_BIN "2.0 2.1(2.0) 3.0 3.2 5.0 5.2" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
else()
set(CUDA_ARCH_BIN "2.0 2.1(2.0)" CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")
endif()
diff --git a/gpu/containers/src/initialization.cpp b/gpu/containers/src/initialization.cpp
index e03cfd5..767d536 100644
--- a/gpu/containers/src/initialization.cpp
+++ b/gpu/containers/src/initialization.cpp
@@ -115,7 +115,7 @@ namespace
int Cores;
} SMtoCores;
- SMtoCores gpuArchCoresPerSM[] = { { 0x10, 8 }, { 0x11, 8 }, { 0x12, 8 }, { 0x13, 8 }, { 0x20, 32 }, { 0x21, 48 }, {0x30, 192}, {0x35, 192}, { -1, -1 } };
+ SMtoCores gpuArchCoresPerSM[] = { { 0x10, 8}, { 0x11, 8}, { 0x12, 8}, { 0x13, 8}, { 0x20, 32}, { 0x21, 48}, {0x30, 192}, {0x32, 192}, {0x35, 192}, {0x50, 128}, {0x52, 128}, {-1, -1} };
int index = 0;
while (gpuArchCoresPerSM[index].SM != -1)
diff --git a/gpu/kinfu/src/kinfu.cpp b/gpu/kinfu/src/kinfu.cpp
index a92cad4..7ba5b66 100644
--- a/gpu/kinfu/src/kinfu.cpp
+++ b/gpu/kinfu/src/kinfu.cpp
@@ -32,7 +32,7 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*/
#include <iostream>
diff --git a/gpu/kinfu/tools/CMakeLists.txt b/gpu/kinfu/tools/CMakeLists.txt
index 996b074..5ad4fcc 100644
--- a/gpu/kinfu/tools/CMakeLists.txt
+++ b/gpu/kinfu/tools/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(OPENNI_FOUND)
+if(OPENNI2_FOUND)
if(NOT VTK_FOUND)
set(DEFAULT FALSE)
set(REASON "VTK was not found.")
@@ -11,27 +11,27 @@ if(OPENNI_FOUND)
endif(NOT VTK_FOUND)
FILE(GLOB hdrs "*.h*")
- include_directories(${VTK_INCLUDE_DIRS} ${OPENNI_INCLUDE_DIRS})
+ include_directories(${VTK_INCLUDE_DIRS} ${OPENNI2_INCLUDE_DIRS})
## KINECT FUSION
set(the_target pcl_kinfu_app)
- set(srcs kinfu_app.cpp capture.cpp evaluation.cpp)
+ set(srcs kinfu_app.cpp evaluation.cpp)
source_group("Source Files" FILES ${srcs} )
PCL_ADD_EXECUTABLE_OPT_BUNDLE("${the_target}" "${SUBSYS_NAME}" ${srcs} ${hdrs})
- target_link_libraries("${the_target}" pcl_common pcl_io ${OPENNI_LIBRARIES} pcl_visualization pcl_gpu_kinfu)
+ target_link_libraries("${the_target}" pcl_common pcl_io ${OPENNI2_LIBRARIES} pcl_visualization pcl_gpu_kinfu)
if(OpenCV_FOUND)
target_link_libraries("${the_target}" ${OpenCV_LIBS})
endif()
## RECORD TSDFVOLUME
- set(the_target pcl_record_tsdfvolume)
- set(srcs record_tsdfvolume.cpp capture.cpp)
+ #set(the_target pcl_record_tsdfvolume)
+ #set(srcs record_tsdfvolume.cpp capture.cpp)
- PCL_ADD_EXECUTABLE("${the_target}" "${SUBSYS_NAME}" ${srcs} ${hdrs})
- target_link_libraries("${the_target}" pcl_common pcl_io ${OPENNI_LIBRARIES} pcl_visualization pcl_gpu_kinfu)
+ #PCL_ADD_EXECUTABLE("${the_target}" "${SUBSYS_NAME}" ${srcs} ${hdrs})
+ #target_link_libraries("${the_target}" pcl_common pcl_io ${OPENNI2_LIBRARIES} pcl_visualization pcl_gpu_kinfu)
## KINECT FUSION SIMULATION - DISABLED FOR NOW
#find_package(GLEW)
@@ -57,4 +57,4 @@ if(OPENNI_FOUND)
# endif(GLUT_FOUND)
#endif (GLEW_FOUND)
-endif(OPENNI_FOUND)
+endif(OPENNI2_FOUND)
diff --git a/gpu/kinfu/tools/kinfu_app.cpp b/gpu/kinfu/tools/kinfu_app.cpp
index fc82d0b..8a13329 100644
--- a/gpu/kinfu/tools/kinfu_app.cpp
+++ b/gpu/kinfu/tools/kinfu_app.cpp
@@ -34,7 +34,7 @@
* Author: Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
*/
-
+
#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
@@ -57,12 +57,19 @@
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/io/vtk_io.h>
-#include <pcl/io/openni_grabber.h>
-#include <pcl/io/oni_grabber.h>
+#include <pcl/io/openni2_grabber.h>
+//#include <pcl/io/openni_grabber.h>
+//#include <pcl/io/oni_grabber.h>
#include <pcl/io/pcd_grabber.h>
#include <pcl/exceptions.h>
-#include "openni_capture.h"
+#include <pcl/io/image.h>
+#include <pcl/io/image_rgb24.h>
+#include <pcl/io/image_yuv422.h>
+#include <pcl/io/image_depth.h>
+#include <pcl/io/image_ir.h>
+
+//#include "openni_capture.h"
#include <pcl/visualization/point_cloud_color_handlers.h>
#include "evaluation.h"
@@ -701,7 +708,7 @@ struct KinFuApp
void
initRegistration ()
{
- registration_ = capture_.providesCallback<pcl::ONIGrabber::sig_cb_openni_image_depth_image> ();
+ registration_ = capture_.providesCallback<pcl::io::OpenNI2Grabber::sig_cb_openni_image_depth_image> ();
cout << "Registration mode: " << (registration_ ? "On" : "Off (not supported by source)") << endl;
if (registration_)
kinfu_.setDepthIntrinsics(KINFU_DEFAULT_RGB_FOCAL_X, KINFU_DEFAULT_RGB_FOCAL_Y);
@@ -832,7 +839,7 @@ struct KinFuApp
setViewerPose (*scene_cloud_view_.cloud_viewer_, kinfu_.getCameraPose());
}
- void source_cb1_device(const boost::shared_ptr<openni_wrapper::DepthImage>& depth_wrapper)
+ void source_cb1_device(const boost::shared_ptr<pcl::io::DepthImage>& depth_wrapper)
{
{
boost::mutex::scoped_try_lock lock(data_ready_mutex_);
@@ -850,7 +857,7 @@ struct KinFuApp
data_ready_cond_.notify_one();
}
- void source_cb2_device(const boost::shared_ptr<openni_wrapper::Image>& image_wrapper, const boost::shared_ptr<openni_wrapper::DepthImage>& depth_wrapper, float)
+ void source_cb2_device(const boost::shared_ptr<pcl::io::Image>& image_wrapper, const boost::shared_ptr<pcl::io::DepthImage>& depth_wrapper, float)
{
{
boost::mutex::scoped_try_lock lock(data_ready_mutex_);
@@ -877,7 +884,7 @@ struct KinFuApp
}
- void source_cb1_oni(const boost::shared_ptr<openni_wrapper::DepthImage>& depth_wrapper)
+ void source_cb1_oni(const boost::shared_ptr<pcl::io::DepthImage>& depth_wrapper)
{
{
boost::mutex::scoped_lock lock(data_ready_mutex_);
@@ -895,7 +902,7 @@ struct KinFuApp
data_ready_cond_.notify_one();
}
- void source_cb2_oni(const boost::shared_ptr<openni_wrapper::Image>& image_wrapper, const boost::shared_ptr<openni_wrapper::DepthImage>& depth_wrapper, float)
+ void source_cb2_oni(const boost::shared_ptr<pcl::io::Image>& image_wrapper, const boost::shared_ptr<pcl::io::DepthImage>& depth_wrapper, float)
{
{
boost::mutex::scoped_lock lock(data_ready_mutex_);
@@ -925,19 +932,19 @@ struct KinFuApp
void
startMainLoop (bool triggered_capture)
{
- using namespace openni_wrapper;
+ using namespace pcl::io;
typedef boost::shared_ptr<DepthImage> DepthImagePtr;
typedef boost::shared_ptr<Image> ImagePtr;
boost::function<void (const ImagePtr&, const DepthImagePtr&, float constant)> func1_dev = boost::bind (&KinFuApp::source_cb2_device, this, _1, _2, _3);
boost::function<void (const DepthImagePtr&)> func2_dev = boost::bind (&KinFuApp::source_cb1_device, this, _1);
- boost::function<void (const ImagePtr&, const DepthImagePtr&, float constant)> func1_oni = boost::bind (&KinFuApp::source_cb2_oni, this, _1, _2, _3);
- boost::function<void (const DepthImagePtr&)> func2_oni = boost::bind (&KinFuApp::source_cb1_oni, this, _1);
+ //boost::function<void (const ImagePtr&, const DepthImagePtr&, float constant)> func1_oni = boost::bind (&KinFuApp::source_cb2_oni, this, _1, _2, _3);
+ //boost::function<void (const DepthImagePtr&)> func2_oni = boost::bind (&KinFuApp::source_cb1_oni, this, _1);
- bool is_oni = dynamic_cast<pcl::ONIGrabber*>(&capture_) != 0;
- boost::function<void (const ImagePtr&, const DepthImagePtr&, float constant)> func1 = is_oni ? func1_oni : func1_dev;
- boost::function<void (const DepthImagePtr&)> func2 = is_oni ? func2_oni : func2_dev;
+ //bool is_oni = dynamic_cast<pcl::ONIGrabber*>(&capture_) != 0;
+ boost::function<void (const ImagePtr&, const DepthImagePtr&, float constant)> func1 = func1_dev;
+ boost::function<void (const DepthImagePtr&)> func2 = func2_dev;
bool need_colors = integrate_colors_ || registration_;
boost::signals2::connection c = need_colors ? capture_.registerCallback (func1) : capture_.registerCallback (func2);
@@ -1205,14 +1212,15 @@ main (int argc, char* argv[])
{
if (pc::parse_argument (argc, argv, "-dev", openni_device) > 0)
{
- capture.reset (new pcl::OpenNIGrabber (openni_device));
+ capture.reset (new pcl::io::OpenNI2Grabber(openni_device));
}
- else if (pc::parse_argument (argc, argv, "-oni", oni_file) > 0)
+/* else if (pc::parse_argument (argc, argv, "-oni", oni_file) > 0)
{
triggered_capture = true;
bool repeat = false; // Only run ONI file once
capture.reset (new pcl::ONIGrabber (oni_file, repeat, ! triggered_capture));
- }
+ }
+*/
else if (pc::parse_argument (argc, argv, "-pcd", pcd_dir) > 0)
{
float fps_pcd = 15.0f;
@@ -1231,7 +1239,7 @@ main (int argc, char* argv[])
}
else
{
- capture.reset( new pcl::OpenNIGrabber() );
+ capture.reset( new pcl::io::OpenNI2Grabber() );
//triggered_capture = true; capture.reset( new pcl::ONIGrabber("d:/onis/20111013-224932.oni", true, ! triggered_capture) );
//triggered_capture = true; capture.reset( new pcl::ONIGrabber("d:/onis/reg20111229-180846.oni, true, ! triggered_capture) );
@@ -1240,7 +1248,7 @@ main (int argc, char* argv[])
//triggered_capture = true; capture.reset( new pcl::ONIGrabber("d:/onis/20111013-224719.oni", true, ! triggered_capture) );
}
}
- catch (const pcl::PCLException& /*e*/) { return cout << "Can't open depth source" << endl, -1; }
+ catch (const pcl::PCLException& /*e*/) { return cout << "Can't open depth source" << endl, -1; }
float volume_size = 3.f;
pc::parse_argument (argc, argv, "-volume_size", volume_size);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment