Skip to content

Commit 8507941

Browse files
committed
Merge pull request strawlab#57 from larsmans/fix-eigen-transpose
BUG: Eigen uses column-major storage!
2 parents 036aea4 + 779f77e commit 8507941

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

pcl/_pcl.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ cdef class PointCloud:
135135
To load a point cloud from disk, use pcl.load.
136136
"""
137137
def __cinit__(self, init=None):
138-
cdef BasePointCloud other
138+
cdef PointCloud other
139139

140140
sp_assign(self.thisptr_shared, new cpp.PointCloud[cpp.PointXYZ]())
141141

pcl/registration.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ cdef object run(Registration[cpp.PointXYZ, cpp.PointXYZ] &reg,
5454
# Get transformation matrix and convert from Eigen to NumPy format.
5555
cdef Registration[cpp.PointXYZ, cpp.PointXYZ].Matrix4 mat
5656
mat = reg.getFinalTransformation()
57-
cdef np.ndarray[dtype=np.float32_t, ndim=2, mode='c'] transf
57+
cdef np.ndarray[dtype=np.float32_t, ndim=2, mode='fortran'] transf
5858
cdef np.float32_t *transf_data
5959

60-
transf = np.empty((4, 4), dtype=np.float32, order='c')
60+
transf = np.empty((4, 4), dtype=np.float32, order='fortran')
6161
transf_data = <np.float32_t *>np.PyArray_DATA(transf)
6262

6363
for i in range(16):

tests/test_registration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import numpy as np
44
from numpy import cos, sin
5+
from numpy.testing import assert_equal
56
import unittest
67

78
import pcl
@@ -38,13 +39,15 @@ def check_algo(self, algo):
3839
self.assertTrue(isinstance(transf, np.ndarray))
3940
self.assertEqual(transf.shape, (4, 4))
4041

42+
self.assertFalse(np.any(transf[:3] == 0))
43+
assert_equal(transf[3], [0, 0, 0, 1])
44+
4145
# XXX I think I misunderstand fitness, it's not equal to the following
4246
# MSS.
4347
# mss = (np.linalg.norm(estimate.to_array()
4448
# - self.source.to_array(), axis=1) ** 2).mean()
4549
# self.assertLess(mss, 1)
4650

47-
# TODO check the actual transformation matrix.
4851
#print("------", algo)
4952
#print("Converged: ", converged, "Estimate: ", estimate,
5053
# "Fitness: ", fitness)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy