I am doing a undergraduate thesis on point cloud reduction.

I need the normals to point outwards. I have been struggling with this for some time now.

This is how I am trying to go about it: I have a point cloud of an object,specifically the stanford bunny. I create a enlarged version of this object and place the smaller version inside of it. I then make the normals point in the direction of the outer 'larger' object.

I am unable to place the larger object over the smaller object without them touching,ie the rabits ears overlap. Anybody know how I can make the smaller object fit inside the larger object.

Here is my code so far:

import numpy as np
#IMPORT THE OBJECT POINT CLOUD
c= np.genfromtxt(str('rabbitsmall') + '.txt',autostrip=True)

#Determine the x centre of the original object
xmax = np.amax(c[:,0])
xmin = np.amin(c[:,0])
tx = xmin+(xmax-xmin)/4

#Determine the y centre of the original object
ymax = np.amax(c[:,1])
ymin = np.amin(c[:,1])
ty =ymin+(ymax-ymin)/4

#Determine the z centre of the original object
zmax = np.amax(c[:,2])
zmin = np.amin(c[:,2])
tz = zmin+(zmax-zmin)/2


#CREATE A LARGER VERSION OF THE OBJECT
C = np.zeros((len(c),3))

for i in range(0,len(c)):
               C[i][0]= 1.2*c[i][0]
               C[i][1]= 1.2*c[i][1] 
               C[i][2]= 1.2*c[i][2]

#Determine the x centre of the larger object
Xmax = np.amax(C[:,0])
Xmin = np.amin(C[:,0])
TX = Xmin+(Xmax-Xmin)/4

#Determine the y centre of the larger object
Ymax = np.amax(C[:,1])
Ymin = np.amin(C[:,1])
TY =Ymin+(Ymax-Ymin)/4

#Determine the z centre of the larger object
Zmax = np.amax(C[:,2])
Zmin = np.amin(C[:,2])
TZ = Zmin+(Zmax-Zmin)/2

#TRANSLATE THE LARGER OBJECT TO BE OVER THE SMALLER OBJECT. IE THE CENTRES ARE AT THE SAME PLACE
for i in range(0,len(c)):
               C[i][0]= C[i][0]-(TX-tx)
               C[i][1]= C[i][1]-(TY-ty)
               C[i][2]= C[i][2]-(TZ-tz)


np.savetxt('rabbitlarger.txt',C)
1

There are 1 answers

1
dornhege On

First: Have you looked at your output, i.e. are the bunnies really overlaid how you want them to?

Second: You're missing the part, where you determine the normals. Are you looking for nearest points and thus the intersections are a problem? A better solution might be to match the exact points in both point clouds and determine the normals by those.