-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCorrespondenceEstimation.lua
77 lines (62 loc) · 2.64 KB
/
CorrespondenceEstimation.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
local ffi = require 'ffi'
local torch = require 'torch'
local utils = require 'pcl.utils'
local pcl = require 'pcl.PointTypes'
local CorrespondenceEstimation = torch.class('pcl.CorrespondenceEstimation', pcl)
local func_by_type = {}
local function init()
local CorrespondenceEstimation_method_names = {
'new',
'delete',
'setInputSource',
'setInputTarget',
'setIndicesSource',
'setIndicesTarget',
'setSearchMethodSource',
'setSearchMethodTarget',
'determineCorrespondences',
'determineReciprocalCorrespondences'
}
for k,v in pairs(utils.type_key_map) do
func_by_type[k] = utils.create_typed_methods("pcl_CorrespondenceEstimation_TYPE_KEY_", CorrespondenceEstimation_method_names, v)
end
func_by_type[pcl.FPFHSignature33] = utils.create_typed_methods("pcl_CorrespondenceEstimation_TYPE_KEY_", CorrespondenceEstimation_method_names, 'FPFHSignature33')
func_by_type[pcl.VFHSignature308] = utils.create_typed_methods("pcl_CorrespondenceEstimation_TYPE_KEY_", CorrespondenceEstimation_method_names, 'VFHSignature308')
end
init()
function CorrespondenceEstimation:__init(pointType)
self.pointType = pcl.pointType(pointType or pcl.PointXYZ)
self.f = func_by_type[self.pointType]
self.o = self.f.new()
end
function CorrespondenceEstimation:cdata()
return self.o
end
function CorrespondenceEstimation:setInputSource(cloud)
self.f.setInputSource(self.o, cloud:cdata())
end
function CorrespondenceEstimation:setInputTarget(cloud)
self.f.setInputTarget(self.o, cloud:cdata())
end
function CorrespondenceEstimation:setIndicesSource(indices)
self.f.setIndicesSource(self.o, indices:cdata())
end
function CorrespondenceEstimation:setIndicesTarget(indices, no_recompute)
self.f.setIndicesTarget(self.o, indices:cdata())
end
function CorrespondenceEstimation:setSearchMethodSource(kdtree, no_recompute)
self.f.setSearchMethodSource(self.o, kdtree:cdata(), no_recompute or false)
end
function CorrespondenceEstimation:setSearchMethodTarget(kdtree, no_recompute)
self.f.setSearchMethodTarget(self.o, kdtree:cdata(), no_recompute or false)
end
function CorrespondenceEstimation:determineCorrespondences(correspondences, max_distance)
correspondences = correspondences or pcl.Correspondences()
self.f.determineCorrespondences(self.o, correspondences:cdata(), max_distance or pcl.range.double.max)
return correspondences
end
function CorrespondenceEstimation:determineReciprocalCorrespondences(correspondences, max_distance)
correspondences = correspondences or pcl.Correspondences()
self.f.determineReciprocalCorrespondences(self.o, correspondences:cdata(), max_distance or pcl.range.double.max)
return correspondences
end