Point Cloud Library (PCL)
1.12.1
Toggle main menu visibility
Loading...
Searching...
No Matches
kinfu_large_scale
include
pcl
gpu
kinfu_large_scale
raycaster.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2011, Willow Garage, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of Willow Garage, Inc. nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
*/
37
38
#pragma once
39
40
#include <
pcl/memory.h
>
41
#include <
pcl/pcl_macros.h
>
42
#include <
pcl/point_types.h
>
43
#include <pcl/gpu/containers/device_array.h>
44
#include <pcl/gpu/kinfu_large_scale/pixel_rgb.h>
45
//#include <boost/graph/buffer_concepts.hpp>
46
#include <Eigen/Geometry>
47
48
#include <pcl/gpu/kinfu_large_scale/tsdf_buffer.h>
49
50
namespace
pcl
51
{
52
namespace
gpu
53
{
54
namespace
kinfuLS
55
{
56
class
TsdfVolume
;
57
58
/** \brief Class that performs raycasting for TSDF volume
59
* \author Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com)
60
*/
61
struct
PCL_EXPORTS
RayCaster
62
{
63
public
:
64
using
Ptr
= shared_ptr<RayCaster>;
65
using
ConstPtr
= shared_ptr<const RayCaster>;
66
using
MapArr
=
pcl::gpu::DeviceArray2D<float>
;
67
using
View
=
pcl::gpu::DeviceArray2D<PixelRGB>
;
68
using
Depth
=
pcl::gpu::DeviceArray2D<unsigned short>
;
69
70
/** \brief Image with height */
71
const
int
cols
,
rows
;
72
73
/** \brief Constructor
74
* \param[in] rows image rows
75
* \param[in] cols image cols
76
* \param[in] fx focal x
77
* \param[in] fy focal y
78
* \param[in] cx principal point x
79
* \param[in] cy principal point y
80
*/
81
RayCaster
(
int
rows
= 480,
int
cols
= 640,
float
fx = 525.f,
float
fy = 525.f,
float
cx = -1,
float
cy = -1);
82
83
~RayCaster
();
84
85
/** \brief Sets camera intrinsics */
86
void
87
setIntrinsics
(
float
fx = 525.f,
float
fy = 525.f,
float
cx = -1,
float
cy = -1);
88
89
/** \brief Runs raycasting algorithm from given camera pose. It writes results to internal files.
90
* \param[in] volume tsdf volume container
91
* \param[in] camera_pose camera pose
92
* \param buffer
93
*/
94
void
95
run
(
const
TsdfVolume
& volume,
const
Eigen::Affine3f& camera_pose,
tsdf_buffer
* buffer);
96
97
/** \brief Generates scene view using data raycasted by run method. So call it before.
98
* \param[out] view output array for RGB image
99
*/
100
void
101
generateSceneView
(
View
& view)
const
;
102
103
/** \brief Generates scene view using data raycasted by run method. So call it before.
104
* \param[out] view output array for RGB image
105
* \param[in] light_source_pose pose of light source
106
*/
107
void
108
generateSceneView
(
View
& view,
const
Eigen::Vector3f& light_source_pose)
const
;
109
110
/** \brief Generates depth image using data raycasted by run method. So call it before.
111
* \param[out] depth output array for depth image
112
*/
113
void
114
generateDepthImage
(
Depth
& depth)
const
;
115
116
/** \brief Returns raycasterd vertex map. */
117
MapArr
118
getVertexMap
()
const
;
119
120
/** \brief Returns raycasterd normal map. */
121
MapArr
122
getNormalMap
()
const
;
123
124
private
:
125
/** \brief Camera intrinsics. */
126
float
fx_, fy_, cx_, cy_;
127
128
/* Vertext/normal map internal representation example for rows=2 and cols=4
129
* X X X X
130
* X X X X
131
* Y Y Y Y
132
* Y Y Y Y
133
* Z Z Z Z
134
* Z Z Z Z
135
*/
136
137
/** \brief vertex map of 3D points*/
138
MapArr
vertex_map_;
139
140
/** \brief normal map of 3D points*/
141
MapArr
normal_map_;
142
143
/** \brief camera pose from which raycasting was done */
144
Eigen::Affine3f camera_pose_;
145
146
/** \brief Last passed volume size */
147
Eigen::Vector3f volume_size_;
148
149
public
:
150
PCL_MAKE_ALIGNED_OPERATOR_NEW
151
152
};
153
154
/** \brief Converts from map representation to organized not-dence point cloud. */
155
template
<
typename
Po
int
Type>
156
void
convertMapToOranizedCloud
(
const
RayCaster::MapArr
& map,
pcl::gpu::DeviceArray2D<PointType>
& cloud);
157
}
158
}
159
}
pcl::gpu::DeviceArray2D
DeviceArray2D class
Definition
device_array.h:188
pcl::gpu::kinfuLS::TsdfVolume
TsdfVolume class.
Definition
tsdf_volume.h:63
point_types.h
Defines all the PCL implemented PointT point type structures.
PCL_MAKE_ALIGNED_OPERATOR_NEW
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition
memory.h:63
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::gpu::kinfuLS
Definition
color_volume.h:53
pcl::gpu::kinfuLS::convertMapToOranizedCloud
void convertMapToOranizedCloud(const RayCaster::MapArr &map, pcl::gpu::DeviceArray2D< PointType > &cloud)
Converts from map representation to organized not-dence point cloud.
pcl::gpu
Definition
device_array.h:45
pcl
Definition
convolution.h:46
pcl_macros.h
Defines all the PCL and non-PCL macros used.
pcl::gpu::kinfuLS::RayCaster::~RayCaster
~RayCaster()
pcl::gpu::kinfuLS::RayCaster::getNormalMap
MapArr getNormalMap() const
Returns raycasterd normal map.
pcl::gpu::kinfuLS::RayCaster::RayCaster
RayCaster(int rows=480, int cols=640, float fx=525.f, float fy=525.f, float cx=-1, float cy=-1)
Constructor.
pcl::gpu::kinfuLS::RayCaster::run
void run(const TsdfVolume &volume, const Eigen::Affine3f &camera_pose, tsdf_buffer *buffer)
Runs raycasting algorithm from given camera pose.
pcl::gpu::kinfuLS::RayCaster::setIntrinsics
void setIntrinsics(float fx=525.f, float fy=525.f, float cx=-1, float cy=-1)
Sets camera intrinsics.
pcl::gpu::kinfuLS::RayCaster::generateSceneView
void generateSceneView(View &view) const
Generates scene view using data raycasted by run method.
pcl::gpu::kinfuLS::RayCaster::ConstPtr
shared_ptr< const RayCaster > ConstPtr
Definition
raycaster.h:65
pcl::gpu::kinfuLS::RayCaster::MapArr
pcl::gpu::DeviceArray2D< float > MapArr
Definition
raycaster.h:66
pcl::gpu::kinfuLS::RayCaster::generateDepthImage
void generateDepthImage(Depth &depth) const
Generates depth image using data raycasted by run method.
pcl::gpu::kinfuLS::RayCaster::rows
const int rows
Definition
raycaster.h:71
pcl::gpu::kinfuLS::RayCaster::View
pcl::gpu::DeviceArray2D< PixelRGB > View
Definition
raycaster.h:67
pcl::gpu::kinfuLS::RayCaster::getVertexMap
MapArr getVertexMap() const
Returns raycasterd vertex map.
pcl::gpu::kinfuLS::RayCaster::cols
const int cols
Image with height.
Definition
raycaster.h:71
pcl::gpu::kinfuLS::RayCaster::Ptr
shared_ptr< RayCaster > Ptr
Definition
raycaster.h:64
pcl::gpu::kinfuLS::RayCaster::Depth
pcl::gpu::DeviceArray2D< unsigned short > Depth
Definition
raycaster.h:68
pcl::gpu::kinfuLS::RayCaster::generateSceneView
void generateSceneView(View &view, const Eigen::Vector3f &light_source_pose) const
Generates scene view using data raycasted by run method.
pcl::gpu::kinfuLS::tsdf_buffer
Structure to handle buffer addresses.
Definition
tsdf_buffer.h:51