MonoDepth-PyTorch icon indicating copy to clipboard operation
MonoDepth-PyTorch copied to clipboard

Question about how to get the original image

Open hurricane2018 opened this issue 5 years ago • 1 comments

Your code is as follows:

x_shifts = disp[:, 0, :, :] # Disparity is passed in NCHW format with 1 channel flow_field = torch.stack((x_base + x_shifts, y_base), dim=3) In grid_sample coordinates are assumed to be between -1 and 1

output = F.grid_sample(img, 2*flow_field - 1, mode='bilinear', padding_mode='zeros')

But why did you use 2*flow_field - 1? In my opinion, I think you should use output = F.grid_sample(img, flow_field, mode='bilinear', padding_mode='zeros')

Could you explain this? Thank you very much!

hurricane2018 avatar Jun 15 '19 09:06 hurricane2018

2 * flow_field - 1 normalize the image coordinates. F.grid_sample takes only flow-field with values [-1,1].

alwynmathew avatar Jun 15 '19 11:06 alwynmathew