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

Question about pixel_coords. #70

Open
whyygug opened this issue Dec 11, 2020 · 2 comments
Open

Question about pixel_coords. #70

whyygug opened this issue Dec 11, 2020 · 2 comments

Comments

@whyygug
Copy link

whyygug commented Dec 11, 2020

image

What's the meaning of "make sure that no point in warped image is a combinaison of im and gray" ?
It seems that points outside the image boundaries will still be set to 0, if don't use the code above.
Can you explain in detail what this code does? Thank you!

@suvigy
Copy link

suvigy commented May 31, 2021

I would also be interested in it. :)
As I can see you first tried also without it (in inverse_warp and cam2pixel) but did you have some artifacts on depth and that's why you switched to the solution mentioned by @whyygug? What can one expect without setting this out of pixels to 2? (if we just create the valid mask based on the image-inside coordinates)

@mhariat
Copy link

mhariat commented Jul 11, 2021

Good point.

When you set align_corners to False (default setting), you’re actually considering pixels as squares with the middle of the square as the pixel reference. So you could end-up with out-of-bounds in this setting that are still valid points with respect to the valid_mask. The fact that the grid_sample function and the valid_mask are not aligned on their interpretation of the out-of-bounds could create artifacts on the border (although I haven't experimented any with SC-Sfm). That’s why in the code above, the author is actually detaching the gradient from those points to avoid any unexpected behaviors.

It’s interesting to note that when align_corners is set to True, the valid_mask and the out-of-bounds interpretation of grid_sample are consistent and it doesn’t make any difference to have padding_mode set to “zeros” or to “border” because the valid_mask will remove those points afterward.

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

3 participants