twitchslam icon indicating copy to clipboard operation
twitchslam copied to clipboard

ValueError: ndarray is not C-contiguous

Open robelkebede opened this issue 5 years ago • 1 comments

*** frame 2/628 *** Matches: 1581 -> 1581 -> 1215 -> 1214 Culled: 0 points Pose: 0.022129 Traceback (most recent call last): File "./slam.py", line 218, in slam.process_frame(frame, None if gt_pose is None else np.linalg.inv(gt_pose[i])) File "./slam.py", line 86, in process_frame for m_idx in f1.kd.query_ball_point(projs[i], 2): File "ckdtree.pyx", line 910, in scipy.spatial.ckdtree.cKDTree.query_ball_point File "stringsource", line 654, in View.MemoryView.memoryview_cwrapper File "stringsource", line 349, in View.MemoryView.memoryview.cinit ValueError: ndarray is not C-contiguous

robelkebede avatar May 24 '19 08:05 robelkebede

@robelkebede44

in slam.py add

projs = projs.copy(order='C')

on line 77 after the good_pts declaration

Will look something like this:

` projs = projs[:, 0:2] / projs[:, 2:]

  # only the points that fit in the frame
  good_pts = (projs[:, 0] > 0) & (projs[:, 0] < self.W) & \
             (projs[:, 1] > 0) & (projs[:, 1] < self.H)
  projs = projs.copy(order='C')   
  for i, p in enumerate(self.mapp.points):
    if not good_pts[i]:
      # point not visible in frame
      continue`

VibAltekar avatar Jul 15 '19 08:07 VibAltekar