-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathinit.lua
95 lines (83 loc) · 2.32 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
require 'torch'
require 'paths'
local ffi = require 'ffi'
local pcl = require 'pcl.PointTypes'
local utils = require 'pcl.utils'
require 'pcl.PointCloud'
require 'pcl.Indices'
require 'pcl.IndicesVector'
require 'pcl.Correspondences'
require 'pcl.CloudViewer'
require 'pcl.OpenNI2Stream'
require 'pcl.PCA'
require 'pcl.ICP'
require 'pcl.ICPNL'
require 'pcl.IncrementalRegistration'
require 'pcl.affine'
require 'pcl.primitive'
require 'pcl.filter'
require 'pcl.KdTree'
require 'pcl.Octree'
require 'pcl.NormalEstimation'
require 'pcl.IntegralImageNormalEstimation'
require 'pcl.SIFTKeypoint'
require 'pcl.FPFHEstimation'
require 'pcl.CorrespondenceEstimation'
require 'pcl.SampleConsensusPrerejective'
require 'pcl.BoundaryEstimation'
require 'pcl.OrganizedEdge'
require 'pcl.VFHEstimation'
require 'pcl.SACSegmentation'
require 'pcl.EuclideanClusterExtraction'
require 'pcl.PCLVisualizer'
require 'pcl.PCLPointCloud2'
function pcl.rand(width, height, pointType)
if pcl.isPointType(height) or type(height) == 'string' then
pointType = height
height = 1
else
height = height or 1
end
local c = pcl.PointCloud(pointType or pcl.PointXYZ, width, height)
if width > 0 and height > 0 then
c:pointsXYZ():rand(height, width, 3)
end
return c
end
function pcl.isPointCloud(obj)
return obj and torch.isTypeOf(obj, pcl.PointCloud)
end
function pcl.isPoint(obj)
if obj and type(obj) == 'cdata' then
local ok,t = pcall(ffi.typeof, obj)
return ok and pcl.isPointType(t)
end
return false
end
function pcl.loadPCD(filename, pointType)
local c = pcl.PointCloud(pointType or pcl.PointXYZ)
c:loadPCDFile(filename)
return c
end
function pcl.loadPLY(filename, pointType)
local c = pcl.PointCloud(pointType or pcl.PointXYZ)
c:loadPLYFile(filename)
return c
end
function pcl.transformCloud(source, destination, transform)
utils.check_arg('source', pcl.isPointCloud(source), 'point cloud expected')
return source:transform(transform, destination)
end
function pcl.getMinMax3D(cloud)
return cloud:getMinMax3D()
end
function pcl.compute3DCentroid(cloud)
return cloud:compute3DCentroid()
end
function pcl.computeCovarianceMatrix(cloud, centroid)
return cloud:computeCovarianceMatrix(centroid)
end
function pcl.copyPointCloud(cloud_in, indices, cloud_out)
return pcl.PointCloud.copy(cloud_in, indices, cloud_out)
end
return pcl