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