File: MovingLeastSquares_172.pxi

package info (click to toggle)
python-pcl 0.3.0~rc1%2Bdfsg-14
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 31,828 kB
  • sloc: python: 3,094; cpp: 283; makefile: 181; sh: 24; ansic: 12
file content (192 lines) | stat: -rw-r--r-- 6,299 bytes parent folder | download | duplicates (3)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# -*- coding: utf-8 -*-
cimport _pcl
cimport pcl_defs as cpp
cimport pcl_surface_172 as pclsf
cimport pcl_kdtree_172 as pclkdt

cdef class MovingLeastSquares:
    """
    Smoothing class which is an implementation of the MLS (Moving Least Squares)
    algorithm for data smoothing and improved normal estimation.
    """
    cdef pclsf.MovingLeastSquares_t *me
    
    def __cinit__(self):
        self.me = new pclsf.MovingLeastSquares_t()
    
    def __dealloc__(self):
        del self.me
    
    def set_search_radius(self, double radius):
        """
        Set the sphere radius that is to be used for determining the k-nearest neighbors used for fitting. 
        """
        self.me.setSearchRadius (radius)
    
    def set_polynomial_order(self, bool order):
        """
        Set the order of the polynomial to be fit. 
        """
        self.me.setPolynomialOrder(order)
    
    def set_polynomial_fit(self, bool fit):
        """
        Sets whether the surface and normal are approximated using a polynomial,
        or only via tangent estimation.
        """
        self.me.setPolynomialFit(fit)
    
    def set_Compute_Normals(self, bool flag):
        self.me.setComputeNormals(flag)
    
    def set_Search_Method(self, _pcl.KdTree kdtree):
       # self.me.setSearchMethod(kdtree.thisptr()[0])
       # self.me.setSearchMethod(kdtree.thisptr())
       self.me.setSearchMethod(kdtree.thisptr_shared)
    
    # def set_Search_Method(self, _pcl.KdTreeFLANN kdtree):
    #    # self.me.setSearchMethod(kdtree.thisptr())
    #    self.me.setSearchMethod(kdtree.thisptr_shared)
    
    def process(self):
        """
        Apply the smoothing according to the previously set values and return
        a new PointCloud
        """
        cdef PointCloud pc = PointCloud()
        self.me.process(pc.thisptr()[0])
        return pc
        # cdef PointCloud_PointNormal pcNormal = PointCloud_PointNormal()
        # self.me.process(pcNormal.thisptr()[0])
        # return pcNormal


# cdef class MovingLeastSquares_PointXYZI:
#     """
#     Smoothing class which is an implementation of the MLS (Moving Least Squares)
#     algorithm for data smoothing and improved normal estimation.
#     """
#     cdef pclsf.MovingLeastSquares_PointXYZI_t *me
#     
#     def __cinit__(self):
#         self.me = new pclsf.MovingLeastSquares_PointXYZI_t()
#     def __dealloc__(self):
#         del self.me
# 
#     def set_search_radius(self, double radius):
#         """
#         Set the sphere radius that is to be used for determining the k-nearest neighbors used for fitting. 
#         """
#         self.me.setSearchRadius (radius)
# 
#     def set_polynomial_order(self, bool order):
#         """
#         Set the order of the polynomial to be fit. 
#         """
#         self.me.setPolynomialOrder(order)
# 
#     def set_polynomial_fit(self, bint fit):
#         """
#         Sets whether the surface and normal are approximated using a polynomial,
#         or only via tangent estimation.
#         """
#         self.me.setPolynomialFit(fit)
# 
#     def process(self):
#         """
#         Apply the smoothing according to the previously set values and return
#         a new pointcloud
#         """
#         cdef PointCloud_PointXYZI pc = PointCloud_PointXYZI()
#         self.me.process(pc.thisptr()[0])
#         return pc


cdef class MovingLeastSquares_PointXYZRGB:
    """
    Smoothing class which is an implementation of the MLS (Moving Least Squares)
    algorithm for data smoothing and improved normal estimation.
    """
    cdef pclsf.MovingLeastSquares_PointXYZRGB_t *me
    
    def __cinit__(self):
        self.me = new pclsf.MovingLeastSquares_PointXYZRGB_t()
    
    def __dealloc__(self):
        del self.me
    
    def set_search_radius(self, double radius):
        """
        Set the sphere radius that is to be used for determining the k-nearest neighbors used for fitting. 
        """
        self.me.setSearchRadius (radius)
    
    def set_polynomial_order(self, bool order):
        """
        Set the order of the polynomial to be fit. 
        """
        self.me.setPolynomialOrder(order)
    
    def set_polynomial_fit(self, bint fit):
        """
        Sets whether the surface and normal are approximated using a polynomial,
        or only via tangent estimation.
        """
        self.me.setPolynomialFit(fit)
    
    def process(self):
        """
        Apply the smoothing according to the previously set values and return
        a new pointcloud
        """
        cdef PointCloud_PointXYZRGB pc = PointCloud_PointXYZRGB()
        self.me.process(pc.thisptr()[0])
        return pc
        # cdef PointCloud_PointNormal pcNormal = PointCloud_PointNormal()
        # self.me.process(pcNormal.thisptr()[0])
        # return pcNormal

cdef class MovingLeastSquares_PointXYZRGBA:
    """
    Smoothing class which is an implementation of the MLS (Moving Least Squares)
    algorithm for data smoothing and improved normal estimation.
    """
    cdef pclsf.MovingLeastSquares_PointXYZRGBA_t *me
    
    def __cinit__(self):
        self.me = new pclsf.MovingLeastSquares_PointXYZRGBA_t()
    
    def __dealloc__(self):
        del self.me
    
    def set_search_radius(self, double radius):
        """
        Set the sphere radius that is to be used for determining the k-nearest neighbors used for fitting. 
        """
        self.me.setSearchRadius (radius)
    
    def set_polynomial_order(self, bool order):
        """
        Set the order of the polynomial to be fit. 
        """
        self.me.setPolynomialOrder(order)
    
    def set_polynomial_fit(self, bint fit):
        """
        Sets whether the surface and normal are approximated using a polynomial,
        or only via tangent estimation.
        """
        self.me.setPolynomialFit(fit)
    
    def process(self):
        """
        Apply the smoothing according to the previously set values and return
        a new pointcloud
        """
        cdef PointCloud_PointXYZRGBA pc = PointCloud_PointXYZRGBA()
        self.me.process(pc.thisptr()[0])
        return pc
        # cdef PointCloud_PointNormal pcNormal = PointCloud_PointNormal()
        # self.me.process(pcNormal.thisptr()[0])
        # return pcNormal