-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpyshot.pyx
75 lines (68 loc) · 2.24 KB
/
pyshot.pyx
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
# distutils : language = c++
# distutils: sources = src/shot_descriptor.cpp
# cython: language_level = 3
from libcpp.vector cimport vector
import numpy as np
cimport numpy as np
from libcpp cimport bool
cdef extern from "include/shot_descriptor.h":
vector[vector[double]] calc_shot(
const vector[vector[double]] vertices,
const vector[vector[int]] faces,
double radius,
double local_rf_radius,
int min_neighbors,
int n_bins,
bool double_volumes,
bool use_interpolation,
bool use_normalization,
)
cpdef get_descriptors(
np.ndarray[double, ndim=2] vertices,
np.ndarray[long, ndim=2] faces,
double radius,
double local_rf_radius,
int min_neighbors = 3,
int n_bins = 20,
bool double_volumes_sectors=True,
bool use_interpolation=True,
bool use_normalization=True,
):
"""
Returns the SHOT descriptors of a mesh point cloud.
Parameters
------------
vertices : (n, 3) float
Array of vertex locations.
faces : (m, 3) int
Array of triangular faces.
radius: float
Radius for querying neighbours.
local_rf_radius: float
Radius of the Reference Frame neighbourhood.
min_neighbors: int
Minimum number of neighbours to use.
n_bins:
The number of bins for the histogram
double_volumes_sectors: bool
Double the maximum number of volume angular sectors for descriptor.
use_interpolation: bool
Use interpolation during computations.
use_normalization: bool
Normalize during computations.
Returns
----------
descr: (n, d) float
Array containing the d SHOT descriptors for the n points,
where d = 16 * (n_bins + 1) * (double_volumes_sectors + 1).
"""
descr = calc_shot(vertices,
faces,
radius,
local_rf_radius,
min_neighbors,
n_bins,
double_volumes_sectors,
use_interpolation,
use_normalization)
return np.array(descr)