├── third_party
├── nvidia_cub
│ ├── tune
│ │ └── .gitignore
│ ├── experimental
│ │ ├── .gitignore
│ │ ├── spmv_script.sh
│ │ └── histogram
│ │ │ └── histogram_cub.h
│ ├── .settings
│ │ ├── .gitignore
│ │ ├── org.eclipse.cdt.ui.prefs
│ │ └── org.eclipse.core.runtime.prefs
│ ├── test
│ │ ├── .gitignore
│ │ ├── link_main.cpp
│ │ ├── link_a.cu
│ │ └── link_b.cu
│ ├── examples
│ │ ├── block
│ │ │ ├── .gitignore
│ │ │ └── reduce_by_key.cu
│ │ └── device
│ │ │ └── .gitignore
│ ├── .project
│ ├── LICENSE.TXT
│ └── cub
│ │ ├── util_namespace.cuh
│ │ ├── block
│ │ └── specializations
│ │ │ └── block_histogram_atomic.cuh
│ │ ├── cub.cuh
│ │ └── util_macro.cuh
└── subtree.txt
├── simtrack_nodes
├── srv
│ ├── SwitchCamera.srv
│ └── SwitchObjects.srv
├── config
│ ├── demo_objects.yaml
│ ├── pr2_camera_topics.yaml
│ └── parameters.yaml
├── launch
│ ├── camera_kinect2.launch
│ ├── main.launch
│ ├── main_kinect2.launch
│ ├── camera_xtion.launch
│ ├── camera_kinect.launch
│ ├── pr2_cam_switch.launch
│ ├── multi-rigid.launch
│ └── multi-rigid_kinect2.launch
├── cfg
│ └── Visualization.cfg
├── package.xml
├── CMakeLists.txt
└── src
│ ├── multi_rigid_node_main.cpp
│ └── pr2_cam_switch_node_main.cpp
├── rendering
├── ogre_media
│ ├── plugins.cfg
│ ├── models
│ │ ├── rviz_cone.mesh
│ │ ├── rviz_cube.mesh
│ │ ├── rviz_cylinder.mesh
│ │ └── rviz_sphere.mesh
│ └── materials
│ │ ├── scripts
│ │ ├── textured.material
│ │ └── untextured.material
│ │ └── glsl
│ │ ├── untextured.vert
│ │ ├── textured.vert
│ │ ├── untextured.frag
│ │ └── textured.frag
├── package.xml
├── include
│ ├── mesh_loader.h
│ ├── stl_loader.h
│ ├── env_config.h
│ ├── windowless_gl_context.h
│ ├── ogre_context.h
│ ├── robot_link.h
│ ├── ogre_multi_render_target.h
│ ├── rigid_object.h
│ └── robot.h
└── src
│ ├── env_config.cpp.in
│ └── test
│ └── utest.cpp
├── data
└── object_models
│ ├── models_to_print.pdf
│ ├── ros_hydro
│ ├── ros_hydro_texture.jpg
│ ├── ros_hydro.mtl
│ └── ros_hydro.obj
│ ├── ros_fuerte
│ ├── ros_fuerte_texture.jpg
│ ├── ros_fuerte.mtl
│ └── ros_fuerte.obj
│ └── ros_groovy
│ ├── ros_groovy_texture.jpg
│ ├── ros_groovy.mtl
│ └── ros_groovy.obj
├── simtrack
├── CMakeLists.txt
└── package.xml
├── .gitignore
├── low_level_vision
├── package.xml
├── CMakeLists.txt
├── include
│ ├── optical_flow_kernels.h
│ ├── convolution_kernels.h
│ ├── d_gabor.h
│ └── d_image_pyramid.h
└── src
│ ├── d_gabor.cpp
│ ├── test
│ └── utest.cpp
│ └── d_gabor_pyramid.cpp
├── siftgpu
├── package.xml
├── license.txt
├── src
│ ├── ProgramGPU.cpp
│ └── FrameBufferObject.cpp
├── include
│ ├── FrameBufferObject.h
│ ├── ProgramGPU.h
│ ├── SiftMatchCU.h
│ ├── CuTexImage.h
│ ├── SiftMatch.h
│ ├── PyramidCU.h
│ ├── ShaderMan.h
│ ├── ProgramCU.h
│ └── PyramidGL.h
├── CMakeLists.txt
└── README.txt
├── utilities
├── package.xml
├── CMakeLists.txt
├── include
│ ├── utilities.h
│ └── cub_radix_sorter_kernels.h
└── src
│ └── utilities.cpp
├── interface
├── package.xml
├── CMakeLists.txt
└── include
│ └── multi_rigid_detector.h
├── .travis.yml
├── pose_estimation
├── package.xml
├── CMakeLists.txt
├── include
│ ├── normal_equations.h
│ ├── d_point_cloud.h
│ └── d_multiple_rigid_pose_sparse.h
└── src
│ └── test
│ └── utest.cpp
├── LICENSE.txt
└── Dockerfile
/third_party/nvidia_cub/tune/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/experimental/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/.settings/.gitignore:
--------------------------------------------------------------------------------
1 | /language.settings.xml
2 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/test/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /link_main.obj
3 | /dummy/
4 |
--------------------------------------------------------------------------------
/simtrack_nodes/srv/SwitchCamera.srv:
--------------------------------------------------------------------------------
1 | uint32 camera
2 | ---
3 | int32 return_code
4 |
--------------------------------------------------------------------------------
/simtrack_nodes/srv/SwitchObjects.srv:
--------------------------------------------------------------------------------
1 | string[] model_names
2 | ---
3 | int32 return_code
4 |
--------------------------------------------------------------------------------
/rendering/ogre_media/plugins.cfg:
--------------------------------------------------------------------------------
1 | # dummy plugins.cfg, needed so Ogre does not throw an exception
2 |
3 |
--------------------------------------------------------------------------------
/simtrack_nodes/config/demo_objects.yaml:
--------------------------------------------------------------------------------
1 | simtrack/model_names:
2 | - ros_fuerte
3 | - ros_groovy
4 | - ros_hydro
5 |
--------------------------------------------------------------------------------
/third_party/subtree.txt:
--------------------------------------------------------------------------------
1 | git subtree add --squash --prefix third_party/nvidia_cub https://github.com/NVlabs/cub.git v1.8.0
2 |
--------------------------------------------------------------------------------
/data/object_models/models_to_print.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/data/object_models/models_to_print.pdf
--------------------------------------------------------------------------------
/rendering/ogre_media/models/rviz_cone.mesh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/rendering/ogre_media/models/rviz_cone.mesh
--------------------------------------------------------------------------------
/rendering/ogre_media/models/rviz_cube.mesh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/rendering/ogre_media/models/rviz_cube.mesh
--------------------------------------------------------------------------------
/rendering/ogre_media/models/rviz_cylinder.mesh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/rendering/ogre_media/models/rviz_cylinder.mesh
--------------------------------------------------------------------------------
/rendering/ogre_media/models/rviz_sphere.mesh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/rendering/ogre_media/models/rviz_sphere.mesh
--------------------------------------------------------------------------------
/simtrack/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(simtrack)
3 | find_package(catkin REQUIRED)
4 | catkin_metapackage()
5 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/examples/block/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /Debug
3 | /Release
4 | /cuda55.sdf
5 | /cuda55.suo
6 | /cuda60.sdf
7 | /cuda60.suo
8 |
--------------------------------------------------------------------------------
/data/object_models/ros_hydro/ros_hydro_texture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/data/object_models/ros_hydro/ros_hydro_texture.jpg
--------------------------------------------------------------------------------
/third_party/nvidia_cub/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_B40C
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/examples/device/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /Debug
3 | /ipch
4 | /Release
5 | /cuda55.sdf
6 | /cuda55.suo
7 | /cuda60.sdf
8 | /cuda60.suo
9 |
--------------------------------------------------------------------------------
/data/object_models/ros_fuerte/ros_fuerte_texture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/data/object_models/ros_fuerte/ros_fuerte_texture.jpg
--------------------------------------------------------------------------------
/data/object_models/ros_groovy/ros_groovy_texture.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/karlpauwels/simtrack/HEAD/data/object_models/ros_groovy/ros_groovy_texture.jpg
--------------------------------------------------------------------------------
/simtrack_nodes/launch/camera_kinect2.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/simtrack_nodes/launch/main.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/test/link_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | extern void a();
4 | extern void b();
5 |
6 | int main()
7 | {
8 | printf("hello world\n");
9 | return 0;
10 | }
11 |
--------------------------------------------------------------------------------
/simtrack_nodes/launch/main_kinect2.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /data/object_models/ros_fuerte/ros_fuerte_SIFT.h5
2 | /data/object_models/ros_groovy/ros_groovy_SIFT.h5
3 | /data/object_models/ros_hydro/ros_hydro_SIFT.h5
4 | /simtrack/CMakeLists.txt.user*
5 | CMakeLists.txt.user*
6 | *~
7 |
8 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | content-types/enabled=true
2 | content-types/org.eclipse.cdt.core.cxxHeader/file-extensions=cuh
3 | content-types/org.eclipse.cdt.core.cxxSource/file-extensions=cu
4 | eclipse.preferences.version=1
5 |
--------------------------------------------------------------------------------
/data/object_models/ros_hydro/ros_hydro.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: 'ros_groovy.blend'
2 | # Material Count: 1
3 | newmtl _ros_hydro.jpg
4 | Ns 0
5 | Ka 0.000000 0.000000 0.000000
6 | Kd 0.8 0.8 0.8
7 | Ks 0.8 0.8 0.8
8 | d 1
9 | illum 2
10 | map_Kd ros_hydro_texture.jpg
11 |
--------------------------------------------------------------------------------
/data/object_models/ros_fuerte/ros_fuerte.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: 'ros_groovy.blend'
2 | # Material Count: 1
3 | newmtl _ros_fuerte.jpg
4 | Ns 0
5 | Ka 0.000000 0.000000 0.000000
6 | Kd 0.8 0.8 0.8
7 | Ks 0.8 0.8 0.8
8 | d 1
9 | illum 2
10 | map_Kd ros_fuerte_texture.jpg
11 |
--------------------------------------------------------------------------------
/data/object_models/ros_groovy/ros_groovy.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: 'ros_groovy.blend'
2 | # Material Count: 1
3 | newmtl _ros_groovy.jpg
4 | Ns 0
5 | Ka 0.000000 0.000000 0.000000
6 | Kd 0.8 0.8 0.8
7 | Ks 0.8 0.8 0.8
8 | d 1
9 | illum 2
10 | map_Kd ros_groovy_texture.jpg
11 |
--------------------------------------------------------------------------------
/simtrack_nodes/launch/camera_xtion.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/simtrack_nodes/launch/camera_kinect.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/test/link_a.cu:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void a()
4 | {
5 | printf("a() called\n");
6 |
7 | cub::DoubleBuffer d_keys;
8 | cub::DoubleBuffer d_values;
9 | size_t temp_storage_bytes = 0;
10 | cub::DeviceRadixSort::SortPairs(NULL, temp_storage_bytes, d_keys, d_values, 1024);
11 | }
12 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/test/link_b.cu:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void b()
4 | {
5 | printf("b() called\n");
6 |
7 | cub::DoubleBuffer d_keys;
8 | cub::DoubleBuffer d_values;
9 | size_t temp_storage_bytes = 0;
10 | cub::DeviceRadixSort::SortPairs(NULL, temp_storage_bytes, d_keys, d_values, 1024);
11 | }
12 |
--------------------------------------------------------------------------------
/low_level_vision/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | low_level_vision
4 | 0.1.0
5 | Low-level Vision Engine
6 | BSD
7 | http://www.karlpauwels.com/simtrack
8 | Karl Pauwels
9 | Karl Pauwels
10 |
11 | catkin
12 | utilities
13 | utilities
14 |
15 |
--------------------------------------------------------------------------------
/siftgpu/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | siftgpu
4 | 0.1.0
5 | Catkinized SiftGPU (CUDA version)
6 | non-profit license University of North Carolina
7 | http://cs.unc.edu/~ccwu/siftgpu/
8 | Changchang Wu
9 | Karl Pauwels
10 |
11 | catkin
12 | libglew-dev
13 | libglew-dev
14 |
15 |
--------------------------------------------------------------------------------
/simtrack_nodes/launch/pr2_cam_switch.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/simtrack_nodes/config/pr2_camera_topics.yaml:
--------------------------------------------------------------------------------
1 | camera/0/color_only_mode: false
2 | camera/0/rgb: /head_mount_kinect/rgb/image_rect_color
3 | camera/0/rgb_info: /head_mount_kinect/rgb/camera_info
4 | camera/0/depth: /head_mount_kinect/depth_registered/sw_registered/image_rect_raw
5 | camera/0/robot_frame: head_mount_kinect_rgb_optical_frame
6 |
7 | camera/1/color_only_mode: true
8 | camera/1/rgb: /l_forearm_cam/image_rect_color
9 | camera/1/rgb_info: /l_forearm_cam/camera_info
10 | camera/1/robot_frame: l_forearm_cam_optical_frame
11 |
12 | camera/2/color_only_mode: true
13 | camera/2/rgb: /r_forearm_cam/image_rect_color
14 | camera/2/rgb_info: /r_forearm_cam/camera_info
15 | camera/2/robot_frame: r_forearm_cam_optical_frame
16 |
--------------------------------------------------------------------------------
/utilities/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | utilities
4 | 0.1.0
5 | Utilities
6 | Karl Pauwels
7 | BSD
8 | http://www.karlpauwels.com/simtrack
9 | Karl Pauwels
10 | Karl Pauwels
11 |
12 | catkin
13 | hdf5
14 | boost
15 | hdf5
16 | boost
17 |
18 |
19 |
--------------------------------------------------------------------------------
/rendering/ogre_media/materials/scripts/textured.material:
--------------------------------------------------------------------------------
1 | vertex_program textured_vert glsl
2 | {
3 | source ../glsl/textured.vert
4 | }
5 |
6 | fragment_program textured_frag glsl
7 | {
8 | source ../glsl/textured.frag
9 | }
10 |
11 | material textured
12 | {
13 | technique
14 | {
15 | scheme MRT
16 |
17 | pass
18 | {
19 | cull_hardware none
20 | vertex_program_ref textured_vert
21 | {
22 | param_named_auto worldViewProj worldviewproj_matrix
23 | param_named_auto invTraWorldView inverse_transpose_worldview_matrix
24 | param_named_auto segmentIndex custom 1
25 | }
26 | fragment_program_ref textured_frag
27 | {
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/rendering/ogre_media/materials/scripts/untextured.material:
--------------------------------------------------------------------------------
1 | vertex_program untextured_vert glsl
2 | {
3 | source ../glsl/untextured.vert
4 | }
5 |
6 | fragment_program untextured_frag glsl
7 | {
8 | source ../glsl/untextured.frag
9 | }
10 |
11 | material untextured
12 | {
13 | technique
14 | {
15 | scheme MRT
16 |
17 | pass
18 | {
19 | // culling is required on the robot since the cameras are inside a structure!
20 | // cull_hardware none
21 | vertex_program_ref untextured_vert
22 | {
23 | param_named_auto worldViewProj worldviewproj_matrix
24 | param_named_auto invTraWorldView inverse_transpose_worldview_matrix
25 | param_named_auto segmentIndex custom 1
26 | }
27 | fragment_program_ref untextured_frag
28 | {
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/simtrack/package.xml:
--------------------------------------------------------------------------------
1 |
2 | simtrack
3 | 0.1.0
4 | A simulation-based framework for tracking
5 | BSD
6 | http://www.karlpauwels.com/simtrack
7 | Karl Pauwels
8 | Karl Pauwels
9 |
10 | catkin
11 |
12 | interface
13 | low_level_vision
14 | pose_estimation
15 | rendering
16 | siftgpu
17 | simtrack_nodes
18 | utilities
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/interface/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | interface
4 | 0.1.0
5 | Interface
6 | BSD
7 | http://www.karlpauwels.com/simtrack
8 | Karl Pauwels
9 | Karl Pauwels
10 |
11 | catkin
12 |
13 | cmake_modules
14 | eigen
15 | cv_bridge
16 | low_level_vision
17 | pose_estimation
18 |
19 | cv_bridge
20 | low_level_vision
21 | pose_estimation
22 |
23 |
24 |
--------------------------------------------------------------------------------
/siftgpu/license.txt:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
4 | // All Rights Reserved
5 | //
6 | // Permission to use, copy, modify and distribute this software and its
7 | // documentation for educational, research and non-profit purposes, without
8 | // fee, and without a written agreement is hereby granted, provided that the
9 | // above copyright notice and the following paragraph appear in all copies.
10 | //
11 | // The University of North Carolina at Chapel Hill make no representations
12 | // about the suitability of this software for any purpose. It is provided
13 | // 'as is' without express or implied warranty.
14 | //
15 | // Please send BUG REPORTS to ccwu@cs.unc.edu
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
--------------------------------------------------------------------------------
/third_party/nvidia_cub/experimental/spmv_script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | for i in 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216
4 | do
5 | echo `date`, `$1 --dense=$i $2 $3 $4 $5 $6 $7`
6 | done
7 |
8 | echo
9 | echo
10 |
11 | for i in `ls /home/dumerrill/graphs/spmv/*.mtx`
12 | do
13 | if [[ ( "`head -n 50 $i | grep complex`" = "" ) && ( "`head -n 50 $i | grep array`" = "" ) ]]
14 | then
15 | echo `date`, `$1 --mtx=$i $2 $3 $4 $5 $6 $7 2>/dev/null`
16 | fi
17 | done
18 |
19 | echo
20 | echo
21 |
22 | for i in `ls /scratch/dumerrill/graphs/mtx/*.mtx`
23 | #for i in `ls /cygdrive/w/Dev/UFget/mtx/*.mtx`
24 | do
25 | if [[ ( "`head -n 50 $i | grep complex`" = "" ) && ( "`head -n 50 $i | grep array`" = "" ) ]]
26 | then
27 | echo `date`, `$1 --mtx=$i $2 $3 $4 $5 $6 $7 2>/dev/null`
28 | fi
29 | done
30 |
31 |
--------------------------------------------------------------------------------
/simtrack_nodes/launch/multi-rigid.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | dist: xenial
2 |
3 | sudo: required
4 |
5 | language: cpp
6 |
7 | services:
8 | - docker
9 |
10 | before_install:
11 | - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
12 | - curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
13 | - curl -s -L https://nvidia.github.io/nvidia-docker/$(. /etc/os-release;echo $ID$VERSION_ID)/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
14 | - sudo apt-key fingerprint 0EBFCD88
15 | - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
16 | - sudo apt-get update
17 | - sudo apt-get install -y docker-ce
18 | - sudo apt-get install -y nvidia-docker2
19 | - sudo pkill -SIGHUP dockerd
20 | - docker build -t simtrack .
21 |
22 | script:
23 | - docker run --rm simtrack /bin/bash -c "source /opt/ros/kinetic/setup.sh && catkin_make -DCMAKE_BUILD_TYPE=\"Release\""
24 |
25 |
--------------------------------------------------------------------------------
/pose_estimation/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | pose_estimation
4 | 0.1.0
5 | Pose Estimation Engine
6 | Karl Pauwels
7 | BSD
8 | http://www.karlpauwels.com/simtrack
9 | Karl Pauwels
10 | Karl Pauwels
11 |
12 | catkin
13 |
14 | cmake_modules
15 | eigen
16 | siftgpu
17 | rendering
18 | utilities
19 |
20 | siftgpu
21 | rendering
22 | utilities
23 |
24 |
25 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | GIT_CUB
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | org.eclipse.cdt.core.ccnature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/simtrack_nodes/config/parameters.yaml:
--------------------------------------------------------------------------------
1 | simtrack/tracker/device_id: 0
2 | simtrack/detector/device_id: 1
3 |
4 | simtrack/optical_flow/n_scales: 0 # 0=auto
5 | simtrack/optical_flow/median_filter: true
6 | simtrack/optical_flow/consistent: true
7 | simtrack/optical_flow/cons_thres: 0.5
8 | simtrack/optical_flow/four_orientations: false
9 |
10 | simtrack/detector/vec_size: 4
11 | simtrack/detector/num_iter_ransac: 1000
12 |
13 | simtrack/tracker/color_only_mode: false
14 | simtrack/tracker/n_icp_outer_it: 3
15 | simtrack/tracker/n_icp_inner_it: 3
16 | simtrack/tracker/w_flow: 1.0
17 | simtrack/tracker/w_ar_flow: 1.0
18 | simtrack/tracker/w_disp: 1.0 # ignored in color_only_mode
19 | simtrack/tracker/max_samples: 500000
20 | simtrack/tracker/key_bits: 4
21 | simtrack/tracker/near_plane: 0.001
22 | simtrack/tracker/far_plane: 10.0
23 |
24 | simtrack/tracker/reliability_threshold: 0.15
25 | simtrack/tracker/sparse_intro_reliability_threshold: 0.30
26 | simtrack/tracker/sparse_intro_allowed_reliability_decrease: 0.02
27 | simtrack/tracker/max_proportion_projected_bounding_box: 10.0
28 | simtrack/tracker/max_t_update_norm_squared: 0.04
29 |
--------------------------------------------------------------------------------
/simtrack_nodes/cfg/Visualization.cfg:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | PACKAGE = "simtrack_nodes"
3 |
4 | from dynamic_reconfigure.parameter_generator_catkin import *
5 |
6 | gen = ParameterGenerator()
7 |
8 | size_enum = gen.enum([ gen.const("appearance", int_t, 0, "Rendered model appearance"),
9 | gen.const("appearance_blended", int_t, 1, "Blended rendered model appearance"),
10 | gen.const("optical_flow_x", int_t, 2, "Horizontal optical flow"),
11 | gen.const("ar_flow_y", int_t, 3, "Vertical augmented reality flow")],
12 | "An enum to select output visualization")
13 |
14 | gen.add("visualization", int_t, 0, "Output visualization", 1, 0, 3, edit_method=size_enum)
15 |
16 | gen.add("start_stop_recording", bool_t, 0, "Control data recording", False)
17 | gen.add("save_object_poses", bool_t, 0, "Record object poses", False)
18 | gen.add("save_image", bool_t, 0, "Record RGB image", False)
19 | gen.add("save_depth", bool_t, 0, "Record depth", False)
20 | gen.add("save_optical_flow", bool_t, 0, "Record optical flow", False)
21 |
22 | exit(gen.generate(PACKAGE, "simtrack_nodes", "Visualization"))
23 |
--------------------------------------------------------------------------------
/simtrack_nodes/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | simtrack_nodes
4 | 0.1.0
5 | Simulation-based Tracking Nodes
6 | BSD
7 | http://www.karlpauwels.com/simtrack
8 | Karl Pauwels
9 | Karl Pauwels
10 |
11 | catkin
12 |
13 | cmake_modules
14 | image_transport
15 | cv_bridge
16 | roscpp
17 | tf
18 | geometry_msgs
19 | message_generation
20 | dynamic_reconfigure
21 | eigen
22 | interface
23 |
24 | image_transport
25 | cv_bridge
26 | tf
27 | geometry_msgs
28 | message_runtime
29 | interface
30 |
31 |
32 |
--------------------------------------------------------------------------------
/siftgpu/src/ProgramGPU.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: ProgramGPU.cpp
3 | // Author: Changchang Wu
4 | // Description : Implementation of ProgramGPU and FilterProgram
5 | // This part is independent of GPU language
6 | //
7 | //
8 | //
9 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
10 | // All Rights Reserved
11 | //
12 | // Permission to use, copy, modify and distribute this software and its
13 | // documentation for educational, research and non-profit purposes, without
14 | // fee, and without a written agreement is hereby granted, provided that the
15 | // above copyright notice and the following paragraph appear in all copies.
16 | //
17 | // The University of North Carolina at Chapel Hill make no representations
18 | // about the suitability of this software for any purpose. It is provided
19 | // 'as is' without express or implied warranty.
20 | //
21 | // Please send BUG REPORTS to ccwu@cs.unc.edu
22 | //
23 | ////////////////////////////////////////////////////////////////////////////
24 |
25 |
26 | #include "GL/glew.h"
27 | #include
28 | #include
29 | #include
30 | using namespace std;
31 |
32 | #include "GlobalUtil.h"
33 | #include "GLTexImage.h"
34 | #include "ShaderMan.h"
35 | #include "ProgramGPU.h"
36 | #include "ProgramGLSL.h"
37 | #include "SiftGPU.h"
38 |
39 |
--------------------------------------------------------------------------------
/rendering/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | rendering
4 | 0.1.0
5 | Rendering
6 | Karl Pauwels
7 | BSD
8 | http://www.karlpauwels.com/simtrack
9 | Karl Pauwels
10 | Karl Pauwels
11 |
12 | catkin
13 |
14 | cmake_modules
15 | eigen
16 | libx11-dev
17 | opengl
18 | libglew-dev
19 | cv_bridge
20 | resource_retriever
21 | kdl_parser
22 | orocos_kdl
23 | libogre-dev
24 |
25 | libx11-dev
26 | opengl
27 | libglew-dev
28 | cv_bridge
29 | resource_retriever
30 | kdl_parser
31 | orocos_kdl
32 | libogre-dev
33 |
34 |
35 |
--------------------------------------------------------------------------------
/simtrack_nodes/launch/multi-rigid_kinect2.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/data/object_models/ros_hydro/ros_hydro.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.62 (sub 0) OBJ File: 'ros_groovy.blend'
2 | # www.blender.org
3 | mtllib ros_hydro.mtl
4 | v 0.105000 0.148500 -0.000500
5 | v 0.105000 -0.148500 -0.000500
6 | v -0.105000 -0.148500 -0.000500
7 | v -0.105000 0.148500 -0.000500
8 | v 0.105000 0.148500 0.000500
9 | v 0.105000 -0.148500 0.000500
10 | v -0.105000 -0.148500 0.000500
11 | v -0.105000 0.148500 0.000500
12 | vt 0.116863 0.059746
13 | vt 0.116976 0.096562
14 | vt 0.080160 0.096675
15 | vt 0.080047 0.059859
16 | vt 1.000014 1.000389
17 | vt -0.001088 1.000321
18 | vt -0.000136 -0.000292
19 | vt 1.000265 -0.000290
20 | vt 0.153792 0.059746
21 | vt 0.153905 0.096562
22 | vt 0.117089 0.096675
23 | vt 0.116976 0.059859
24 | vt 0.043230 0.096675
25 | vt 0.043117 0.059859
26 | vt 0.079934 0.059746
27 | vt 0.080047 0.096562
28 | vt 0.080047 0.059633
29 | vt 0.043230 0.059746
30 | vt 0.043117 0.022929
31 | vt 0.079934 0.022816
32 | vt 0.080047 0.022929
33 | vt 0.116863 0.022816
34 | vt 0.116976 0.059633
35 | vt 0.080160 0.059746
36 | vn -0.000000 -0.000000 -1.000000
37 | vn 0.000000 0.000000 1.000000
38 | vn 1.000000 -0.000000 0.000007
39 | vn -0.000000 -1.000000 -0.000037
40 | vn -1.000000 0.000000 -0.000026
41 | vn 0.000000 1.000000 0.000060
42 | usemtl _ros_hydro.jpg
43 | s off
44 | f 1/1/1 2/2/1 3/3/1
45 | f 1/1/1 3/3/1 4/4/1
46 | f 5/5/2 8/6/2 7/7/2
47 | f 5/5/2 7/7/2 6/8/2
48 | f 1/9/3 5/10/3 6/11/3
49 | f 1/9/3 6/11/3 2/12/3
50 | f 2/13/4 6/14/4 7/15/4
51 | f 2/13/4 7/15/4 3/16/4
52 | f 3/17/5 7/18/5 8/19/5
53 | f 3/17/5 8/19/5 4/20/5
54 | f 5/21/6 1/22/6 4/23/6
55 | f 5/21/6 4/23/6 8/24/6
56 |
--------------------------------------------------------------------------------
/data/object_models/ros_fuerte/ros_fuerte.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.62 (sub 0) OBJ File: 'ros_groovy.blend'
2 | # www.blender.org
3 | mtllib ros_fuerte.mtl
4 | v 0.105000 0.148500 -0.000500
5 | v 0.105000 -0.148500 -0.000500
6 | v -0.105000 -0.148500 -0.000500
7 | v -0.105000 0.148500 -0.000500
8 | v 0.105000 0.148500 0.000500
9 | v 0.105000 -0.148500 0.000500
10 | v -0.105000 -0.148500 0.000500
11 | v -0.105000 0.148500 0.000500
12 | vt 0.116863 0.059746
13 | vt 0.116976 0.096562
14 | vt 0.080160 0.096675
15 | vt 0.080047 0.059859
16 | vt 1.000014 1.000389
17 | vt -0.001088 1.000321
18 | vt -0.000136 -0.000292
19 | vt 1.000265 -0.000290
20 | vt 0.153792 0.059746
21 | vt 0.153905 0.096562
22 | vt 0.117089 0.096675
23 | vt 0.116976 0.059859
24 | vt 0.043230 0.096675
25 | vt 0.043117 0.059859
26 | vt 0.079934 0.059746
27 | vt 0.080047 0.096562
28 | vt 0.080047 0.059633
29 | vt 0.043230 0.059746
30 | vt 0.043117 0.022929
31 | vt 0.079934 0.022816
32 | vt 0.080047 0.022929
33 | vt 0.116863 0.022816
34 | vt 0.116976 0.059633
35 | vt 0.080160 0.059746
36 | vn -0.000000 -0.000000 -1.000000
37 | vn 0.000000 0.000000 1.000000
38 | vn 1.000000 -0.000000 0.000007
39 | vn -0.000000 -1.000000 -0.000037
40 | vn -1.000000 0.000000 -0.000026
41 | vn 0.000000 1.000000 0.000060
42 | usemtl _ros_fuerte.jpg
43 | s off
44 | f 1/1/1 2/2/1 3/3/1
45 | f 1/1/1 3/3/1 4/4/1
46 | f 5/5/2 8/6/2 7/7/2
47 | f 5/5/2 7/7/2 6/8/2
48 | f 1/9/3 5/10/3 6/11/3
49 | f 1/9/3 6/11/3 2/12/3
50 | f 2/13/4 6/14/4 7/15/4
51 | f 2/13/4 7/15/4 3/16/4
52 | f 3/17/5 7/18/5 8/19/5
53 | f 3/17/5 8/19/5 4/20/5
54 | f 5/21/6 1/22/6 4/23/6
55 | f 5/21/6 4/23/6 8/24/6
56 |
--------------------------------------------------------------------------------
/data/object_models/ros_groovy/ros_groovy.obj:
--------------------------------------------------------------------------------
1 | # Blender v2.62 (sub 0) OBJ File: 'ros_groovy.blend'
2 | # www.blender.org
3 | mtllib ros_groovy.mtl
4 | v 0.105000 0.148500 -0.000500
5 | v 0.105000 -0.148500 -0.000500
6 | v -0.105000 -0.148500 -0.000500
7 | v -0.105000 0.148500 -0.000500
8 | v 0.105000 0.148500 0.000500
9 | v 0.105000 -0.148500 0.000500
10 | v -0.105000 -0.148500 0.000500
11 | v -0.105000 0.148500 0.000500
12 | vt 0.116863 0.059746
13 | vt 0.116976 0.096562
14 | vt 0.080160 0.096675
15 | vt 0.080047 0.059859
16 | vt 1.000014 1.000389
17 | vt -0.001088 1.000321
18 | vt -0.000136 -0.000292
19 | vt 1.000265 -0.000290
20 | vt 0.153792 0.059746
21 | vt 0.153905 0.096562
22 | vt 0.117089 0.096675
23 | vt 0.116976 0.059859
24 | vt 0.043230 0.096675
25 | vt 0.043117 0.059859
26 | vt 0.079934 0.059746
27 | vt 0.080047 0.096562
28 | vt 0.080047 0.059633
29 | vt 0.043230 0.059746
30 | vt 0.043117 0.022929
31 | vt 0.079934 0.022816
32 | vt 0.080047 0.022929
33 | vt 0.116863 0.022816
34 | vt 0.116976 0.059633
35 | vt 0.080160 0.059746
36 | vn -0.000000 -0.000000 -1.000000
37 | vn 0.000000 0.000000 1.000000
38 | vn 1.000000 -0.000000 0.000007
39 | vn -0.000000 -1.000000 -0.000037
40 | vn -1.000000 0.000000 -0.000026
41 | vn 0.000000 1.000000 0.000060
42 | usemtl _ros_groovy.jpg
43 | s off
44 | f 1/1/1 2/2/1 3/3/1
45 | f 1/1/1 3/3/1 4/4/1
46 | f 5/5/2 8/6/2 7/7/2
47 | f 5/5/2 7/7/2 6/8/2
48 | f 1/9/3 5/10/3 6/11/3
49 | f 1/9/3 6/11/3 2/12/3
50 | f 2/13/4 6/14/4 7/15/4
51 | f 2/13/4 7/15/4 3/16/4
52 | f 3/17/5 7/18/5 8/19/5
53 | f 3/17/5 8/19/5 4/20/5
54 | f 5/21/6 1/22/6 4/23/6
55 | f 5/21/6 4/23/6 8/24/6
56 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, Karl Pauwels
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions
6 | are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 |
11 | 2. Redistributions in binary form must reproduce the above copyright
12 | notice, this list of conditions and the following disclaimer in the
13 | documentation and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nvidia/cuda:10.0-devel-ubuntu16.04
2 |
3 | ENV USERNAME simtrack
4 | ENV WORKSPACE /home/$USERNAME/my-ws/
5 |
6 | SHELL ["/bin/bash", "-c"]
7 |
8 | RUN apt-get update && apt-get install -q -y \
9 | dirmngr \
10 | gnupg2 \
11 | lsb-release \
12 | sudo \
13 | && rm -rf /var/lib/apt/lists/*
14 |
15 | RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
16 |
17 | RUN echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list
18 |
19 | RUN apt-get update && apt-get install --no-install-recommends -y \
20 | python-rosdep \
21 | python-rosinstall \
22 | python-vcstools \
23 | && rm -rf /var/lib/apt/lists/*
24 |
25 | ENV LANG C.UTF-8
26 | ENV LC_ALL C.UTF-8
27 |
28 | RUN apt-get update && apt-get install -y \
29 | ros-kinetic-desktop-full \
30 | && rm -rf /var/lib/apt/lists/*
31 |
32 | RUN rosdep init \
33 | && rosdep update
34 |
35 | RUN useradd -ms /bin/bash $USERNAME
36 |
37 | RUN echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
38 |
39 | USER $USERNAME
40 |
41 | RUN mkdir -p $WORKSPACE/src/simtrack
42 |
43 | # docker does not yet support environment-var expansion in command options
44 | COPY --chown=simtrack . $WORKSPACE/src/simtrack
45 |
46 | WORKDIR $WORKSPACE
47 |
48 | RUN source /opt/ros/kinetic/setup.sh && \
49 | if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep init; fi && \
50 | rosdep update && \
51 | sudo apt-get update && \
52 | rosdep install --from-paths src --ignore-src -y -r && \
53 | sudo rm -rf /var/lib/apt/lists/*
54 |
55 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/LICENSE.TXT:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2011, Duane Merrill. All rights reserved.
2 | Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the NVIDIA CORPORATION nor the
12 | names of its contributors may be used to endorse or promote products
13 | derived from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/siftgpu/include/FrameBufferObject.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: FrameBufferObject.h
3 | // Author: Changchang Wu
4 | // Description : interface for the FrameBufferObject class.
5 | //
6 | //
7 | //
8 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
9 | // All Rights Reserved
10 | //
11 | // Permission to use, copy, modify and distribute this software and its
12 | // documentation for educational, research and non-profit purposes, without
13 | // fee, and without a written agreement is hereby granted, provided that the
14 | // above copyright notice and the following paragraph appear in all copies.
15 | //
16 | // The University of North Carolina at Chapel Hill make no representations
17 | // about the suitability of this software for any purpose. It is provided
18 | // 'as is' without express or implied warranty.
19 | //
20 | // Please send BUG REPORTS to ccwu@cs.unc.edu
21 | //
22 | ////////////////////////////////////////////////////////////////////////////
23 |
24 |
25 | #if !defined(_FRAME_BUFFER_OBJECT_H)
26 | #define _FRAME_BUFFER_OBJECT_H
27 |
28 | class FrameBufferObject
29 | {
30 | static GLuint GlobalFBO; //not thread-safe
31 | GLuint _fboID;
32 | public:
33 | static int UseSingleFBO;
34 | public:
35 | static void DeleteGlobalFBO();
36 | static void UnattachTex(GLenum attachment);
37 | static void UnbindFBO();
38 | static void AttachDepthTexture(GLenum textureTarget, GLuint texID);
39 | static void AttachTexture( GLenum textureTarget, GLenum attachment, GLuint texID);
40 | static void AttachRenderBuffer(GLenum attachment, GLuint buffID );
41 | static void UnattachRenderBuffer(GLenum attachment);
42 | public:
43 | void BindFBO();
44 | FrameBufferObject(int autobind = 1);
45 | ~FrameBufferObject();
46 |
47 | };
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/examples/block/reduce_by_key.cu:
--------------------------------------------------------------------------------
1 |
2 |
3 | #include
4 |
5 |
6 | template <
7 | int BLOCK_THREADS, ///< Number of CTA threads
8 | typename KeyT, ///< Key type
9 | typename ValueT> ///< Value type
10 | __global__ void Kernel()
11 | {
12 | // Tuple type for scanning (pairs accumulated segment-value with segment-index)
13 | typedef cub::KeyValuePair OffsetValuePairT;
14 |
15 | // Reduce-value-by-segment scan operator
16 | typedef cub::ReduceBySegmentOp ReduceBySegmentOpT;
17 |
18 | // Parameterized BlockDiscontinuity type for setting head flags
19 | typedef cub::BlockDiscontinuity<
20 | KeyT,
21 | BLOCK_THREADS>
22 | BlockDiscontinuityKeysT;
23 |
24 | // Parameterized BlockScan type
25 | typedef cub::BlockScan<
26 | OffsetValuePairT,
27 | BLOCK_THREADS,
28 | cub::BLOCK_SCAN_WARP_SCANS>
29 | BlockScanT;
30 |
31 | // Shared memory
32 | __shared__ union TempStorage
33 | {
34 | typename BlockScanT::TempStorage scan; // Scan storage
35 | typename BlockDiscontinuityKeysT::TempStorage discontinuity; // Discontinuity storage
36 | } temp_storage;
37 |
38 |
39 | // Read data (each thread gets 3 items each, every 9 items is a segment)
40 | KeyT my_keys[3] = {threadIdx.x / 3, threadIdx.x / 3, threadIdx.x / 3};
41 | ValueT my_values[3] = {1, 1, 1};
42 |
43 | // Set head segment head flags
44 | int my_flags[3];
45 | BlockDiscontinuityKeysT(temp_storage.discontinuity).FlagHeads(
46 | my_flags,
47 | my_keys,
48 | cub::Inequality());
49 |
50 | __syncthreads();
51 |
52 |
53 |
54 |
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/rendering/include/mesh_loader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010, Willow Garage, Inc.
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | *
8 | * * Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * * Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * * Neither the name of the Willow Garage, Inc. nor the names of its
14 | * contributors may be used to endorse or promote products derived from
15 | * this software without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 | * POSSIBILITY OF SUCH DAMAGE.
28 | */
29 |
30 | #ifndef RVIZ_MESH_LOADER_H
31 | #define RVIZ_MESH_LOADER_H
32 |
33 | #include
34 |
35 | namespace render {
36 | Ogre::MeshPtr loadMeshFromResource(const std::string &resource_path);
37 |
38 | } // namespace render
39 |
40 | #endif // RVIZ_MESH_LOADER_H
41 |
--------------------------------------------------------------------------------
/simtrack_nodes/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.7)
2 | project(simtrack_nodes)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | cmake_modules
6 | cv_bridge
7 | image_transport
8 | roscpp
9 | dynamic_reconfigure
10 | std_msgs
11 | message_generation
12 | tf
13 | geometry_msgs
14 | interface
15 | )
16 |
17 | find_package(OpenCV 3.1.0 REQUIRED)
18 | find_package(Eigen3 REQUIRED)
19 | add_definitions(${EIGEN_DEFINITIONS})
20 |
21 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
22 |
23 | generate_dynamic_reconfigure_options(
24 | cfg/Visualization.cfg
25 | )
26 |
27 | add_service_files(
28 | FILES
29 | SwitchCamera.srv
30 | SwitchObjects.srv
31 | )
32 |
33 | generate_messages(
34 | DEPENDENCIES
35 | std_msgs
36 | geometry_msgs
37 | sensor_msgs
38 | )
39 |
40 | catkin_package(
41 | INCLUDE_DIRS include
42 | LIBRARIES ${PROJECT_NAME}
43 | DEPENDS cv_bridge
44 | CATKIN_DEPENDS image_transport tf geometry_msgs message_runtime interface
45 | )
46 |
47 | # show additional files in qtcreator
48 | execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f
49 | OUTPUT_VARIABLE FILES_STRING)
50 | string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
51 | add_custom_target(additional_files_${PROJECT_NAME} SOURCES
52 | ${FILES_LIST}
53 | ${PROJECT_SOURCE_DIR}/../README.md
54 | )
55 |
56 | include_directories(
57 | include
58 | ${catkin_INCLUDE_DIRS}
59 | ${OpenCV2_INCLUDE_DIRS}
60 | ${EIGEN_INCLUDE_DIR}
61 | )
62 |
63 | add_library(${PROJECT_NAME}
64 | src/pr2_cam_switch_node.cpp
65 | src/multi_rigid_node.cpp
66 | )
67 | target_link_libraries(${PROJECT_NAME}
68 | ${catkin_LIBRARIES}
69 | ${OpenCV_LIBS}
70 | )
71 |
72 | add_executable(multi_rigid_node
73 | src/multi_rigid_node_main.cpp
74 | )
75 | target_link_libraries(multi_rigid_node
76 | ${PROJECT_NAME}
77 | )
78 | add_dependencies(multi_rigid_node
79 | ${PROJECT_NAME}_gencfg)
80 |
81 | add_executable(pr2_cam_switch_node
82 | src/pr2_cam_switch_node_main.cpp
83 | )
84 | target_link_libraries(pr2_cam_switch_node
85 | ${PROJECT_NAME}
86 | )
87 |
--------------------------------------------------------------------------------
/siftgpu/include/ProgramGPU.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: ProgramGPU.h
3 | // Author: Changchang Wu
4 | // Description : Based class for GPU programs
5 | // ProgramGPU: base class of ProgramGLSL
6 | // FilterProgram: base class of FilterGLSL, FilterPKSL
7 | //
8 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
9 | // All Rights Reserved
10 | //
11 | // Permission to use, copy, modify and distribute this software and its
12 | // documentation for educational, research and non-profit purposes, without
13 | // fee, and without a written agreement is hereby granted, provided that the
14 | // above copyright notice and the following paragraph appear in all copies.
15 | //
16 | // The University of North Carolina at Chapel Hill make no representations
17 | // about the suitability of this software for any purpose. It is provided
18 | // 'as is' without express or implied warranty.
19 | //
20 | // Please send BUG REPORTS to ccwu@cs.unc.edu
21 | //
22 | ////////////////////////////////////////////////////////////////////////////
23 |
24 |
25 | #ifndef _PROGRAM_GPU_H
26 | #define _PROGRAM_GPU_H
27 |
28 | ////////////////////////////////////////////////////////////////////////////
29 | //class ProgramGPU
30 | //description: pure virtual class
31 | // provides a common interface for shader programs
32 | ///////////////////////////////////////////////////////////////////////////
33 | class ProgramGPU
34 | {
35 | public:
36 | //use a gpu program
37 | virtual int UseProgram() = 0;
38 | virtual void* GetProgramID() = 0;
39 | //not used
40 | virtual ~ProgramGPU(){};
41 | };
42 |
43 | ///////////////////////////////////////////////////////////////////////////
44 | //class FilterProgram
45 | ///////////////////////////////////////////////////////////////////////////
46 | class FilterProgram
47 | {
48 | public:
49 | ProgramGPU* s_shader_h;
50 | ProgramGPU* s_shader_v;
51 | int _size;
52 | int _id;
53 | public:
54 | FilterProgram() { s_shader_h = s_shader_v = NULL; _size = _id = 0; }
55 | virtual ~FilterProgram() { if(s_shader_h) delete s_shader_h; if(s_shader_v) delete s_shader_v;}
56 | };
57 |
58 | #endif
59 |
60 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/cub/util_namespace.cuh:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright (c) 2011, Duane Merrill. All rights reserved.
3 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | * * Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * * Neither the name of the NVIDIA CORPORATION nor the
13 | * names of its contributors may be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | *
27 | ******************************************************************************/
28 |
29 | /**
30 | * \file
31 | * Place-holder for prefixing the cub namespace
32 | */
33 |
34 | #pragma once
35 |
36 | // For example:
37 | //#define CUB_NS_PREFIX namespace thrust{ namespace detail {
38 | //#define CUB_NS_POSTFIX } }
39 |
40 | #ifndef CUB_NS_PREFIX
41 | #define CUB_NS_PREFIX
42 | #endif
43 |
44 | #ifndef CUB_NS_POSTFIX
45 | #define CUB_NS_POSTFIX
46 | #endif
47 |
--------------------------------------------------------------------------------
/low_level_vision/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.7)
2 | project(low_level_vision)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | utilities
6 | )
7 |
8 | find_package(CUDA 6.5 REQUIRED)
9 | set(GENCODE_SM20 -gencode=arch=compute_20,code=sm_20)
10 | set(GENCODE_SM30 -gencode=arch=compute_30,code=sm_30)
11 | set(GENCODE_SM35 -gencode=arch=compute_35,code=sm_35)
12 | set(GENCODE_SM50 -gencode=arch=compute_50,code=sm_50)
13 | set(GENCODE_SM52 -gencode=arch=compute_52,code=sm_52)
14 | set(GENCODE_SM61 -gencode=arch=compute_61,code=sm_61)
15 | set(CUDA_NVCC_FLAGS -O3;--compiler-options;-fPIC;-ftz=true;-prec-sqrt=false;-prec-div=false)
16 | set(CUDA_PROPAGATE_HOST_FLAGS OFF) # don't propagate c++11 options to nvcc
17 | if (${CUDA_VERSION_MAJOR} LESS 7)
18 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${VERBOSE_PTXAS})
19 | elseif(${CUDA_VERSION_MAJOR} LESS 8)
20 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${VERBOSE_PTXAS})
21 | else()
22 | set(CUDA_OPTIONS ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${GENCODE_SM61} ${VERBOSE_PTXAS})
23 | endif()
24 |
25 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
26 |
27 | catkin_package(
28 | INCLUDE_DIRS include ${CUDA_INCLUDE_DIRS}
29 | LIBRARIES ${PROJECT_NAME}
30 | CATKIN_DEPENDS utilities
31 | )
32 |
33 | # show additional files in qtcreator
34 | execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f
35 | OUTPUT_VARIABLE FILES_STRING)
36 | string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
37 | add_custom_target(additional_files_${PROJECT_NAME} SOURCES
38 | ${FILES_LIST}
39 | ${PROJECT_SOURCE_DIR}/../README.md
40 | )
41 |
42 | include_directories(include
43 | ${catkin_INCLUDE_DIRS}
44 | )
45 |
46 | cuda_add_library(${PROJECT_NAME}
47 | src/convolution_kernels.cu
48 | src/d_gabor.cpp
49 | src/d_gabor_pyramid.cpp
50 | src/d_image_pyramid.cpp
51 | src/d_optical_and_ar_flow.cpp
52 | src/optical_flow_kernels.cu
53 | src/utility_kernels.cu
54 | OPTIONS ${CUDA_OPTIONS}
55 | )
56 | target_link_libraries(${PROJECT_NAME}
57 | ${catkin_LIBRARIES}
58 | ${CUDA_LIBRARIES}
59 | )
60 |
61 | catkin_add_gtest(test_low_level_vision src/test/utest.cpp)
62 | target_link_libraries(test_low_level_vision
63 | ${PROJECT_NAME}
64 | )
65 |
--------------------------------------------------------------------------------
/utilities/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.7)
2 | project(utilities)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | )
6 |
7 | find_package(HDF5 COMPONENTS CXX)
8 | find_package(Boost COMPONENTS system filesystem REQUIRED)
9 |
10 | find_package(CUDA 6.5 REQUIRED)
11 | set(GENCODE_SM20 -gencode=arch=compute_20,code=sm_20)
12 | set(GENCODE_SM30 -gencode=arch=compute_30,code=sm_30)
13 | set(GENCODE_SM35 -gencode=arch=compute_35,code=sm_35)
14 | set(GENCODE_SM50 -gencode=arch=compute_50,code=sm_50)
15 | set(GENCODE_SM52 -gencode=arch=compute_52,code=sm_52)
16 | set(GENCODE_SM61 -gencode=arch=compute_61,code=sm_61)
17 | set(CUDA_NVCC_FLAGS -O3;--compiler-options;-fPIC;-ftz=true;-prec-sqrt=false;-prec-div=false)
18 | set(CUDA_PROPAGATE_HOST_FLAGS OFF) # don't propagate c++11 options to nvcc
19 | if (${CUDA_VERSION_MAJOR} LESS 7)
20 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${VERBOSE_PTXAS})
21 | elseif(${CUDA_VERSION_MAJOR} LESS 8)
22 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${VERBOSE_PTXAS})
23 | else()
24 | set(CUDA_OPTIONS ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${GENCODE_SM61} ${VERBOSE_PTXAS})
25 | endif()
26 |
27 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
28 |
29 | catkin_package(
30 | INCLUDE_DIRS include ${CUDA_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS}
31 | LIBRARIES ${PROJECT_NAME}
32 | )
33 |
34 | # show additional files in qtcreator
35 | execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f
36 | OUTPUT_VARIABLE FILES_STRING)
37 | string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
38 | add_custom_target(additional_files_${PROJECT_NAME} SOURCES
39 | ${FILES_LIST}
40 | ${PROJECT_SOURCE_DIR}/../README.md
41 | )
42 |
43 | include_directories(include
44 | ${HDF5_INCLUDE_DIRS}
45 | ${Boost_INCLUDE_DIRS}
46 | ../third_party/nvidia_cub/
47 | )
48 |
49 | cuda_add_library(${PROJECT_NAME}
50 | src/cub_radix_sorter_kernels.cu
51 | src/utilities.cpp
52 | OPTIONS ${CUDA_OPTIONS}
53 | )
54 |
55 | target_link_libraries(${PROJECT_NAME}
56 | ${catkin_LIBRARIES}
57 | ${HDF5_LIBRARIES}
58 | ${Boost_LIBRARIES}
59 | ${CUDA_LIBRARIES}
60 | )
61 |
62 | catkin_add_gtest(test_utilities src/test/utest.cpp)
63 | target_link_libraries(test_utilities
64 | ${PROJECT_NAME}
65 | )
66 |
--------------------------------------------------------------------------------
/rendering/include/stl_loader.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008, Willow Garage, Inc.
3 | * All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | *
8 | * * Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * * Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * * Neither the name of the Willow Garage, Inc. nor the names of its
14 | * contributors may be used to endorse or promote products derived from
15 | * this software without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 | * POSSIBILITY OF SUCH DAMAGE.
28 | */
29 |
30 | #ifndef OGRE_TOOLS_STL_LOADER_H
31 | #define OGRE_TOOLS_STL_LOADER_H
32 |
33 | #include
34 | #include
35 |
36 | #include
37 | #include
38 |
39 | namespace render {
40 |
41 | class STLLoader {
42 | public:
43 | STLLoader();
44 | ~STLLoader();
45 |
46 | bool load(const std::string &path);
47 | bool load(uint8_t *buffer);
48 |
49 | Ogre::MeshPtr toMesh(const std::string &name);
50 |
51 | struct Triangle {
52 | Ogre::Vector3 vertices_[3];
53 | Ogre::Vector3 normal_;
54 | };
55 |
56 | typedef std::vector V_Triangle;
57 | V_Triangle triangles_;
58 | };
59 | }
60 |
61 | #endif // OGRE_TOOLS_STL_LOADER_H
62 |
--------------------------------------------------------------------------------
/siftgpu/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.7)
2 | project(siftgpu)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | )
6 |
7 | find_package(PkgConfig)
8 | pkg_check_modules(GLEW REQUIRED glew)
9 |
10 | find_package(CUDA 6.5 REQUIRED)
11 | set(GENCODE_SM20 -gencode=arch=compute_20,code=sm_20)
12 | set(GENCODE_SM30 -gencode=arch=compute_30,code=sm_30)
13 | set(GENCODE_SM35 -gencode=arch=compute_35,code=sm_35)
14 | set(GENCODE_SM50 -gencode=arch=compute_50,code=sm_50)
15 | set(GENCODE_SM52 -gencode=arch=compute_52,code=sm_52)
16 | set(GENCODE_SM61 -gencode=arch=compute_61,code=sm_61)
17 | set(CUDA_NVCC_FLAGS -O3;-ftz=true;-prec-sqrt=false;-prec-div=false)
18 | set(CUDA_PROPAGATE_HOST_FLAGS ON) # propagate -DCUDA_SIFTGPU_ENABLED
19 | if (${CUDA_VERSION_MAJOR} LESS 7)
20 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${VERBOSE_PTXAS})
21 | elseif(${CUDA_VERSION_MAJOR} LESS 8)
22 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${VERBOSE_PTXAS})
23 | else()
24 | set(CUDA_OPTIONS ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${GENCODE_SM61} ${VERBOSE_PTXAS})
25 | endif()
26 |
27 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCUDA_SIFTGPU_ENABLED")
28 | # disable warnings thrown by siftgpu compilation
29 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-int-to-pointer-cast -Wno-write-strings -Wno-unused-result")
30 |
31 | catkin_package(
32 | INCLUDE_DIRS include
33 | LIBRARIES ${PROJECT_NAME}
34 | )
35 |
36 | # show additional files in qtcreator
37 | execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f
38 | OUTPUT_VARIABLE FILES_STRING)
39 | string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
40 | add_custom_target(additional_files_${PROJECT_NAME} SOURCES
41 | ${FILES_LIST}
42 | ${PROJECT_SOURCE_DIR}/../README.md
43 | )
44 |
45 | include_directories(include
46 | )
47 |
48 | cuda_add_library(${PROJECT_NAME}
49 | src/ProgramCU.cu
50 | src/CuTexImage.cpp
51 | src/FrameBufferObject.cpp
52 | src/GlobalUtil.cpp
53 | src/GLTexImage.cpp
54 | src/ProgramGLSL.cpp
55 | src/ProgramGPU.cpp
56 | src/PyramidCU.cpp
57 | src/PyramidGL.cpp
58 | src/ShaderMan.cpp
59 | src/SiftGPU.cpp
60 | src/SiftMatch.cpp
61 | src/SiftMatchCU.cpp
62 | src/SiftPyramid.cpp
63 | OPTIONS ${CUDA_OPTIONS}
64 | )
65 | target_link_libraries(${PROJECT_NAME}
66 | ${catkin_LIBRARIES}
67 | ${CUDA_LIBRARIES}
68 | ${GLEW_LIBRARIES}
69 | )
70 |
--------------------------------------------------------------------------------
/siftgpu/include/SiftMatchCU.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: SiftMatchCU.h
3 | // Author: Changchang Wu
4 | // Description : interface for the SiftMatchCU
5 | ////
6 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
7 | // All Rights Reserved
8 | //
9 | // Permission to use, copy, modify and distribute this software and its
10 | // documentation for educational, research and non-profit purposes, without
11 | // fee, and without a written agreement is hereby granted, provided that the
12 | // above copyright notice and the following paragraph appear in all copies.
13 | //
14 | // The University of North Carolina at Chapel Hill make no representations
15 | // about the suitability of this software for any purpose. It is provided
16 | // 'as is' without express or implied warranty.
17 | //
18 | // Please send BUG REPORTS to ccwu@cs.unc.edu
19 | //
20 | ////////////////////////////////////////////////////////////////////////////
21 |
22 |
23 |
24 | #ifndef CU_SIFT_MATCH_H
25 | #define CU_SIFT_MATCH_H
26 | #if defined(CUDA_SIFTGPU_ENABLED)
27 |
28 | class CuTexImage;
29 | class SiftMatchCU:public SiftMatchGPU
30 | {
31 | private:
32 | //tex storage
33 | CuTexImage _texLoc[2];
34 | CuTexImage _texDes[2];
35 | CuTexImage _texDot;
36 | CuTexImage _texMatch[2];
37 | CuTexImage _texCRT;
38 |
39 | //programs
40 | //
41 | int _max_sift;
42 | int _num_sift[2];
43 | int _id_sift[2];
44 | int _have_loc[2];
45 |
46 | //gpu parameter
47 | int _initialized;
48 | vector sift_buffer;
49 | private:
50 | int GetBestMatch(int max_match, int match_buffer[][2], float distmax, float ratiomax, int mbm);
51 | public:
52 | SiftMatchCU(int max_sift);
53 | virtual ~SiftMatchCU(){};
54 | void InitSiftMatch();
55 | void SetMaxSift(int max_sift);
56 | void SetDescriptors(int index, int num, const unsigned char * descriptor, int id = -1);
57 | void SetDescriptors(int index, int num, const float * descriptor, int id = -1);
58 | void SetFeautreLocation(int index, const float* locatoins, int gap);
59 | int GetSiftMatch(int max_match, int match_buffer[][2], float distmax, float ratiomax, int mbm);
60 | int GetGuidedSiftMatch(int max_match, int match_buffer[][2], float H[3][3], float F[3][3],
61 | float distmax, float ratiomax, float hdistmax, float fdistmax, int mbm);
62 | //////////////////////////////
63 | static int CheckCudaDevice(int device);
64 | };
65 |
66 | #endif
67 | #endif
68 |
69 |
--------------------------------------------------------------------------------
/pose_estimation/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.7)
2 | project(pose_estimation)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | cmake_modules
6 | siftgpu
7 | rendering
8 | utilities
9 | )
10 |
11 | find_package(Eigen3 REQUIRED)
12 | add_definitions(${EIGEN_DEFINITIONS})
13 |
14 | find_package(CUDA 6.5 REQUIRED)
15 | set(GENCODE_SM20 -gencode=arch=compute_20,code=sm_20)
16 | set(GENCODE_SM30 -gencode=arch=compute_30,code=sm_30)
17 | set(GENCODE_SM35 -gencode=arch=compute_35,code=sm_35)
18 | set(GENCODE_SM50 -gencode=arch=compute_50,code=sm_50)
19 | set(GENCODE_SM52 -gencode=arch=compute_52,code=sm_52)
20 | set(GENCODE_SM61 -gencode=arch=compute_61,code=sm_61)
21 | set(CUDA_NVCC_FLAGS -O3;--compiler-options;-fPIC;-ftz=true;-prec-sqrt=false;-prec-div=false)
22 | set(CUDA_PROPAGATE_HOST_FLAGS OFF) # don't propagate c++11 options to nvcc
23 | if (${CUDA_VERSION_MAJOR} LESS 7)
24 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${VERBOSE_PTXAS})
25 | elseif(${CUDA_VERSION_MAJOR} LESS 8)
26 | set(CUDA_OPTIONS ${GENCODE_SM20} ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${VERBOSE_PTXAS})
27 | else()
28 | set(CUDA_OPTIONS ${GENCODE_SM30} ${GENCODE_SM35} ${GENCODE_SM50} ${GENCODE_SM52} ${GENCODE_SM61} ${VERBOSE_PTXAS})
29 | endif()
30 |
31 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
32 |
33 | catkin_package(
34 | INCLUDE_DIRS include ${CUDA_INCLUDE_DIRS}
35 | LIBRARIES ${PROJECT_NAME}
36 | CATKIN_DEPENDS siftgpu rendering utilities
37 | )
38 |
39 | # show additional files in qtcreator
40 | execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f
41 | OUTPUT_VARIABLE FILES_STRING)
42 | string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
43 | add_custom_target(additional_files_${PROJECT_NAME} SOURCES
44 | ${FILES_LIST}
45 | ${PROJECT_SOURCE_DIR}/../README.md
46 | )
47 |
48 | include_directories(include
49 | ${catkin_INCLUDE_DIRS}
50 | ${EIGEN_INCLUDE_DIR}
51 | )
52 |
53 | cuda_add_library(${PROJECT_NAME}
54 | src/d_multiple_rigid_poses.cpp
55 | src/d_multiple_rigid_pose_sparse.cpp
56 | src/multiple_rigid_models_ogre.cpp
57 | src/multiple_rigid_pose_kernels.cu
58 | src/translation_rotation_3d.cpp
59 | src/normal_equations.cpp
60 | src/utility_kernels_pose.cu
61 | src/d_point_cloud.cpp
62 | OPTIONS ${CUDA_OPTIONS}
63 | )
64 | target_link_libraries(${PROJECT_NAME}
65 | ${catkin_LIBRARIES}
66 | ${CUDA_LIBRARIES}
67 | )
68 |
69 | catkin_add_gtest(test_pose_estimation src/test/utest.cpp)
70 | target_link_libraries(test_pose_estimation
71 | ${PROJECT_NAME}
72 | )
73 |
--------------------------------------------------------------------------------
/siftgpu/include/CuTexImage.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: CuTexImage.h
3 | // Author: Changchang Wu
4 | // Description : interface for the CuTexImage class.
5 | // class for storing data in CUDA.
6 | //
7 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
8 | // All Rights Reserved
9 | //
10 | // Permission to use, copy, modify and distribute this software and its
11 | // documentation for educational, research and non-profit purposes, without
12 | // fee, and without a written agreement is hereby granted, provided that the
13 | // above copyright notice and the following paragraph appear in all copies.
14 | //
15 | // The University of North Carolina at Chapel Hill make no representations
16 | // about the suitability of this software for any purpose. It is provided
17 | // 'as is' without express or implied warranty.
18 | //
19 | // Please send BUG REPORTS to ccwu@cs.unc.edu
20 | //
21 | ////////////////////////////////////////////////////////////////////////////
22 |
23 |
24 | #ifndef CU_TEX_IMAGE_H
25 | #define CU_TEX_IMAGE_H
26 |
27 | class GLTexImage;
28 | struct cudaArray;
29 | struct textureReference;
30 |
31 | //using texture2D from linear memory
32 |
33 | #define SIFTGPU_ENABLE_LINEAR_TEX2D
34 |
35 | class CuTexImage
36 | {
37 | protected:
38 | void* _cuData;
39 | cudaArray* _cuData2D;
40 | int _numChannel;
41 | int _numBytes;
42 | int _imgWidth;
43 | int _imgHeight;
44 | int _texWidth;
45 | int _texHeight;
46 | GLuint _fromPBO;
47 | public:
48 | virtual void SetImageSize(int width, int height);
49 | virtual void InitTexture(int width, int height, int nchannel = 1);
50 | void InitTexture2D();
51 | inline void BindTexture(textureReference& texRef);
52 | inline void BindTexture2D(textureReference& texRef);
53 | void CopyToTexture2D();
54 | void CopyToHost(void* buf);
55 | void CopyToHost(void* buf, int stream);
56 | void CopyFromHost(const void* buf);
57 | int CopyToPBO(GLuint pbo);
58 | void CopyFromPBO(int width, int height, GLuint pbo);
59 | static int DebugCopyToTexture2D();
60 | public:
61 | inline int GetImgWidth(){return _imgWidth;}
62 | inline int GetImgHeight(){return _imgHeight;}
63 | inline int GetDataSize(){return _numBytes;}
64 | public:
65 | CuTexImage();
66 | CuTexImage(int width, int height, int nchannel, GLuint pbo);
67 | virtual ~CuTexImage();
68 | friend class ProgramCU;
69 | friend class PyramidCU;
70 | };
71 |
72 | //////////////////////////////////////////////////
73 | //transfer OpenGL Texture to PBO, then to CUDA vector
74 | //#endif
75 | #endif // !defined(CU_TEX_IMAGE_H)
76 |
77 |
--------------------------------------------------------------------------------
/siftgpu/README.txt:
--------------------------------------------------------------------------------
1 | A GPU implementation of David Lowe's Scale Invariant Feature Transform
2 |
3 | Changchang wu
4 |
5 | http://cs.unc.edu/~ccwu
6 |
7 | University of North Carolina at Chapel Hill
8 |
9 |
10 |
11 |
12 | 1. SIFT
13 |
14 | SIFTGPU is an implementation of SIFT for GPU. SiftGPU uses GPU to process pixels and features
15 | parallely in Gaussian pyramid construction, DoG keypoint detection and descriptor generation
16 | for SIFT. Compact feature list is efficiently build through a GPU/CPU mixed reduction.
17 |
18 | SIFTGPU is inspired by Andrea Vedaldi's sift++ and Sudipta N Sinha et al's GPU-SIFT. Many
19 | parameters of sift++ ( for example, number of octaves,number of DOG levels, edge threshold,
20 | etc) are available in SiftGPU.
21 |
22 |
23 | SIFTGPU also includes a GPU exhaustive/guided sift matcher SiftMatchGPU. It basically multiplies
24 | the descriptor matrix on GPU and find closest feature matches on GPU. GLSL/CUDA/CG implementations
25 | are all provided.
26 |
27 | NEW: The latest SIFTGPU also enables you to use Multi-GPUs and GPUS on different computers.
28 | Check doc/manual.pdf for more information. You can modify some marcros definition in
29 | SimpleSIFT.cpp and speed.cpp to enable the testing of the new functions.
30 |
31 |
32 | 2. Requirements
33 |
34 | The default implemntation uses GLSL, and it requires a GPU that has large memory and supports
35 | dynamic branching. For nVidia graphic cards, you can optionally use CG(require fp40) or
36 | CUDA implementation. You can try different implementations and to find out the fastest one
37 | for different image sizes and parameters.
38 |
39 | The GLSL version may not work on ATI now. They did compile sucessfully with ATI Catalyst 8.9,
40 | but not any more with 9.x versions.
41 |
42 | SiftGPU uses DevIl Image library, GLEW and GLUT. You'll need to make sure your system has
43 | all the dependening libraries. SiftGPU should be able to run on any operation system that supports
44 | the above libraries
45 |
46 | For windows system visual studio solution are provided as msvc/SiftGPU.dsw, msvc/SiftGPU.sln and
47 | msvc/SiftGPU_CUDA_Enabled.sln. Linux/Mac makefile is in folder Linux of the package.
48 |
49 |
50 | 3. Helps
51 |
52 | Use -help to get parameter information. Check /doc/manual.pdf for samples and explanations.
53 | In the vc workspace, there is a project called SimpleSIF that gives an example of simple
54 | SiftGPU usage. There are more examples of different ways of using SiftGPU in manual.pdf
55 |
56 |
57 | Check /doc/manual.pdf for help on the viewer.
58 |
59 |
--------------------------------------------------------------------------------
/interface/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.7)
2 | project(interface)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | cmake_modules
6 | cv_bridge
7 | low_level_vision
8 | pose_estimation
9 | )
10 |
11 | find_package(OpenCV 3.1.0 REQUIRED)
12 | find_package(Eigen3 REQUIRED)
13 | add_definitions(${EIGEN_DEFINITIONS})
14 |
15 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
16 |
17 | catkin_package(
18 | INCLUDE_DIRS include
19 | LIBRARIES ${PROJECT_NAME}
20 | CATKIN_DEPENDS low_level_vision pose_estimation
21 | DEPENDS cv_bridge
22 | )
23 |
24 | # show additional files in qtcreator
25 | execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f
26 | OUTPUT_VARIABLE FILES_STRING)
27 | string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
28 | add_custom_target(additional_files_${PROJECT_NAME} SOURCES
29 | ${FILES_LIST}
30 | ${PROJECT_SOURCE_DIR}/../README.md
31 | )
32 |
33 | include_directories(
34 | include
35 | ${catkin_INCLUDE_DIRS}
36 | ${OpenCV2_INCLUDE_DIRS}
37 | ${EIGEN_INCLUDE_DIR}
38 | )
39 |
40 | add_library(${PROJECT_NAME}
41 | src/multi_rigid_tracker.cpp
42 | src/multi_rigid_detector.cpp
43 | )
44 | target_link_libraries(${PROJECT_NAME}
45 | ${catkin_LIBRARIES}
46 | ${OpenCV_LIBS}
47 | )
48 |
49 | add_executable(cmd_line_generate_sift_model
50 | src/cmd_line_generate_sift_model.cpp
51 | )
52 | target_link_libraries(cmd_line_generate_sift_model
53 | ${PROJECT_NAME}
54 | )
55 |
56 | add_executable(cmd_line_optical_flow
57 | src/cmd_line_optical_flow.cpp
58 | )
59 | target_link_libraries(cmd_line_optical_flow
60 | ${PROJECT_NAME}
61 | )
62 |
63 | add_executable(cmd_line_render
64 | src/cmd_line_render.cpp
65 | )
66 | target_link_libraries(cmd_line_render
67 | ${PROJECT_NAME}
68 | )
69 |
70 | add_executable(cmd_line_render_scene
71 | src/cmd_line_render_scene.cpp
72 | )
73 | target_link_libraries(cmd_line_render_scene
74 | ${PROJECT_NAME}
75 | )
76 |
77 | add_executable(cmd_line_get_robot_frame
78 | src/cmd_line_get_robot_frame.cpp
79 | )
80 | target_link_libraries(cmd_line_get_robot_frame
81 | ${PROJECT_NAME}
82 | )
83 |
84 | add_executable(cmd_line_extract_sift
85 | src/cmd_line_extract_sift.cpp
86 | )
87 | target_link_libraries(cmd_line_extract_sift
88 | ${PROJECT_NAME}
89 | )
90 |
91 | add_executable(cmd_line_detect_object_pose
92 | src/cmd_line_detect_object_pose.cpp
93 | )
94 | target_link_libraries(cmd_line_detect_object_pose
95 | ${PROJECT_NAME}
96 | )
97 |
98 | add_executable(cmd_line_track_multi_object
99 | src/cmd_line_track_multi_object.cpp
100 | )
101 | target_link_libraries(cmd_line_track_multi_object
102 | ${PROJECT_NAME}
103 | )
104 |
--------------------------------------------------------------------------------
/rendering/include/env_config.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 |
37 | namespace render {
38 |
39 | std::string get_distro();
40 | std::string get_ogre_plugin_path();
41 | }
42 |
--------------------------------------------------------------------------------
/utilities/include/utilities.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 |
37 | namespace util {
38 |
39 | void initializeCUDARuntime(int device = 0);
40 |
41 | class TimerGPU {
42 |
43 | public:
44 | TimerGPU(cudaStream_t stream_ = 0);
45 | ~TimerGPU();
46 | float read();
47 | void reset();
48 |
49 | private:
50 | const cudaStream_t stream_;
51 | cudaEvent_t start_, stop_;
52 | };
53 | }
54 |
--------------------------------------------------------------------------------
/simtrack_nodes/src/multi_rigid_node_main.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 |
35 | int main(int argc, char **argv) {
36 | ros::init(argc, argv, "multi_rigid_node");
37 | ros::NodeHandle nh;
38 | simtrack::MultiRigidNode node(nh);
39 | if (!node.start()) {
40 | ROS_ERROR("simtrack::Node not ready, cannot proceed.");
41 | return 1;
42 | }
43 |
44 | ros::spin();
45 | return 0;
46 | }
47 |
--------------------------------------------------------------------------------
/simtrack_nodes/src/pr2_cam_switch_node_main.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 |
35 | int main(int argc, char **argv) {
36 | ros::init(argc, argv, "pr2_cam_switch_node");
37 | ros::NodeHandle nh;
38 | simtrack::PR2CamSwitchNode node(nh);
39 | if (!node.start()) {
40 | ROS_ERROR("simtrack::Node not ready, cannot proceed.");
41 | return 1;
42 | }
43 |
44 | ros::spin();
45 | return 0;
46 | }
47 |
--------------------------------------------------------------------------------
/rendering/src/env_config.cpp.in:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include "env_config.h"
34 |
35 | namespace render {
36 |
37 | std::string get_distro() {
38 | // The return string here is replaced at compile time by
39 | // CMakeLists.txt in this directory.
40 | return "@ROS_DISTRO@";
41 | }
42 |
43 | std::string get_ogre_plugin_path() {
44 | // The return string here is replaced at compile time by
45 | // CMakeLists.txt in this directory.
46 | return "@OGRE_PLUGIN_PATH@";
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/rendering/ogre_media/materials/glsl/untextured.vert:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #version 400
34 | in vec4 position;
35 | in vec3 normal;
36 |
37 | uniform mat4 worldViewProj;
38 | uniform mat4 invTraWorldView;
39 | uniform vec4 segmentIndex;
40 |
41 | out float vertexSegmentIndex;
42 | out vec3 vertexNormal;
43 |
44 | void main()
45 | {
46 | gl_Position = worldViewProj * vec4(position.xyz, 1.0f);
47 | vertexNormal = normalize( mat3x3(invTraWorldView) * normal );
48 | vertexSegmentIndex = segmentIndex.x;
49 | }
50 |
--------------------------------------------------------------------------------
/rendering/include/windowless_gl_context.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 |
40 | namespace render {
41 |
42 | class WindowLessGLContext {
43 |
44 | public:
45 | WindowLessGLContext(int width, int height);
46 | ~WindowLessGLContext();
47 | void makeActive();
48 |
49 | private:
50 | Display *dpy;
51 | GLXContext ctx;
52 | GLXPbuffer pbuf;
53 | const int _width;
54 | const int _height;
55 | };
56 | }
57 |
--------------------------------------------------------------------------------
/rendering/ogre_media/materials/glsl/textured.vert:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #version 400
34 | in vec4 position;
35 | in vec3 normal;
36 | in vec2 uv0;
37 |
38 | uniform mat4 worldViewProj;
39 | uniform mat4 invTraWorldView;
40 | uniform vec4 segmentIndex;
41 |
42 | out float vertexSegmentIndex;
43 | out vec3 vertexNormal;
44 | out vec2 vertexTexCoord;
45 |
46 | void main()
47 | {
48 | gl_Position = worldViewProj * vec4(position.xyz, 1.0f);
49 | vertexNormal = normalize( mat3x3(invTraWorldView) * normal );
50 | vertexSegmentIndex = segmentIndex.x;
51 | vertexTexCoord = uv0;
52 | }
53 |
--------------------------------------------------------------------------------
/utilities/include/cub_radix_sorter_kernels.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | namespace util {
36 |
37 | template
38 | size_t GetTempStorageSize(int num_items, int begin_bit, int end_bit);
39 |
40 | template
41 | void CubSort(Key *&d_key_sorted, Value *&d_value_sorted, Key *d_key_buf,
42 | Key *d_key_alt_buf, Value *d_value_buf, Value *d_value_alt_buf,
43 | int num_items, int begin_bit, int end_bit, void *d_temp_storage,
44 | size_t temp_storage_bytes, cudaStream_t stream);
45 | }
46 |
--------------------------------------------------------------------------------
/rendering/src/test/utest.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 | #include
35 | #include
36 |
37 | TEST(TestWindowLessGLContext, createMakeActiveAndDestroy) {
38 | try {
39 | {
40 | render::WindowLessGLContext context(10, 10);
41 | context.makeActive();
42 | }
43 |
44 | SUCCEED();
45 | return;
46 | }
47 | catch (std::exception &ex) {
48 | ADD_FAILURE() << ex.what();
49 | }
50 | }
51 |
52 | // Run all the tests that were declared with TEST()
53 | int main(int argc, char **argv) {
54 | testing::InitGoogleTest(&argc, argv);
55 | return RUN_ALL_TESTS();
56 | }
57 |
--------------------------------------------------------------------------------
/pose_estimation/include/normal_equations.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 |
37 | namespace pose {
38 |
39 | class NormalEquations {
40 | public:
41 | NormalEquations();
42 | void reset();
43 | double squaredNormDeltaT() const;
44 | void compose(const float *CO, const float *CD);
45 | void solve(float *dTdR);
46 | void preCondition();
47 | const std::vector &getA() { return (_A); }
48 | const std::vector &getB() { return (_B); }
49 | const std::vector &getdTdR() { return (_dTdR); }
50 | void show() const;
51 |
52 | private:
53 | std::vector _A, _B, _dTdR;
54 | };
55 | }
56 |
--------------------------------------------------------------------------------
/low_level_vision/include/optical_flow_kernels.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 | #include
35 |
36 | namespace vision {
37 |
38 | struct PitchFloat2Mem {
39 | float2 *ptr;
40 | size_t pitch;
41 | };
42 |
43 | void computeOpticalFlowTwoFrames(
44 | std::vector &d_optic_flow_pyramid, char *d_TEMP,
45 | int d_TEMPPitch, const std::vector &gabPyr1_v,
46 | const std::vector &gabPyr2_v,
47 | cudaArray *d_frame2_flow_array, int n_scales, bool median_filter,
48 | bool consistent, float cons_thres, std::vector &n_rows,
49 | std::vector &n_cols, bool fourOrientations);
50 |
51 | } // end namespace vision
52 |
--------------------------------------------------------------------------------
/siftgpu/include/SiftMatch.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: SiftMatch.h
3 | // Author: Changchang Wu
4 | // Description : interface for the SiftMatchGL
5 | ////
6 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
7 | // All Rights Reserved
8 | //
9 | // Permission to use, copy, modify and distribute this software and its
10 | // documentation for educational, research and non-profit purposes, without
11 | // fee, and without a written agreement is hereby granted, provided that the
12 | // above copyright notice and the following paragraph appear in all copies.
13 | //
14 | // The University of North Carolina at Chapel Hill make no representations
15 | // about the suitability of this software for any purpose. It is provided
16 | // 'as is' without express or implied warranty.
17 | //
18 | // Please send BUG REPORTS to ccwu@cs.unc.edu
19 | //
20 | ////////////////////////////////////////////////////////////////////////////
21 |
22 |
23 | #ifndef GPU_SIFT_MATCH_H
24 | #define GPU_SIFT_MATCH_H
25 | class GLTexImage;
26 | class ProgramGPU;
27 |
28 | class SiftMatchGL:public SiftMatchGPU
29 | {
30 | typedef GLint ParameterGL;
31 | private:
32 | //tex storage
33 | GLTexImage _texLoc[2];
34 | GLTexImage _texDes[2];
35 | GLTexImage _texDot;
36 | GLTexImage _texMatch[2];
37 |
38 | //programs
39 | ProgramGPU * s_multiply;
40 | ProgramGPU * s_guided_mult;
41 | ProgramGPU * s_col_max;
42 | ProgramGPU * s_row_max;
43 |
44 | //matching parameters
45 | ParameterGL _param_multiply_tex1;
46 | ParameterGL _param_multiply_tex2;
47 | ParameterGL _param_multiply_size;
48 | ParameterGL _param_rowmax_param;
49 | ParameterGL _param_colmax_param;
50 |
51 | ///guided matching
52 | ParameterGL _param_guided_mult_tex1;
53 | ParameterGL _param_guided_mult_tex2;
54 | ParameterGL _param_guided_mult_texl1;
55 | ParameterGL _param_guided_mult_texl2;
56 | ParameterGL _param_guided_mult_h;
57 | ParameterGL _param_guided_mult_f;
58 | ParameterGL _param_guided_mult_param;
59 | //
60 | int _max_sift;
61 | int _num_sift[2];
62 | int _id_sift[2];
63 | int _have_loc[2];
64 |
65 | //gpu parameter
66 | int _sift_per_stripe;
67 | int _sift_num_stripe;
68 | int _sift_per_row;
69 | int _pixel_per_sift;
70 | int _initialized;
71 | //
72 | vector sift_buffer;
73 | private:
74 | void AllocateSiftMatch();
75 | void LoadSiftMatchShadersGLSL();
76 | int GetBestMatch(int max_match, int match_buffer[][2], float distmax, float ratiomax, int mbm);
77 | public:
78 | SiftMatchGL(int max_sift, int use_glsl);
79 | virtual ~SiftMatchGL();
80 | public:
81 | void InitSiftMatch();
82 | void SetMaxSift(int max_sift);
83 | void SetDescriptors(int index, int num, const unsigned char * descriptor, int id = -1);
84 | void SetDescriptors(int index, int num, const float * descriptor, int id = -1);
85 | void SetFeautreLocation(int index, const float* locatoins, int gap);
86 | int GetSiftMatch(int max_match, int match_buffer[][2], float distmax, float ratiomax, int mbm);
87 | int GetGuidedSiftMatch(int max_match, int match_buffer[][2], float H[3][3], float F[3][3],
88 | float distmax, float ratiomax, float hdistmax,float fdistmax, int mbm);
89 | };
90 |
91 |
92 | #endif
93 |
94 |
--------------------------------------------------------------------------------
/siftgpu/include/PyramidCU.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: PyramidCU.h
3 | // Author: Changchang Wu
4 | // Description : interface for the PyramdCU
5 | //
6 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
7 | // All Rights Reserved
8 | //
9 | // Permission to use, copy, modify and distribute this software and its
10 | // documentation for educational, research and non-profit purposes, without
11 | // fee, and without a written agreement is hereby granted, provided that the
12 | // above copyright notice and the following paragraph appear in all copies.
13 | //
14 | // The University of North Carolina at Chapel Hill make no representations
15 | // about the suitability of this software for any purpose. It is provided
16 | // 'as is' without express or implied warranty.
17 | //
18 | // Please send BUG REPORTS to ccwu@cs.unc.edu
19 | //
20 | ////////////////////////////////////////////////////////////////////////////
21 |
22 |
23 |
24 | #ifndef _PYRAMID_CU_H
25 | #define _PYRAMID_CU_H
26 | #if defined(CUDA_SIFTGPU_ENABLED)
27 |
28 | class GLTexImage;
29 | class CuTexImage;
30 | class SiftPyramid;
31 | class PyramidCU:public SiftPyramid
32 | {
33 | CuTexImage* _inputTex;
34 | CuTexImage* _allPyramid;
35 | CuTexImage* _histoPyramidTex;
36 | CuTexImage* _featureTex;
37 | CuTexImage* _descriptorTex;
38 | CuTexImage* _orientationTex;
39 | GLuint _bufferPBO;
40 | GLTexImage* _bufferTEX;
41 | public:
42 | virtual void GetFeatureDescriptors();
43 | virtual void GenerateFeatureListTex();
44 | virtual void ReshapeFeatureListCPU();
45 | virtual void GenerateFeatureDisplayVBO();
46 | virtual void DestroySharedData();
47 | virtual void DestroyPerLevelData();
48 | virtual void DestroyPyramidData();
49 | virtual void DownloadKeypoints();
50 | virtual void GenerateFeatureListCPU();
51 | virtual void GenerateFeatureList();
52 | virtual GLTexImage* GetLevelTexture(int octave, int level);
53 | virtual GLTexImage* GetLevelTexture(int octave, int level, int dataName);
54 | virtual void BuildPyramid(GLTexInput * input);
55 | virtual void DetectKeypointsEX();
56 | virtual void ComputeGradient();
57 | virtual void GetFeatureOrientations();
58 | virtual void GetSimplifiedOrientation();
59 | virtual void InitPyramid(int w, int h, int ds = 0);
60 | virtual void ResizePyramid(int w, int h);
61 | virtual int IsUsingRectDescription(){return _existing_keypoints & SIFT_RECT_DESCRIPTION; }
62 | //////////
63 | void CopyGradientTex();
64 | void FitPyramid(int w, int h);
65 |
66 | void InitializeContext();
67 | int ResizeFeatureStorage();
68 | int FitHistogramPyramid(CuTexImage* tex);
69 | void SetLevelFeatureNum(int idx, int fcount);
70 | void ConvertInputToCU(GLTexInput* input);
71 | GLTexImage* ConvertTexCU2GL(CuTexImage* tex, int dataName);
72 | CuTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN);
73 | void TruncateWidth(int& w) { w = GLTexInput::TruncateWidthCU(w); }
74 | //////////////////////////
75 | static int CheckCudaDevice(int device);
76 | private:
77 | void GenerateFeatureList(int i, int j, int reduction_count, vector& hbuffer);
78 | public:
79 | PyramidCU(SiftParam& sp);
80 | virtual ~PyramidCU();
81 | };
82 |
83 |
84 |
85 | #endif
86 | #endif
87 |
--------------------------------------------------------------------------------
/pose_estimation/src/test/utest.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 | #include
35 | #include
36 |
37 | #include
38 |
39 | using namespace pose;
40 |
41 | TEST(TranslationRotation3D, testTypeConversions) {
42 | pose::TranslationRotation3D TR;
43 | std::array Td{ 1.1, 2.2, 3.3 };
44 | TR.setT(Td.data());
45 | std::array Tf;
46 | TR.getT(Tf.data());
47 |
48 | for (int i = 0; i < 3; i++)
49 | EXPECT_FLOAT_EQ(Td.at(i), Tf.at(i)) << "Double to float";
50 | }
51 |
52 | // Run all the tests that were declared with TEST()
53 | int main(int argc, char **argv) {
54 | testing::InitGoogleTest(&argc, argv);
55 | return RUN_ALL_TESTS();
56 | }
57 |
--------------------------------------------------------------------------------
/siftgpu/src/FrameBufferObject.cpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: FrameBufferObject.cpp
3 | // Author: Changchang Wu
4 | // Description : Implementation of FrameBufferObject Class
5 | //
6 | //
7 | //
8 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
9 | // All Rights Reserved
10 | //
11 | // Permission to use, copy, modify and distribute this software and its
12 | // documentation for educational, research and non-profit purposes, without
13 | // fee, and without a written agreement is hereby granted, provided that the
14 | // above copyright notice and the following paragraph appear in all copies.
15 | //
16 | // The University of North Carolina at Chapel Hill make no representations
17 | // about the suitability of this software for any purpose. It is provided
18 | // 'as is' without express or implied warranty.
19 | //
20 | // Please send BUG REPORTS to ccwu@cs.unc.edu
21 | //
22 | ////////////////////////////////////////////////////////////////////////////
23 |
24 |
25 | #include "GL/glew.h"
26 | #include
27 | #include "GlobalUtil.h"
28 | #include "FrameBufferObject.h"
29 |
30 | //whether use only one FBO globally
31 | int FrameBufferObject::UseSingleFBO=1;
32 | GLuint FrameBufferObject::GlobalFBO=0;
33 |
34 | //////////////////////////////////////////////////////////////////////
35 | // Construction/Destruction
36 | //////////////////////////////////////////////////////////////////////
37 |
38 | FrameBufferObject::FrameBufferObject(int autobind)
39 | {
40 | if(UseSingleFBO && GlobalFBO)
41 | {
42 | _fboID = GlobalFBO;
43 | }else
44 | {
45 | glGenFramebuffersEXT(1, &_fboID);
46 | if(UseSingleFBO )GlobalFBO = _fboID;
47 | }
48 | if(autobind ) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _fboID);
49 | }
50 |
51 | FrameBufferObject::~FrameBufferObject()
52 | {
53 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
54 | if(!UseSingleFBO )
55 | {
56 | glDeleteFramebuffersEXT (1,&_fboID);
57 | }
58 | }
59 |
60 | void FrameBufferObject::DeleteGlobalFBO()
61 | {
62 | if(UseSingleFBO)
63 | {
64 | glDeleteFramebuffersEXT (1,&GlobalFBO);
65 | GlobalFBO = 0;
66 | }
67 | }
68 |
69 | void FrameBufferObject::AttachDepthTexture(GLenum textureTarget, GLuint texID)
70 | {
71 |
72 | glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, textureTarget, texID, 0);
73 | }
74 |
75 | void FrameBufferObject::AttachTexture(GLenum textureTarget, GLenum attachment, GLuint texId)
76 | {
77 | glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachment, textureTarget, texId, 0);
78 | }
79 |
80 | void FrameBufferObject::BindFBO()
81 | {
82 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _fboID);
83 | }
84 |
85 | void FrameBufferObject::UnbindFBO()
86 | {
87 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
88 | }
89 |
90 | void FrameBufferObject::UnattachTex(GLenum attachment)
91 | {
92 | glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, 0, 0 );
93 | }
94 |
95 | void FrameBufferObject::AttachRenderBuffer(GLenum attachment, GLuint buffID)
96 | {
97 | glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attachment, GL_RENDERBUFFER_EXT, buffID);
98 |
99 | }
100 |
101 | void FrameBufferObject:: UnattachRenderBuffer(GLenum attachment)
102 | {
103 | glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, attachment, GL_RENDERBUFFER_EXT, 0);
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/rendering/ogre_media/materials/glsl/untextured.frag:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #version 400
34 | in float vertexSegmentIndex;
35 | in vec3 vertexNormal;
36 |
37 | layout(location=0) out float out_normal_x;
38 | layout(location=1) out float out_normal_y;
39 | layout(location=2) out float out_normal_z;
40 | layout(location=3) out float out_z_buffer;
41 | layout(location=4) out float out_segment_ind;
42 | layout(location=5) out float out_grayscale;
43 |
44 | void main()
45 | {
46 | // no longer guaranteed unit length due to interpolation
47 | vec3 normal = normalize(vertexNormal);
48 | out_normal_x = normal.x;
49 | out_normal_y = normal.y;
50 | out_normal_z = normal.z;
51 | out_z_buffer = gl_FragCoord.z;
52 | out_segment_ind = vertexSegmentIndex;
53 |
54 | // set to 0 or 1 depending on even or odd segment
55 | out_grayscale = float( int(round(vertexSegmentIndex)) & 1);
56 |
57 | // add 1 to more easily identify rendering mask (will be equal to zero)
58 | out_grayscale += 1.0f;
59 |
60 | // out_grayscale = 0.5;
61 | }
62 |
--------------------------------------------------------------------------------
/low_level_vision/include/convolution_kernels.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 |
37 | namespace vision {
38 |
39 | void resize_replicate_border(const float *d_PixelsIn, int d_PixelsInPitch,
40 | float *d_PixelsOut, int d_PixelsOutPitch,
41 | int width_in, int height_in, int width_out,
42 | int height_out);
43 |
44 | void downSample(const float *d_PixelsIn, int d_PixelsInPitch,
45 | float *d_PixelsOut, int d_PixelsOutPitch, int width,
46 | int height);
47 |
48 | void downSampleNaN(const float *d_PixelsIn, int d_PixelsInPitch,
49 | float *d_PixelsOut, int d_PixelsOutPitch, int width,
50 | int height);
51 |
52 | void gaborFilterItl(const float *d_Image, int d_ImagePitch, float2 *d_GabItl,
53 | int d_GabItlPitch, char *d_TEMP, int d_TEMPPitch, int width,
54 | int height, bool fourOrientations);
55 |
56 | } // end namespace vision
57 |
--------------------------------------------------------------------------------
/rendering/include/ogre_context.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 | #include
35 | #include
36 | #include
37 |
38 | namespace render {
39 |
40 | class OgreContext {
41 |
42 | public:
43 | OgreContext();
44 | ~OgreContext();
45 |
46 | Ogre::SceneManager *scene_manager_;
47 |
48 | private:
49 | void setupDummyWindowId();
50 | Ogre::RenderWindow *makeRenderWindow(intptr_t window_id, unsigned int width,
51 | unsigned int height);
52 | Ogre::RenderWindow *tryMakeRenderWindow(const std::string &name,
53 | unsigned int width,
54 | unsigned int height,
55 | const Ogre::NameValuePairList *params,
56 | int max_attempts);
57 |
58 | std::unique_ptr ogre_root_;
59 |
60 | // ID for a dummy window of size 1x1, used to keep Ogre happy.
61 | unsigned long dummy_window_id_;
62 | };
63 | }
64 |
--------------------------------------------------------------------------------
/rendering/ogre_media/materials/glsl/textured.frag:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #version 400
34 | in float vertexSegmentIndex;
35 | in vec3 vertexNormal;
36 | in vec2 vertexTexCoord;
37 |
38 | uniform sampler2D tex0;
39 |
40 | layout(location=0) out float out_normal_x;
41 | layout(location=1) out float out_normal_y;
42 | layout(location=2) out float out_normal_z;
43 | layout(location=3) out float out_z_buffer;
44 | layout(location=4) out float out_segment_ind;
45 | layout(location=5) out float out_grayscale;
46 |
47 | void main()
48 | {
49 | // no longer guaranteed unit length due to interpolation
50 | vec3 normal = normalize(vertexNormal);
51 | out_normal_x = normal.x;
52 | out_normal_y = normal.y;
53 | out_normal_z = normal.z;
54 | out_z_buffer = gl_FragCoord.z;
55 | out_segment_ind = vertexSegmentIndex;
56 |
57 | vec4 color = texture2D(tex0,vertexTexCoord);
58 | out_grayscale = 0.299f*color.x + 0.587f*color.y + 0.114f*color.z;
59 |
60 | // add 1 to more easily identify rendering mask (will be equal to zero)
61 | out_grayscale += 1.0f;
62 | }
63 |
--------------------------------------------------------------------------------
/rendering/include/robot_link.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 | #include
37 | #include
38 |
39 | namespace render {
40 |
41 | class RobotLink {
42 |
43 | public:
44 | RobotLink(const urdf::Link &link, Ogre::SceneManager *scene_manager,
45 | int segment_ind);
46 |
47 | void setPose(const Ogre::Vector3 &position,
48 | const Ogre::Quaternion &orientation);
49 |
50 | void setSegmentIndex(int segment_ind);
51 |
52 | void setVisible(bool visible);
53 |
54 | const std::string getName() { return name_; }
55 |
56 | private:
57 | /**
58 | * @brief createEntityForVisualElement
59 | * Creates properly offset child node containing the visual mesh
60 | * @param visual
61 | * @return
62 | */
63 | Ogre::Entity *createEntityForVisualElement(const urdf::Visual &visual);
64 |
65 | Ogre::SceneManager *scene_manager_;
66 | std::string name_;
67 | Ogre::SceneNode *visual_node_;
68 | int segment_ind_;
69 | std::vector entities_;
70 |
71 | };
72 | }
73 |
--------------------------------------------------------------------------------
/siftgpu/include/ShaderMan.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: ShaderMan.h
3 | // Author: Changchang Wu
4 | // Description : interface for the ShaderMan class.
5 | // This is a class that manages all the shaders for SIFT
6 | //
7 | //
8 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
9 | // All Rights Reserved
10 | //
11 | // Permission to use, copy, modify and distribute this software and its
12 | // documentation for educational, research and non-profit purposes, without
13 | // fee, and without a written agreement is hereby granted, provided that the
14 | // above copyright notice and the following paragraph appear in all copies.
15 | //
16 | // The University of North Carolina at Chapel Hill make no representations
17 | // about the suitability of this software for any purpose. It is provided
18 | // 'as is' without express or implied warranty.
19 | //
20 | // Please send BUG REPORTS to ccwu@cs.unc.edu
21 | //
22 | ////////////////////////////////////////////////////////////////////////////
23 |
24 |
25 |
26 | #ifndef _SIFT_SHADER_MAN_H
27 | #define _SIFT_SHADER_MAN_H
28 |
29 |
30 | #include "ProgramGPU.h"
31 | #include "ProgramGLSL.h"
32 | ///////////////////////////////////////////////////////////////////
33 | //class ShaderMan
34 | //description: pure static class
35 | // wrapper of shaders from different GPU languages
36 | ///////////////////////////////////////////////////////////////////
37 | class SiftParam;
38 | class FilterGLSL;
39 |
40 | class ShaderMan
41 | {
42 | public:
43 | static ShaderBag* s_bag;
44 | public:
45 | static void SelectInitialSmoothingFilter(int octave_min, SiftParam¶m);
46 | static void UseShaderMarginCopy(int xmax, int ymax);
47 | static void UseShaderOrientation(int gtex, int width, int height, float sigma, int auxtex, float step, int keypoint_list);
48 | static void UseShaderDescriptor(int gtex, int otex, int dwidth, int fwidth, int width, int height, float sigma);
49 | static void UseShaderSimpleOrientation(int oTex, float sigma, float sigma_step);
50 | static void UseShaderCopyKeypoint();
51 | static void UseShaderGenVBO( float width, float fwidth, float size);
52 | static void UseShaderDebug();
53 | static void UseShaderZeroPass();
54 | static void UseShaderGenListStart(float fw, int tex0);
55 | static void UseShaderGenListStep(int tex, int tex0);
56 | static void UseShaderGenListEnd(int ktex);
57 | static void UseShaderGenListHisto();
58 | static void UseShaderGenListInit(int w, int h, int tight = 1);
59 | static void UseShaderKeypoint(int texU, int texD);
60 | static void UseShaderGradientPass(int texP = 0);
61 | static void UseShaderDisplayKeypoints();
62 | static void UseShaderDisplayGrad();
63 | static void UseShaderRGB2Gray();
64 | static void UseShaderDisplayDOG();
65 | static void UseShaderDisplayGaussian();
66 | ///////////////////////////////////////////
67 | static void FilterInitialImage(GLTexImage* tex, GLTexImage* buf);
68 | static void FilterSampledImage(GLTexImage* tex, GLTexImage* buf);
69 | static void FilterImage(FilterProgram* filter, GLTexImage *dst, GLTexImage *src, GLTexImage*tmp);
70 | static void TextureCopy(GLTexImage*dst, GLTexImage*src);
71 | static void TextureDownSample(GLTexImage* dst, GLTexImage*src, int scale = 2);
72 | static void TextureUpSample(GLTexImage* dst, GLTexImage*src, int scale);
73 | ///////////////////////////////////////////////
74 | static void InitShaderMan(SiftParam¶m);
75 | static void DestroyShaders();
76 | static int HaveShaderMan(){return s_bag != NULL;}
77 | static void UnloadProgram();
78 | };
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/cub/block/specializations/block_histogram_atomic.cuh:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright (c) 2011, Duane Merrill. All rights reserved.
3 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | * * Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * * Neither the name of the NVIDIA CORPORATION nor the
13 | * names of its contributors may be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | *
27 | ******************************************************************************/
28 |
29 | /**
30 | * \file
31 | * The cub::BlockHistogramAtomic class provides atomic-based methods for constructing block-wide histograms from data samples partitioned across a CUDA thread block.
32 | */
33 |
34 | #pragma once
35 |
36 | #include "../../util_namespace.cuh"
37 |
38 | /// Optional outer namespace(s)
39 | CUB_NS_PREFIX
40 |
41 | /// CUB namespace
42 | namespace cub {
43 |
44 |
45 | /**
46 | * \brief The BlockHistogramAtomic class provides atomic-based methods for constructing block-wide histograms from data samples partitioned across a CUDA thread block.
47 | */
48 | template
49 | struct BlockHistogramAtomic
50 | {
51 | /// Shared memory storage layout type
52 | struct TempStorage {};
53 |
54 |
55 | /// Constructor
56 | __device__ __forceinline__ BlockHistogramAtomic(
57 | TempStorage &temp_storage)
58 | {}
59 |
60 |
61 | /// Composite data onto an existing histogram
62 | template <
63 | typename T,
64 | typename CounterT,
65 | int ITEMS_PER_THREAD>
66 | __device__ __forceinline__ void Composite(
67 | T (&items)[ITEMS_PER_THREAD], ///< [in] Calling thread's input values to histogram
68 | CounterT histogram[BINS]) ///< [out] Reference to shared/device-accessible memory histogram
69 | {
70 | // Update histogram
71 | #pragma unroll
72 | for (int i = 0; i < ITEMS_PER_THREAD; ++i)
73 | {
74 | atomicAdd(histogram + items[i], 1);
75 | }
76 | }
77 |
78 | };
79 |
80 | } // CUB namespace
81 | CUB_NS_POSTFIX // Optional outer namespace(s)
82 |
83 |
--------------------------------------------------------------------------------
/siftgpu/include/ProgramCU.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: ProgramCU.h
3 | // Author: Changchang Wu
4 | // Description : interface for the ProgramCU classes.
5 | // It is basically a wrapper around all the CUDA kernels
6 | //
7 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
8 | // All Rights Reserved
9 | //
10 | // Permission to use, copy, modify and distribute this software and its
11 | // documentation for educational, research and non-profit purposes, without
12 | // fee, and without a written agreement is hereby granted, provided that the
13 | // above copyright notice and the following paragraph appear in all copies.
14 | //
15 | // The University of North Carolina at Chapel Hill make no representations
16 | // about the suitability of this software for any purpose. It is provided
17 | // 'as is' without express or implied warranty.
18 | //
19 | // Please send BUG REPORTS to ccwu@cs.unc.edu
20 | //
21 | ////////////////////////////////////////////////////////////////////////////
22 |
23 | #ifndef _PROGRAM_CU_H
24 | #define _PROGRAM_CU_H
25 | #if defined(CUDA_SIFTGPU_ENABLED)
26 |
27 | class CuTexImage;
28 |
29 | class ProgramCU
30 | {
31 | public:
32 | //GPU FUNCTIONS
33 | static void FinishCUDA();
34 | static int CheckErrorCUDA(const char* location);
35 | static int CheckCudaDevice(int device);
36 | public:
37 | ////SIFTGPU FUNCTIONS
38 | static void CreateFilterKernel(float sigma, float* kernel, int& width);
39 | template static void FilterImage(CuTexImage *dst, CuTexImage *src, CuTexImage* buf);
40 | static void FilterImage(CuTexImage *dst, CuTexImage *src, CuTexImage* buf, float sigma);
41 | static void ComputeDOG(CuTexImage* gus, CuTexImage* dog, CuTexImage* got);
42 | static void ComputeKEY(CuTexImage* dog, CuTexImage* key, float Tdog, float Tedge);
43 | static void InitHistogram(CuTexImage* key, CuTexImage* hist);
44 | static void ReduceHistogram(CuTexImage*hist1, CuTexImage* hist2);
45 | static void GenerateList(CuTexImage* list, CuTexImage* hist);
46 | static void ComputeOrientation(CuTexImage*list, CuTexImage* got, CuTexImage*key,
47 | float sigma, float sigma_step, int existing_keypoint);
48 | static void ComputeDescriptor(CuTexImage*list, CuTexImage* got, CuTexImage* dtex, int rect = 0, int stream = 0);
49 |
50 | //data conversion
51 | static void SampleImageU(CuTexImage *dst, CuTexImage *src, int log_scale);
52 | static void SampleImageD(CuTexImage *dst, CuTexImage *src, int log_scale = 1);
53 | static void ReduceToSingleChannel(CuTexImage* dst, CuTexImage* src, int convert_rgb);
54 | static void ConvertByteToFloat(CuTexImage*src, CuTexImage* dst);
55 |
56 | //visualization
57 | static void DisplayConvertDOG(CuTexImage* dog, CuTexImage* out);
58 | static void DisplayConvertGRD(CuTexImage* got, CuTexImage* out);
59 | static void DisplayConvertKEY(CuTexImage* key, CuTexImage* dog, CuTexImage* out);
60 | static void DisplayKeyPoint(CuTexImage* ftex, CuTexImage* out);
61 | static void DisplayKeyBox(CuTexImage* ftex, CuTexImage* out);
62 |
63 | //SIFTMATCH FUNCTIONS
64 | static void MultiplyDescriptor(CuTexImage* tex1, CuTexImage* tex2, CuTexImage* texDot, CuTexImage* texCRT);
65 | static void MultiplyDescriptorG(CuTexImage* texDes1, CuTexImage* texDes2,
66 | CuTexImage* texLoc1, CuTexImage* texLoc2, CuTexImage* texDot, CuTexImage* texCRT,
67 | float H[3][3], float hdistmax, float F[3][3], float fdistmax);
68 | static void GetRowMatch(CuTexImage* texDot, CuTexImage* texMatch, float distmax, float ratiomax);
69 | static void GetColMatch(CuTexImage* texCRT, CuTexImage* texMatch, float distmax, float ratiomax);
70 | };
71 |
72 | #endif
73 | #endif
74 |
75 |
--------------------------------------------------------------------------------
/utilities/src/utilities.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 | #include
35 | #include
36 |
37 | namespace util {
38 |
39 | void initializeCUDARuntime(int device) {
40 | cudaSetDevice(device);
41 | cudaDeviceSetCacheConfig(cudaFuncCachePreferL1);
42 |
43 | // dummy memcpy to init cuda runtime
44 | util::Device1D d_dummy(1);
45 | std::vector h_dummy(1);
46 | d_dummy.copyFrom(h_dummy);
47 |
48 | if (cudaGetLastError() != cudaSuccess)
49 | throw std::runtime_error(
50 | std::string("initializeCUDARuntime: CUDA initialization problem\n"));
51 | }
52 |
53 | TimerGPU::TimerGPU(cudaStream_t stream) : stream_(stream) {
54 | cudaEventCreate(&start_);
55 | cudaEventCreate(&stop_);
56 | cudaEventRecord(start_, stream);
57 | }
58 |
59 | TimerGPU::~TimerGPU() {
60 | cudaEventDestroy(start_);
61 | cudaEventDestroy(stop_);
62 | }
63 |
64 | float TimerGPU::read() {
65 | cudaEventRecord(stop_, stream_);
66 | cudaEventSynchronize(stop_);
67 | float time;
68 | cudaEventElapsedTime(&time, start_, stop_);
69 | return time;
70 | }
71 |
72 | void TimerGPU::reset() { cudaEventRecord(start_, stream_); }
73 | }
74 |
--------------------------------------------------------------------------------
/rendering/include/ogre_multi_render_target.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 | #include
35 | #include
36 |
37 | namespace render {
38 |
39 | class OgreMultiRenderTarget {
40 |
41 | public:
42 | OgreMultiRenderTarget(std::string name, int width, int height,
43 | Ogre::SceneManager *scene_manager);
44 | ~OgreMultiRenderTarget();
45 |
46 | void updateCamera(const Ogre::Vector3 &camera_position,
47 | const Ogre::Quaternion &camera_orientation,
48 | const Ogre::Matrix4 &projection_matrix);
49 |
50 | void render();
51 |
52 | enum class ArrayType {
53 | normal_x,
54 | normal_y,
55 | normal_z,
56 | z_buffer,
57 | segment_ind,
58 | texture
59 | };
60 |
61 | void mapCudaArrays(std::vector cuda_arrays);
62 | void unmapCudaArrays();
63 |
64 | const std::string name_;
65 |
66 | private:
67 | const int width_;
68 | const int height_;
69 | const int n_rtt_textures_;
70 |
71 | Ogre::SceneManager *scene_manager_;
72 | Ogre::Camera *camera_;
73 | Ogre::MultiRenderTarget *multi_render_target_;
74 | std::vector cuda_resources_;
75 | };
76 | }
77 |
--------------------------------------------------------------------------------
/rendering/include/rigid_object.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 |
37 | namespace render {
38 |
39 | class RigidObject {
40 |
41 | public:
42 | RigidObject(std::string file_name, Ogre::SceneManager *scene_manager,
43 | int segment_ind);
44 |
45 | ~RigidObject();
46 |
47 | void setPose(const Ogre::Vector3 &position,
48 | const Ogre::Quaternion &orientation);
49 |
50 | void setVisible(bool visible);
51 |
52 | void setSegmentIndex(int segment_ind);
53 |
54 | // Returns vertex positions (with redundancy) as read from file
55 | const std::vector &getPositions() const { return (positions_); }
56 | int getNPositions() const { return (n_positions_); }
57 |
58 | /**
59 | * @brief getBoundingBox
60 | * @return An (8x3) tight oriented bounding box around the vertices
61 | */
62 | const std::vector &getBoundingBox() const { return (_bounding_box); }
63 |
64 | int segment_ind_;
65 |
66 | private:
67 | void extractMeshPositions(const Ogre::Mesh *const mesh);
68 | void computeBoundingBox();
69 |
70 | Ogre::SceneManager *scene_manager_;
71 | Ogre::SceneNode *visual_node_;
72 | Ogre::Entity *entity_;
73 | std::string texture_name_, file_name_;
74 |
75 | std::vector positions_;
76 | int n_positions_; // as read by Ogre
77 | std::vector _bounding_box; // (8x3)
78 | };
79 | }
80 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/cub/cub.cuh:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright (c) 2011, Duane Merrill. All rights reserved.
3 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | * * Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * * Neither the name of the NVIDIA CORPORATION nor the
13 | * names of its contributors may be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | *
27 | ******************************************************************************/
28 |
29 | /**
30 | * \file
31 | * CUB umbrella include file
32 | */
33 |
34 | #pragma once
35 |
36 |
37 | // Block
38 | #include "block/block_histogram.cuh"
39 | #include "block/block_discontinuity.cuh"
40 | #include "block/block_exchange.cuh"
41 | #include "block/block_load.cuh"
42 | #include "block/block_radix_rank.cuh"
43 | #include "block/block_radix_sort.cuh"
44 | #include "block/block_reduce.cuh"
45 | #include "block/block_scan.cuh"
46 | #include "block/block_store.cuh"
47 | //#include "block/block_shift.cuh"
48 |
49 | // Device
50 | #include "device/device_histogram.cuh"
51 | #include "device/device_partition.cuh"
52 | #include "device/device_radix_sort.cuh"
53 | #include "device/device_reduce.cuh"
54 | #include "device/device_run_length_encode.cuh"
55 | #include "device/device_scan.cuh"
56 | #include "device/device_segmented_radix_sort.cuh"
57 | #include "device/device_segmented_reduce.cuh"
58 | #include "device/device_select.cuh"
59 | #include "device/device_spmv.cuh"
60 |
61 | // Grid
62 | //#include "grid/grid_barrier.cuh"
63 | #include "grid/grid_even_share.cuh"
64 | #include "grid/grid_mapping.cuh"
65 | #include "grid/grid_queue.cuh"
66 |
67 | // Thread
68 | #include "thread/thread_load.cuh"
69 | #include "thread/thread_operators.cuh"
70 | #include "thread/thread_reduce.cuh"
71 | #include "thread/thread_scan.cuh"
72 | #include "thread/thread_store.cuh"
73 |
74 | // Warp
75 | #include "warp/warp_reduce.cuh"
76 | #include "warp/warp_scan.cuh"
77 |
78 | // Iterator
79 | #include "iterator/arg_index_input_iterator.cuh"
80 | #include "iterator/cache_modified_input_iterator.cuh"
81 | #include "iterator/cache_modified_output_iterator.cuh"
82 | #include "iterator/constant_input_iterator.cuh"
83 | #include "iterator/counting_input_iterator.cuh"
84 | #include "iterator/tex_obj_input_iterator.cuh"
85 | #include "iterator/tex_ref_input_iterator.cuh"
86 | #include "iterator/transform_input_iterator.cuh"
87 |
88 | // Util
89 | #include "util_arch.cuh"
90 | #include "util_debug.cuh"
91 | #include "util_device.cuh"
92 | #include "util_macro.cuh"
93 | #include "util_ptx.cuh"
94 | #include "util_type.cuh"
95 |
96 |
--------------------------------------------------------------------------------
/rendering/include/robot.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 | namespace render {
42 |
43 | class Robot {
44 |
45 | public:
46 | typedef std::unordered_map M_NameToAngle;
47 |
48 | Robot(const urdf::Model &urdf, Ogre::SceneManager *scene_manager,
49 | int root_segment_ind = 1);
50 |
51 | void setJointState(const M_NameToAngle &joint_state);
52 |
53 | void getFrame(std::string frame, Ogre::Vector3 &position,
54 | Ogre::Quaternion &orientation) const;
55 |
56 | // label the robot parts incrementally starting at root_segment_ind
57 | void setIncrementalSegmentLabels(int root_segment_ind = 1);
58 |
59 | void setFixedSegmentLabels(int segment_index = 0);
60 |
61 | // enable or disable complete robot rendering
62 | void setVisible(bool visible);
63 |
64 | // selectively enable parts of the robot for rendering
65 | // all other parts will be ignored
66 | void setVisible(bool visible, std::vector link_names);
67 |
68 |
69 | private:
70 | void
71 | propagateTree(const KDL::SegmentMap::const_iterator segment,
72 | const KDL::Frame frame,
73 | const std::unordered_map &joint_state);
74 |
75 | KDL::Tree kdl_tree_;
76 | std::vector robot_links_;
77 | std::unordered_map link_frames_;
78 | };
79 | }
80 |
--------------------------------------------------------------------------------
/low_level_vision/include/d_gabor.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 | #include
37 |
38 | namespace vision {
39 |
40 | /*! \brief Device Gabor Class
41 |
42 | Performs Gabor filtering on GPU
43 | */
44 | class D_Gabor {
45 |
46 | public:
47 | /*! \brief Construct D_Gabor object and filter image at eight orientations
48 |
49 | \param image The device image object
50 | \param d_TEMP Temporary space used for filtering. Should be of size [
51 | width*sizeof(float2) ] x [ height*5 ] in case of eight orientations and of
52 | size [ width*sizeof(float2) ] x [ height*3 ] in case of four orientations
53 | \param fourOrientations If true, filtering will be performed at four
54 | orientation only
55 | */
56 | D_Gabor(const util::Device2D &image,
57 | std::shared_ptr > buffer,
58 | bool four_orientations = false);
59 |
60 | typedef std::unique_ptr Ptr;
61 |
62 | /*! \brief Gabor filter image. Allows re-use of D_Gabor object */
63 | void resetImage(const util::Device2D &image);
64 |
65 | /*! \brief Get access to device Gabor data */
66 | const util::Device2D &getGaborInterleaved() const {
67 | return *gabor_interleaved_.get();
68 | }
69 |
70 | private:
71 | const bool four_orientations_;
72 | const int width_;
73 | const int height_;
74 | const util::Device2D::Ptr gabor_interleaved_;
75 | const std::shared_ptr > buffer_;
76 | };
77 |
78 | } // end namespace vision
79 |
--------------------------------------------------------------------------------
/low_level_vision/src/d_gabor.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 | #include
35 |
36 | namespace vision {
37 |
38 | D_Gabor::D_Gabor(const util::Device2D &image,
39 | std::shared_ptr > buffer,
40 | bool four_orientations)
41 | : buffer_{ buffer }, four_orientations_{ four_orientations },
42 | width_{ image.width_ }, height_{ image.height_ },
43 | gabor_interleaved_{ util::Device2D::make_unique(
44 | width_, height_ * (four_orientations_ ? 4 : 8)) } {
45 | // check buffer size
46 | if (four_orientations_) {
47 | if ((buffer_->width_ < width_ * sizeof(float2)) ||
48 | (buffer_->height_ < 3 * height_))
49 | throw std::runtime_error("D_Gabor::D_Gabor; buffer size insufficient.\n");
50 | } else {
51 | if ((buffer_->width_ < width_ * sizeof(float2)) ||
52 | (buffer_->height_ < 5 * height_))
53 | throw std::runtime_error("D_Gabor::D_Gabor; buffer size insufficient.\n");
54 | }
55 |
56 | resetImage(image);
57 | }
58 |
59 | void D_Gabor::resetImage(const util::Device2D &image) {
60 | if ((width_ != image.width_) || (height_ != image.height_))
61 | throw std::runtime_error(
62 | "D_Gabor::resetImage; image size cannot change on reset.\n");
63 |
64 | gaborFilterItl(image.data(), image.pitch(), gabor_interleaved_->data(),
65 | gabor_interleaved_->pitch(), buffer_->data(), buffer_->pitch(),
66 | width_, height_, four_orientations_);
67 | }
68 |
69 | } // end namespace vision
70 |
--------------------------------------------------------------------------------
/low_level_vision/include/d_image_pyramid.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 | #include
37 | #include
38 |
39 | namespace vision {
40 |
41 | /*! \brief Device Image Pyramid Class
42 |
43 | Constructs and stores all levels of an image pyramid
44 | */
45 | class D_ImagePyramid {
46 |
47 | public:
48 | /*! \brief Construct a new image pyramid
49 |
50 | The constructor allocates space for the lower resolution images and
51 | performs the smoothing and subsampling
52 |
53 | \param image Highest resolution image contained in the pyramid
54 | \param n_scales number of scales the pyramid contains
55 | */
56 | D_ImagePyramid(std::shared_ptr > image, int n_scales);
57 |
58 | /*! \brief Change the high resolution image and refilter the entire pyramid
59 |
60 | This assumes that the original image resolution has remained unchanged.
61 | This function enables the re-use of a D_ImagePyramid object
62 |
63 | */
64 | void resetRootImage(std::shared_ptr > image);
65 |
66 | /*! \brief Return image at requested scale */
67 | const util::Device2D &getImageAtScale(int scale) const;
68 |
69 | const int n_scales_;
70 |
71 | private:
72 | void downSampleImages();
73 |
74 | // ownership of the high-res image is shared with the caller
75 | std::shared_ptr > root_image_;
76 |
77 | // unique pointers to downsampled images
78 | std::vector::Ptr> downsampled_images_;
79 | };
80 |
81 | } // end namespace vision
82 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/cub/util_macro.cuh:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright (c) 2011, Duane Merrill. All rights reserved.
3 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions are met:
7 | * * Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * * Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * * Neither the name of the NVIDIA CORPORATION nor the
13 | * names of its contributors may be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | *
27 | ******************************************************************************/
28 |
29 | /******************************************************************************
30 | * Common C/C++ macro utilities
31 | ******************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include "util_namespace.cuh"
36 |
37 | /// Optional outer namespace(s)
38 | CUB_NS_PREFIX
39 |
40 | /// CUB namespace
41 | namespace cub {
42 |
43 |
44 | /**
45 | * \addtogroup UtilModule
46 | * @{
47 | */
48 |
49 | #ifndef CUB_ALIGN
50 | #if defined(_WIN32) || defined(_WIN64)
51 | /// Align struct
52 | #define CUB_ALIGN(bytes) __declspec(align(32))
53 | #else
54 | /// Align struct
55 | #define CUB_ALIGN(bytes) __attribute__((aligned(bytes)))
56 | #endif
57 | #endif
58 |
59 | #ifndef CUB_MAX
60 | /// Select maximum(a, b)
61 | #define CUB_MAX(a, b) (((b) > (a)) ? (b) : (a))
62 | #endif
63 |
64 | #ifndef CUB_MIN
65 | /// Select minimum(a, b)
66 | #define CUB_MIN(a, b) (((b) < (a)) ? (b) : (a))
67 | #endif
68 |
69 | #ifndef CUB_QUOTIENT_FLOOR
70 | /// Quotient of x/y rounded down to nearest integer
71 | #define CUB_QUOTIENT_FLOOR(x, y) ((x) / (y))
72 | #endif
73 |
74 | #ifndef CUB_QUOTIENT_CEILING
75 | /// Quotient of x/y rounded up to nearest integer
76 | #define CUB_QUOTIENT_CEILING(x, y) (((x) + (y) - 1) / (y))
77 | #endif
78 |
79 | #ifndef CUB_ROUND_UP_NEAREST
80 | /// x rounded up to the nearest multiple of y
81 | #define CUB_ROUND_UP_NEAREST(x, y) ((((x) + (y) - 1) / (y)) * y)
82 | #endif
83 |
84 | #ifndef CUB_ROUND_DOWN_NEAREST
85 | /// x rounded down to the nearest multiple of y
86 | #define CUB_ROUND_DOWN_NEAREST(x, y) (((x) / (y)) * y)
87 | #endif
88 |
89 |
90 | #ifndef CUB_STATIC_ASSERT
91 | #ifndef DOXYGEN_SHOULD_SKIP_THIS // Do not document
92 | #define CUB_CAT_(a, b) a ## b
93 | #define CUB_CAT(a, b) CUB_CAT_(a, b)
94 | #endif // DOXYGEN_SHOULD_SKIP_THIS
95 |
96 | /// Static assert
97 | #define CUB_STATIC_ASSERT(cond, msg) typedef int CUB_CAT(cub_static_assert, __LINE__)[(cond) ? 1 : -1]
98 | #endif
99 |
100 | /** @} */ // end group UtilModule
101 |
102 | } // CUB namespace
103 | CUB_NS_POSTFIX // Optional outer namespace(s)
104 |
--------------------------------------------------------------------------------
/interface/include/multi_rigid_detector.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 | #include
37 | #include
38 |
39 | namespace interface {
40 |
41 | class MultiRigidDetector {
42 | public:
43 | struct Parameters {
44 | Parameters() : vec_size_(4), num_iter_ransac_(1000) {}
45 |
46 | int vec_size_;
47 | int num_iter_ransac_;
48 | };
49 |
50 | MultiRigidDetector(int image_width, int image_height, cv::Mat camera_matrix,
51 | std::vector obj_filenames, int device_id,
52 | Parameters parameters = Parameters());
53 |
54 | // remove the rest (rule of five)
55 | MultiRigidDetector(const MultiRigidDetector &) = delete;
56 | MultiRigidDetector(MultiRigidDetector &&) = delete;
57 | MultiRigidDetector &operator=(MultiRigidDetector) = delete;
58 | MultiRigidDetector &operator=(MultiRigidDetector &&) = delete;
59 |
60 | void estimatePose(const cv::Mat &image, int object_index,
61 | geometry_msgs::Pose &pose);
62 |
63 | void estimatePose(const cv::Mat &image, int object_index,
64 | pose::TranslationRotation3D &pose);
65 |
66 | void setCameraMatrix(const cv::Mat &camera_matrix);
67 |
68 | // removes all objects from detector (if any) and loads new objects
69 | void setObjects(std::vector obj_filenames);
70 |
71 | int getNumberOfObjects();
72 |
73 | typedef std::unique_ptr Ptr;
74 |
75 | const int image_width_;
76 | const int image_height_;
77 |
78 | private:
79 | Parameters parameters_;
80 |
81 | std::unique_ptr
82 | d_multiple_rigid_pose_sparse_;
83 | };
84 | }
85 |
--------------------------------------------------------------------------------
/siftgpu/include/PyramidGL.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // File: PyramidGL.h
3 | // Author: Changchang Wu
4 | // Description : interface for the PyramdGL
5 | // class PyramidNaive and PyramidPacked are derived from PyramidGL
6 | //
7 | // Copyright (c) 2007 University of North Carolina at Chapel Hill
8 | // All Rights Reserved
9 | //
10 | // Permission to use, copy, modify and distribute this software and its
11 | // documentation for educational, research and non-profit purposes, without
12 | // fee, and without a written agreement is hereby granted, provided that the
13 | // above copyright notice and the following paragraph appear in all copies.
14 | //
15 | // The University of North Carolina at Chapel Hill make no representations
16 | // about the suitability of this software for any purpose. It is provided
17 | // 'as is' without express or implied warranty.
18 | //
19 | // Please send BUG REPORTS to ccwu@cs.unc.edu
20 | //
21 | ////////////////////////////////////////////////////////////////////////////
22 |
23 |
24 |
25 | #ifndef _PYRAMID_GL_H
26 | #define _PYRAMID_GL_H
27 |
28 | class GLTexImage;
29 | class SiftParam;
30 | class ProgramGPU;
31 | class ShaderMan;
32 | class GlobalUtil;
33 | class SiftPyramid;
34 |
35 | class PyramidGL:public SiftPyramid
36 | {
37 | protected:
38 | GLTexImage* _histoPyramidTex;
39 | GLTexImage* _featureTex;
40 | GLTexImage* _descriptorTex;
41 | GLTexImage* _orientationTex;
42 | public:
43 | void InitializeContext();
44 | void SetLevelFeatureNum(int idx, int num);
45 | void GetTextureStorageSize(int num, int &fw, int& fh);
46 | void GetAlignedStorageSize(int num, int align, int &fw, int &fh);
47 | static void InterlaceDescriptorF2(int w, int h, float* buf, float* pd, int step);
48 | static void NormalizeDescriptor(int num, float*pd);
49 | virtual void DownloadKeypoints();
50 | virtual int ResizeFeatureStorage();
51 | ////////////////////////////
52 | virtual void DestroyPerLevelData();
53 | virtual void DestroySharedData();
54 | virtual void GetFeatureDescriptors();
55 | virtual void GenerateFeatureListTex();
56 | virtual void ReshapeFeatureListCPU();
57 | virtual void GenerateFeatureDisplayVBO();
58 | virtual void CleanUpAfterSIFT();
59 | virtual GLTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN)=0;
60 | public:
61 | PyramidGL(SiftParam&sp);
62 | virtual ~PyramidGL();
63 | };
64 |
65 | class PyramidNaive:public PyramidGL, public ShaderMan
66 | {
67 | protected:
68 | GLTexImage * _texPyramid;
69 | GLTexImage * _auxPyramid;
70 | public:
71 | void DestroyPyramidData();
72 | void GetSimplifiedOrientation();
73 | void GenerateFeatureListCPU();
74 | virtual void GetFeatureOrientations();
75 | virtual void GenerateFeatureList();
76 | void DetectKeypointsEX();
77 | void ComputeGradient();
78 | GLTexImage* GetLevelTexture(int octave, int level);
79 | GLTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN);
80 | GLTexImage* GetLevelTexture(int octave, int level, int dataName);
81 | void BuildPyramid(GLTexInput * input);
82 | void InitPyramid(int w, int h, int ds);
83 | void FitPyramid(int w, int h);
84 | void ResizePyramid(int w, int h);
85 | void FitHistogramPyramid();
86 | PyramidNaive(SiftParam & sp);
87 | ~PyramidNaive();
88 | private:
89 | void GenerateFeatureList(int i, int j);
90 | };
91 |
92 |
93 | class PyramidPacked:public PyramidGL, public ShaderMan
94 | {
95 | GLTexPacked * _allPyramid;
96 | public:
97 | PyramidPacked(SiftParam& sp);
98 | ~PyramidPacked();
99 | void DestroyPyramidData();
100 | void DetectKeypointsEX();
101 | void ComputeGradient();
102 | void BuildPyramid(GLTexInput * input);
103 | void InitPyramid(int w, int h, int ds);
104 | void FitPyramid(int w, int h);
105 | void ResizePyramid(int w, int h);
106 | void FitHistogramPyramid();
107 | void GenerateFeatureListCPU();
108 | void GenerateFeatureList();
109 | void GetSimplifiedOrientation();
110 | void GetFeatureOrientations();
111 | GLTexImage* GetBaseLevel(int octave, int dataName = DATA_GAUSSIAN);
112 | GLTexImage* GetLevelTexture(int octave, int level);
113 | GLTexImage* GetLevelTexture(int octave, int level, int dataName);
114 | virtual int IsUsingRectDescription(){return _existing_keypoints & SIFT_RECT_DESCRIPTION; }
115 | private:
116 | void GenerateFeatureList(int i, int j);
117 | };
118 |
119 | #endif
120 |
--------------------------------------------------------------------------------
/low_level_vision/src/test/utest.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 |
42 | TEST(TestLowLevel, initializeCUDA) {
43 | cudaError_t err = cudaSetDevice(0);
44 | ASSERT_EQ(cudaSuccess, err) << cudaGetErrorString(err);
45 | }
46 |
47 | TEST(TestD_ImagePyramid, sharedPointerStorage) {
48 | int width = 640;
49 | int height = 480;
50 |
51 | auto image = std::make_shared >(width, height);
52 |
53 | int n_scales = 6;
54 | vision::D_ImagePyramid pyramid(image, n_scales);
55 |
56 | image.reset();
57 | auto new_image = std::make_shared >(width, height);
58 | // std::cout << "before reset\n";
59 | pyramid.resetRootImage(new_image);
60 | // std::cout << "after reset\n";
61 |
62 | auto &ret_image = pyramid.getImageAtScale(2);
63 | }
64 |
65 | TEST(TestD_GaborPyramid, sharedPointerStorage) {
66 | int width = 640;
67 | int height = 480;
68 |
69 | auto image = std::make_shared >(width, height);
70 |
71 | int n_scales = 6;
72 | vision::D_ImagePyramid pyramid(image, n_scales);
73 |
74 | bool four_orientations = false;
75 | auto buffer =
76 | vision::D_GaborPyramid::makeTempBuffer(width, height, four_orientations);
77 |
78 | vision::D_GaborPyramid gab_pyr(pyramid, buffer, four_orientations);
79 |
80 | gab_pyr.resetImagePyramid(pyramid);
81 | }
82 |
83 | TEST(TestOpticalFlow, sharedPointerStorage) {
84 | int width = 640;
85 | int height = 480;
86 |
87 | util::Device2D rgb(width, height);
88 |
89 | vision::D_OpticalAndARFlow opt_flow(rgb);
90 | }
91 |
92 | // Run all the tests that were declared with TEST()
93 | int main(int argc, char **argv) {
94 | testing::InitGoogleTest(&argc, argv);
95 | return RUN_ALL_TESTS();
96 | }
97 |
--------------------------------------------------------------------------------
/pose_estimation/include/d_point_cloud.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 | #include
37 | #include
38 |
39 | namespace pose {
40 |
41 | class D_PointCloud {
42 |
43 | public:
44 | typedef std::unique_ptr Ptr;
45 |
46 | /**
47 | * @brief D_PointCloud
48 | * @param h_point_cloud: interleaved point cloud data with fields
49 | * x,y,z,rgb(ignored)
50 | * @param frame_id: name of point cloud coordinate frame
51 | */
52 | D_PointCloud(const std::vector &h_point_cloud, std::string frame_id);
53 |
54 | void updateDepthImage(int n_cols, int n_rows, float nodal_point_x,
55 | float nodal_point_y, float focal_length_x,
56 | float focal_length_y,
57 | pose::TranslationRotation3D transform);
58 |
59 | std::vector getDepthImage() const;
60 |
61 | int getNRows() const { return n_rows_; }
62 | int getNCols() const { return n_cols_; }
63 |
64 | const util::Device1D &getDeviceDepthImage() const {
65 | return *d_depth_image_float_.get();
66 | }
67 |
68 | /**
69 | * @brief getDepthImage
70 | * param h_data: allocated and assumed of size n_rows_*n_cols_
71 | */
72 | void getDepthImage(float *h_data) const;
73 |
74 | const std::string frame_id_;
75 |
76 | private:
77 | const util::Device1D::Ptr d_point_cloud_;
78 |
79 | // depth images, these buffers are dynamically resized if required
80 | int n_cols_;
81 | int n_rows_;
82 | // in millimeter (required for efficient atomic operations)
83 | util::Device1D::Ptr d_depth_image_;
84 | // in meter
85 | util::Device1D::Ptr d_depth_image_float_;
86 |
87 | // point cloud to camera transform
88 | const util::Device1D::Ptr d_translation_vector_;
89 | const util::Device1D::Ptr d_rotation_matrix_;
90 | };
91 |
92 | } // end namespace vision
93 |
--------------------------------------------------------------------------------
/pose_estimation/include/d_multiple_rigid_pose_sparse.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #pragma once
34 |
35 | #include
36 | #include
37 | #include
38 | #include
39 |
40 | namespace pose {
41 |
42 | /* ! \brief Rigid Object Pose Estimation Using Sparse Features
43 | */
44 | class D_MultipleRigidPoseSparse {
45 |
46 | public:
47 | D_MultipleRigidPoseSparse(int n_cols, int n_rows, float nodal_point_x,
48 | float nodal_point_y, float focal_length_x,
49 | float focal_length_y, int device_id = 0,
50 | int vec_size = 4, int num_iter_ransac = 1000);
51 |
52 | void updateCalibration(int n_cols, int n_rows, float nodal_point_x,
53 | float nodal_point_y, float focal_length_x,
54 | float focal_length_y);
55 |
56 | void addModel(const char *obj_filename);
57 |
58 | // removes all models from pose estimator
59 | void removeAllModels();
60 |
61 | // specify for which object the pose should be estimated
62 | TranslationRotation3D estimatePoseSpecificObject(const cv::Mat &image,
63 | const int object);
64 |
65 | // randomly select the object (probabilities can be tuned)
66 | TranslationRotation3D estimatePoseRandomObject(const cv::Mat &image,
67 | int &object);
68 |
69 | int getNumberOfObjects() { return (_n_objects); }
70 |
71 | void enable() { _running = true; }
72 | void disable() { _running = false; }
73 |
74 | private:
75 | TranslationRotation3D estimatePose(const cv::Mat &image, int object = 0);
76 |
77 | bool _running;
78 |
79 | cv::Mat _camera_mat;
80 | int _n_rows, _n_cols;
81 |
82 | const std::unique_ptr _siftEngine;
83 | const std::unique_ptr _matcherEngine;
84 | const int _DESCRIPTOR_LENGTH;
85 | const int _num_iter_ransac;
86 |
87 | struct ModelAssets {
88 | int model_size;
89 | std::vector descriptors;
90 | std::vector positions;
91 | };
92 | std::vector _allModels;
93 |
94 | int _n_objects;
95 |
96 | std::vector _match_buffer;
97 | const int _max_matches;
98 | };
99 | }
100 |
--------------------------------------------------------------------------------
/third_party/nvidia_cub/experimental/histogram/histogram_cub.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | * * Redistributions of source code must retain the above copyright
7 | * notice, this list of conditions and the following disclaimer.
8 | * * Redistributions in binary form must reproduce the above copyright
9 | * notice, this list of conditions and the following disclaimer in the
10 | * documentation and/or other materials provided with the distribution.
11 | * * Neither the name of the NVIDIA CORPORATION nor the
12 | * names of its contributors may be used to endorse or promote products
13 | * derived from this software without specific prior written permission.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | * DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | *
26 | ******************************************************************************/
27 |
28 | #include
29 |
30 | using namespace cub;
31 |
32 | template <
33 | int NUM_CHANNELS,
34 | int ACTIVE_CHANNELS,
35 | int NUM_BINS,
36 | typename PixelType>
37 | double run_cub_histogram(
38 | PixelType *d_image,
39 | int width,
40 | int height,
41 | unsigned int *d_hist,
42 | bool is_warmup)
43 | {
44 | enum {
45 | is_float = Equals::VALUE,
46 | };
47 |
48 | typedef typename If::Type SampleT; // Sample type
49 | typedef typename If::Type LevelT; // Level type (uint32 for uchar)
50 |
51 | // Setup data structures
52 | unsigned int* d_histogram[ACTIVE_CHANNELS];
53 | int num_levels[ACTIVE_CHANNELS]; ///< [in] The number of boundaries (levels) for delineating histogram samples in each active channel. Implies that the number of bins for channeli is num_levels[i] - 1.
54 | LevelT lower_level[ACTIVE_CHANNELS]; ///< [in] The lower sample value bound (inclusive) for the lowest histogram bin in each active channel.
55 | LevelT upper_level[ACTIVE_CHANNELS]; ///< [in] The upper sample value bound (exclusive) for the highest histogram bin in each active channel.
56 |
57 | for (int CHANNEL = 0; CHANNEL < ACTIVE_CHANNELS; ++CHANNEL)
58 | {
59 | d_histogram[CHANNEL] = d_hist + (CHANNEL * NUM_BINS);
60 | num_levels[CHANNEL] = NUM_BINS + 1;
61 | lower_level[CHANNEL] = 0;
62 | upper_level[CHANNEL] = (is_float) ? 1 : 256;
63 | }
64 |
65 | // Allocate temporary storage
66 | size_t temp_storage_bytes = 0;
67 | void *d_temp_storage = NULL;
68 |
69 | SampleT* d_image_samples = (SampleT*) d_image;
70 |
71 | // Get amount of temporary storage needed
72 | DeviceHistogram::MultiHistogramEven(
73 | d_temp_storage,
74 | temp_storage_bytes,
75 | d_image_samples,
76 | d_histogram,
77 | num_levels,
78 | lower_level,
79 | upper_level,
80 | width * height,
81 | (cudaStream_t) 0,
82 | is_warmup);
83 |
84 | cudaMalloc(&d_temp_storage, temp_storage_bytes);
85 |
86 | GpuTimer gpu_timer;
87 | gpu_timer.Start();
88 |
89 | // Compute histogram
90 | DeviceHistogram::MultiHistogramEven(
91 | d_temp_storage,
92 | temp_storage_bytes,
93 | d_image_samples,
94 | d_histogram,
95 | num_levels,
96 | lower_level,
97 | upper_level,
98 | width * height,
99 | (cudaStream_t) 0,
100 | is_warmup);
101 |
102 | gpu_timer.Stop();
103 | float elapsed_millis = gpu_timer.ElapsedMillis();
104 |
105 | cudaFree(d_temp_storage);
106 |
107 | return elapsed_millis;
108 | }
109 |
110 |
--------------------------------------------------------------------------------
/low_level_vision/src/d_gabor_pyramid.cpp:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /* Copyright (c) 2015, Karl Pauwels */
3 | /* All rights reserved. */
4 | /* */
5 | /* Redistribution and use in source and binary forms, with or without */
6 | /* modification, are permitted provided that the following conditions */
7 | /* are met: */
8 | /* */
9 | /* 1. Redistributions of source code must retain the above copyright */
10 | /* notice, this list of conditions and the following disclaimer. */
11 | /* */
12 | /* 2. Redistributions in binary form must reproduce the above copyright */
13 | /* notice, this list of conditions and the following disclaimer in the */
14 | /* documentation and/or other materials provided with the distribution. */
15 | /* */
16 | /* 3. Neither the name of the copyright holder nor the names of its */
17 | /* contributors may be used to endorse or promote products derived from */
18 | /* this software without specific prior written permission. */
19 | /* */
20 | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
21 | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
22 | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
23 | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
24 | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
25 | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
26 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
27 | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
28 | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
29 | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
30 | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
31 | /*****************************************************************************/
32 |
33 | #include
34 | #include
35 | #include
36 | #include
37 |
38 | namespace vision {
39 |
40 | int D_GaborPyramid::computeMaxNumberOfScales(int image_width,
41 | int image_height) {
42 | int n_scales_width = floor(log2(image_width / (double)filter_size_)) + 1;
43 | int n_scales_height = floor(log2(image_height / (double)filter_size_)) + 1;
44 | return std::min(n_scales_width, n_scales_height);
45 | }
46 |
47 | void D_GaborPyramid::computeCompatibleImageSize(int &image_width,
48 | int &image_height,
49 | int n_scales) {
50 | double factor = pow(2.0, double(n_scales - 1));
51 | image_width = ceil(image_width / factor) * factor;
52 | image_height = ceil(image_height / factor) * factor;
53 | }
54 |
55 | std::shared_ptr >
56 | D_GaborPyramid::makeTempBuffer(int image_width, int image_height,
57 | bool four_orientations) {
58 | int buffer_width = image_width * sizeof(float2);
59 | int buffer_height = four_orientations ? image_height * 3 : image_height * 5;
60 | return (std::make_shared >(buffer_width, buffer_height));
61 | }
62 |
63 | D_GaborPyramid::D_GaborPyramid(const D_ImagePyramid &image_pyramid,
64 | std::shared_ptr > buffer,
65 | bool four_orientations)
66 | : buffer_{ buffer } {
67 | // allocate space for the responses and filter the images
68 | gabors_.resize(image_pyramid.n_scales_);
69 | for (int s = 0; s < image_pyramid.n_scales_; s++)
70 | gabors_.at(s) = D_Gabor::Ptr{ new D_Gabor(image_pyramid.getImageAtScale(s),
71 | buffer_, four_orientations) };
72 | }
73 |
74 | void D_GaborPyramid::resetImagePyramid(const D_ImagePyramid &image_pyramid) {
75 | if (image_pyramid.n_scales_ != gabors_.size())
76 | throw std::runtime_error(
77 | "D_GaborPyramid::resetImagePyramid; invalid number of scales.\n");
78 |
79 | for (int s = 0; s < image_pyramid.n_scales_; s++)
80 | gabors_.at(s)->resetImage(image_pyramid.getImageAtScale(s));
81 | }
82 |
83 | const D_Gabor &D_GaborPyramid::getGaborAtScale(int scale) const {
84 | if ((scale < 0) || (scale >= gabors_.size()))
85 | throw std::runtime_error(
86 | "D_GaborPyramid::getGaborAtScale; invalid scale\n");
87 |
88 | return *gabors_.at(scale).get();
89 | }
90 |
91 | } // end namespace vision
92 |
--------------------------------------------------------------------------------