svip-lab / PlanarReconstruction

[CVPR'19] Single-Image Piece-wise Planar 3D Reconstruction via Associative Embedding
MIT License
363 stars 85 forks source link

some question about k_inv_dot_xy1? #23

Closed XGuider closed 4 years ago

XGuider commented 4 years ago

thnx your best work ,but i But I don’t understand k_inv_dot_xy1 well. ` x = torch.arange(w, dtype=torch.float32).view(1, w) / w 640 y = torch.arange(h, dtype=torch.float32).view(h, 1) / h 480

x = x.to(device)
y = y.to(device)
xx = x.repeat(h, 1)
yy = y.repeat(1, w)
xy1 = torch.stack((xx, yy, torch.ones((h, w), dtype=torch.float32).to(device)))  # (3, h, w)
xy1 = xy1.view(3, -1)  # (3, h*w)

` why do this?what's function?thnx

niujinshuchong commented 4 years ago

k_inv_dot_xy1 is used to convert the depth to point cloud. Because we use the same intrinsic matrix for all the images, pre computing the value of k_inv_dot_xy1 will save some computation.

XGuider commented 4 years ago

yes, convert the depth to point cloud like this:depthK_inv[u,v,1].so x = torch.arange(w, dtype=torch.float32).view(1, w) / w * 640 y = torch.arange(h, dtype=torch.float32).view(h, 1) / h * 480 Does this step initialize u,v?and why? question2: depth_map = 1. / np.sum(self.K_inv_dot_xy_1.reshape(3, -1) * plane_parameters.reshape(3, -1), axis=0) this code confused me,===> (1/D)[X,Y,D]N/D and (n/d)Q=1 .n is the normal vector,why not (n/d)*Q =0 Thank you for your prompt reply..

niujinshuchong commented 4 years ago

Yes. x and y here is the uv coords.

n * Q = 1 is the plane equation. To compute the depth from plane parameter n, please see Eq.2 in this paper: http://openaccess.thecvf.com/content_ECCV_2018/papers/Fengting_Yang_Recovering_3D_Planes_ECCV_2018_paper.pdf.

XGuider commented 4 years ago

okay,i get.thnx so much.