Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot align back projected points using given poses. #42

Open
otakuxiang opened this issue Mar 20, 2022 · 5 comments
Open

Cannot align back projected points using given poses. #42

otakuxiang opened this issue Mar 20, 2022 · 5 comments

Comments

@otakuxiang
Copy link

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?

@otakuxiang
Copy link
Author

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

@HalvesChen
Copy link

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

@xuxiaoxxxx
Copy link

@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?

@Arno-Tu
Copy link

Arno-Tu commented Jun 27, 2024

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.

@HalvesChen
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants