File: ConditionalRemoval_180.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 (49 lines) | stat: -rw-r--r-- 1,472 bytes parent folder | download | duplicates (2)
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
# -*- coding: utf-8 -*-
from libcpp.vector cimport vector
from libcpp cimport bool

cimport pcl_defs as cpp
cimport pcl_filters_180 as pclfil

cimport eigen as eigen3

from libcpp.memory cimport shared_ptr

cdef class ConditionalRemoval:
    """
    Must be constructed from the reference point cloud, which is copied, so
    changed to pc are not reflected in ConditionalRemoval(pc).
    """
    cdef pclfil.ConditionalRemoval_t *me

    def __cinit__(self, ConditionAnd cond):
        # self.me = new pclfil.ConditionalRemoval_t(<pclfil.ConditionBase_t*>cond.me)
        # direct - NG
        from warnings import warn
        warn("constructor with condition is deprecated, use setCondition()",
                DeprecationWarning)
        self.me = new pclfil.ConditionalRemoval_t()
        self.me.setCondition(<pclfil.ConditionBasePtr_t>cond.me)

    def __cinit__(self):
        self.me = new pclfil.ConditionalRemoval_t()

    # def __dealloc__(self):
    #    # MemoryAccessError
    #    # del self.me
    #    self.me

    def set_KeepOrganized(self, flag):
        self.me.setKeepOrganized(flag)

    def set_Condition(self, ConditionAnd cond):
        self.me.setCondition(<pclfil.ConditionBasePtr_t>cond.me)

    def filter(self):
        """
        Apply the filter according to the previously set parameters and return
        a new pointcloud
        """
        cdef PointCloud pc = PointCloud()
        self.me.filter(pc.thisptr()[0])
        return pc