Created
March 30, 2021 10:28
-
-
Save sergeyprokudin/724f5633024040ab11a013f81c48a1c2 to your computer and use it in GitHub Desktop.
get (u,v) coords of every image pixel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_img_uv_coords(img): | |
""" | |
Get u,v coords for image pixels | |
""" | |
img_height, img_width = img.shape[0], img.shape[1] | |
uv_map = np.zeros([img_height, img_width, 2]) | |
u = np.arange(0, img_height) | |
v = np.arange(0, img_width) | |
us, vs = np.meshgrid(v, u) | |
uv_map[:, :, 1] = us | |
uv_map[:, :, 0] = vs | |
return uv_map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment