I have been trying to implement a project on POINT CLOUD COMPLETION but have been facing the error ‘NoneType’ object has not attribute ‘astype’, I have checked the path of the files which is correct and I have installed opencv 3.4.1 on python2.7 because this is an old project and requires old libraries.
I am getting error in add_kinect_v1_noise of pc_cmpletion_util file which is getting called from the main file in load_image “im=add_kinect_v1_noise(im)”
And it shows error on “dm_m = dm.astype(float) * 0.0001 / scale / 1000” in pc_completion_util
The main file of the project is this :
def load_image(self, file_name, add_noise = False):
im = read_png16(file_name)
im = add_kinect_v1_noise(im)
im = depthmap_16bitTofloat(im)
This is the func from main file which calling the func add_kinect_v1_noise from util files.
CV_LOAD_IMAGE_ANYDEPTH = 2 # apparently leftover from cv before cv2
int16_d_image = cv2.imread(file_name, CV_LOAD_IMAGE_ANYDEPTH)
def add_kinect_v1_noise(dm): # operates on the uint16
scale = 0.003
dm_m = dm.astype(float) * 0.0001 / scale / 1000
p_world = dm2points(dm_m) X = np.reshape(p_world[0,:], (128,128)) Y = np.reshape(p_world[1,:], (128,128)) Z = np.reshape(p_world[2,:], (128,128)) if np.min(Z) <= 0.01: print ("ZERO?") nz, angles = surfnorm_fast(X,Y,Z) dm_m_noise = add_noise(dm_m, Z, angles) return (dm_m_noise * 1000 * scale / 0.0001).astype(np.uint16)