MonoDepth-PyTorch
MonoDepth-PyTorch copied to clipboard
Question about how to get the original image
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!
2 * flow_field - 1
normalize the image coordinates. F.grid_sample
takes only flow-field with values [-1,1].