Point Cloud Library (PCL)  1.14.1-dev
device.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 <iostream> // used by operator << in Struct Intr
41 #include <limits>
42 
43 #include <pcl/gpu/containers/device_array.h>
44 #include <pcl/gpu/kinfu_large_scale/tsdf_buffer.h>
45 
46 //using namespace pcl::gpu;
47 
48 namespace pcl
49 {
50  namespace device
51  {
52  namespace kinfuLS
53  {
54  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
55  // Types
56  using ushort = unsigned short;
59  using PointType = float4;
60 
61  //TSDF fixed point divisor (if old format is enabled)
62  constexpr int DIVISOR = std::numeric_limits<short>::max();
63 
64  //RGB images resolution
65  constexpr float HEIGHT = 480.0f;
66  constexpr float WIDTH = 640.0f;
67 
68  //Should be multiple of 32
69  constexpr int VOLUME_X = 512;
70  constexpr int VOLUME_Y = 512;
71  constexpr int VOLUME_Z = 512;
72 
73  //Temporary constant (until we make it automatic) that holds the Kinect's focal length
74  constexpr float FOCAL_LENGTH = 575.816f;
75 
76  constexpr float VOLUME_SIZE = 3.0f; // physical size represented by the TSDF volume. In meters
77  constexpr float DISTANCE_THRESHOLD = 1.5f; // when the camera target point is farther than DISTANCE_THRESHOLD from the current cube's center, shifting occurs. In meters
78  constexpr int SNAPSHOT_RATE = 45; // every 45 frames an RGB snapshot will be saved. -et parameter is needed when calling Kinfu Large Scale in command line.
79 
80 
81  /** \brief Camera intrinsics structure
82  */
83  struct Intr
84  {
85  float fx, fy, cx, cy;
86  Intr () {}
87  Intr (float fx_, float fy_, float cx_, float cy_) : fx (fx_), fy (fy_), cx (cx_), cy (cy_) {}
88 
89  Intr operator () (int level_index) const
90  {
91  int div = 1 << level_index;
92  return (Intr (fx / div, fy / div, cx / div, cy / div));
93  }
94 
95  friend inline std::ostream&
96  operator << (std::ostream& os, const Intr& intr)
97  {
98  os << "([f = " << intr.fx << ", " << intr.fy << "] [cp = " << intr.cx << ", " << intr.cy << "])";
99  return (os);
100  }
101  };
102 
103  /** \brief 3x3 Matrix for device code
104  */
105  struct Mat33
106  {
107  float3 data[3];
108  };
109  }
110  }
111 }
DeviceArray2D class
Definition: device_array.h:188
constexpr int VOLUME_Z
Definition: device.h:71
constexpr int DIVISOR
Definition: device.h:62
constexpr float DISTANCE_THRESHOLD
Definition: device.h:77
float4 PointType
Definition: device.h:59
constexpr int VOLUME_Y
Definition: device.h:70
constexpr float FOCAL_LENGTH
Definition: device.h:74
constexpr int SNAPSHOT_RATE
Definition: device.h:78
constexpr int VOLUME_X
Definition: device.h:69
constexpr float HEIGHT
Definition: device.h:65
unsigned short ushort
Definition: device.h:56
constexpr float VOLUME_SIZE
Definition: device.h:76
constexpr float WIDTH
Definition: device.h:66
Camera intrinsics structure.
Definition: device.h:84
friend std::ostream & operator<<(std::ostream &os, const Intr &intr)
Definition: device.h:96
Intr operator()(int level_index) const
Definition: device.h:89
Intr(float fx_, float fy_, float cx_, float cy_)
Definition: device.h:87
3x3 Matrix for device code
Definition: device.h:106