Skip to content

How to use pointcloud_project_fast #10

@zcoo

Description

@zcoo

I just want to utilize the "pointcloud_project_fast" function to project my pure point cloud to 2D image and calculate a loss with ground truth 2D image. But the output of projection is a matrix with every values the same.

This is my test code.


from io_util import *
import numpy as np
from util.pc_util import pointcloud_project_fast, project_loss
from util.gauss_kernel import gauss_smoothen_image, smoothing_kernel, get_smooth_sigma
from util.camera import get_full_camera
from util.config import Config
import tensorflow as tf
import cv2

if __name__ == '__main__':
    pc_pl = tf.placeholder(tf.float32, (1, 5745, 3))
    camera_pl = tf.placeholder(tf.float32, (1, 4, 4))

    config = Config()
    kernel = smoothing_kernel(config, get_smooth_sigma(config, 100))
    output = pointcloud_project_fast(config, pc_pl, camera_pl, None, None, kernel, None, None)
    proj = output["proj"]
    proj_depth = output["proj_depth"]
    tr_pc = output["tr_pc"]
    voxel = output["voxels"]
    # proj_loss = project_loss(images, project, 1)

    path_gt = "/home/data/03001627_complete/03001627/1a6f615e8b1b5ae4dbbc9440457e303e.pcd"
    path_camera = "/home/data/03001627/pose/03001627/1a6f615e8b1b5ae4dbbc9440457e303e/0.txt"
    
    # pt = [1,5745,3] camera=[1,4,4] 
    pt = np.expand_dims(read_pcd(path_gt), 0).astype(np.float32)
    camera = np.expand_dims(load_camera(path_camera), 0).astype(np.float32)
    for i in range(camera.shape[0]):
        camera[i] = get_full_camera(camera[i])
    # print("pointcloud shape ", pt.shape)
    # print("camera shape ", cam_matrix.shape)

    with tf.Session() as sess:
        # sess.run(tf.global_variables_initializer())
        out_proj, out_voxel, out_tr_pc = sess.run([proj, voxel, tr_pc], feed_dict={pc_pl: pt, camera_pl: camera})
        out_proj = out_proj[0]
        out_voxel = out_voxel[0]
        out_tr_pc = out_tr_pc[0]

this is the out_proj values.
img

the input camera is from blender corresponding to image.

this is my parameters

    self.batch_size=1
    self.vox_size = 64
    self.vox_size_z = -1

    self.pc_normalise_gauss = False
    self.pc_normalise_gauss_analytical = True

    self.pc_rgb_stop_points_gradient = False
    self.pc_separable_gauss_filter = True
    self.camera_distance = 2.0  # 1.0?
    self.focal_length = 1.875  # 200?
    self.pose_quaternion = False
    self.pc_rgb_clip_after_conv = False
    self.pc_rgb_divide_by_occupancies = False
    self.pc_rgb_divide_by_occupancies_epsilon = 0.01
    self.ptn_max_projection = False
    self.pc_gauss_filter_gt = False
    self.pc_gauss_filter_gt_switch_off = False
    self.max_number_of_steps = 30000
    self.pc_relative_sigma_end = 0.2
    self.pc_relative_sigma = 3.0
    self.pc_gauss_kernel_size = 21
    self.drc_logsum = True
    self.drc_logsum_clip_val = 0.00001
    self.drc_tf_cumulative = True
    self.max_depth=10.0

could u tell me what is wrong. Thank u!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions