if imageSynthesis and i == nearest_pano_idx: # calculate synthesis view ori_pano = scipy.misc.imresize( sv3D.panorama, (256, 512), interp='bilinear', mode=None) / 255.0 index_pano = np.full((256, 512), False, dtype=bool) point = sv3D.ptCLoudData[np.nonzero( sv3D.gnd_con)]['a_position'] yo_xyz = [] yo_color = [] yo_len = 0 for point in sv3D.ptCLoudData: if np.isnan(point['a_position']).any(): continue x, y, z = point['a_position'] - np.array(randomPos) lng, lat = base_process.pos_2_deg(x, y, z) lng = (lng + randomDeg) % 360 img_x = int(lng / 360.0 * 512.0) img_y = int(-(lat - 90) / 180.0 * 256.0) syn_pano[img_y, img_x, :] = point['a_color'] index_pano[img_y, img_x] = True yo_xyz.append([img_x, img_y, 0]) yo_color.append(point['a_color']) yo_len += 1 show_pano = np.concatenate((ori_pano, syn_pano), axis=1) #scipy.misc.imsave('yo.png', syn_pano) scipy.misc.imshow(show_pano)
data_all = sv3D.ptCLoudData programTexture_set, rrr = [], [] # For each planes for plane_idx in range(0, len(plane_split)): print('{:d}/{:d}'.format(plane_idx, len(plane_split))) # Prepared for texture output if needTexture: # Reset for each plane texture_xyz_3d, texture_xyz, texture_color, texture_len = [], [], [], 0 sel = data_all[np.nonzero(indices_split == plane_idx)] # For each point for point in sel: if np.isnan(point['a_position']).any(): continue x, y, z = point['a_position'] - np.array(randomPos) lng, lat = base_process.pos_2_deg(x, y, z) lng = (lng + randomDeg) % 360 img_x = int(lng / 360.0 * texture_width) img_y = int(-(lat - 90) / 180.0 * texture_height) syn_pano[img_y, img_x, :] = point['a_color'] index_pano[img_y, img_x] = True if needTexture: texture_xyz_3d.append([x, y, z]) texture_xyz.append([img_x, img_y, 0]) texture_color.append(point['a_color']) texture_len += 1 #indices_split_visual = np.zeros((256, 512)) #indices_split_visual[np.nonzero(indices_split_reshape == plane_idx)] = 1 #scipy.misc.imshow(indices_split_visual)