Point Cloud Library (PCL)  1.9.1
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 #ifndef PCL_KINFU_DEVICE_H_
39 #define PCL_KINFU_DEVICE_H_
40 
41 #include <pcl/gpu/containers/device_array.h>
42 #include <iostream> // used by operator << in Struct Intr
43 #include <pcl/gpu/kinfu_large_scale/tsdf_buffer.h>
44 
45 //using namespace pcl::gpu;
46 
47 namespace pcl
48 {
49  namespace device
50  {
51  namespace kinfuLS
52  {
53  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54  // Types
55  typedef unsigned short ushort;
58  typedef float4 PointType;
59 
60  //TSDF fixed point divisor (if old format is enabled)
61  const int DIVISOR = 32767; // SHRT_MAX;
62 
63  //RGB images resolution
64  const float HEIGHT = 480.0f;
65  const float WIDTH = 640.0f;
66 
67  //Should be multiple of 32
68  enum { VOLUME_X = 512, VOLUME_Y = 512, VOLUME_Z = 512 };
69 
70 
71  //Temporary constant (until we make it automatic) that holds the Kinect's focal length
72  const float FOCAL_LENGTH = 575.816f;
73 
74  const float VOLUME_SIZE = 3.0f; // physical size represented by the TSDF volume. In meters
75  const 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
76  const 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.
77 
78 
79  /** \brief Camera intrinsics structure
80  */
81  struct Intr
82  {
83  float fx, fy, cx, cy;
84  Intr () {}
85  Intr (float fx_, float fy_, float cx_, float cy_) : fx (fx_), fy (fy_), cx (cx_), cy (cy_) {}
86 
87  Intr operator () (int level_index) const
88  {
89  int div = 1 << level_index;
90  return (Intr (fx / div, fy / div, cx / div, cy / div));
91  }
92 
93  friend inline std::ostream&
94  operator << (std::ostream& os, const Intr& intr)
95  {
96  os << "([f = " << intr.fx << ", " << intr.fy << "] [cp = " << intr.cx << ", " << intr.cy << "])";
97  return (os);
98  }
99  };
100 
101  /** \brief 3x3 Matrix for device code
102  */
103  struct Mat33
104  {
105  float3 data[3];
106  };
107  }
108  }
109 }
110 
111 #endif /* PCL_KINFU_DEVICE_H_ */
Intr operator()(int level_index) const
Definition: device.h:87
Camera intrinsics structure.
Definition: device.h:81
const int SNAPSHOT_RATE
Definition: device.h:76
unsigned short ushort
Definition: device.h:55
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
DeviceArray2D class
Definition: device_array.h:154
float4 PointType
Definition: device.h:58
3x3 Matrix for device code
Definition: device.h:103
Intr(float fx_, float fy_, float cx_, float cy_)
Definition: device.h:85
DeviceArray2D< float > MapArr
Definition: device.h:56
friend std::ostream & operator<<(std::ostream &os, const Intr &intr)
Definition: device.h:94
const int DIVISOR
Definition: device.h:61
DeviceArray2D< ushort > DepthMap
Definition: device.h:57
const float WIDTH
Definition: device.h:65
const float DISTANCE_THRESHOLD
Definition: device.h:75
const float HEIGHT
Definition: device.h:64
const float FOCAL_LENGTH
Definition: device.h:72
const float VOLUME_SIZE
Definition: device.h:74