alexsax/2D-3D-Semantics

Cannot align back projected points using given poses.

otakuxiang opened this issue · 5 comments

I have read #16 and follow the equation x = ARAx' + c, but I still can't align point clouds to exr points. Here is my code

#back projection
    depth = depth / 512
    n,m = np.meshgrid(np.arange(depth.shape[0]),np.arange(depth.shape[1]))
    n = n.reshape(-1)
    m = m.reshape(-1)
    v = (n + 0.5) / depth.shape[0]
    u = (m + 0.5) / depth.shape[1]
    phi = (u - 0.5) * (2 * math.pi)
    cita = (0.5 - v) * math.pi 
    x = np.cos(cita) * np.cos(phi)
    y = np.cos(cita) * np.sin(phi)
    z = np.sin(cita)
    ray = np.stack([x,y,z],axis = 1)
    points = ray * depth[n,m].reshape(-1,1)

And my transformation code:

    pose = json.load(f)
    R = pose["camera_rt_matrix"]
    loc = pose["camera_location"]
    A = np.array(pose["camera_original_rotation"])
    A = A / 180 * math.pi
    A = get_rot_from_xyz(A[0],A[1],A[2])
    R = np.array(R)[0:3,0:3]
    loc = np.array(loc).reshape(1,3)
    fr = np.matmul(np.matmul(A,R),A)
    points = points.transpose(1,0)
    points = np.dot(fr,points).transpose(1,0) + loc

Is there any mistake?

@anita94 How did you align point clouds? Could you please share your code if possible? Thanks a lot.

@otakuxiang Hellow! I have a same problem. How did you solve it? Could you please share your code if possible? Thanks a lot.

@otakuxiang Hellow! I have a same problem. How did you solve it? Could you please share your code if possible? Thanks a lot.

Do you slove this problem?

hi otakuxiang,I just discovered that the x-coordinate and y-coordinate are reversed when regenerating a point cloud from a given panoramic depth image using your code. This causes the generated point cloud to appear as a mirror image of the original point cloud, I'm not sure if this is the reason why you can't align the generated point cloud with the original, I'll make some more attempts.

@Arno-Tu Others have solved similar problems, refer to the link.