Skip to content

Commit

Permalink
Introduced an overlap setting for cube projection sunset1995#14
Browse files Browse the repository at this point in the history
  • Loading branch information
hcwinsemius committed Nov 24, 2021
1 parent 09abaac commit 1508967
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions py360convert/e2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from . import utils


def e2c(e_img, face_w=256, mode='bilinear', cube_format='dice'):
def e2c(e_img, face_w=256, mode='bilinear', cube_format='dice', overlap=0.):
'''
e_img: ndarray in shape of [H, W, *]
face_w: int, the length of each face of the cubemap
Expand All @@ -17,7 +17,7 @@ def e2c(e_img, face_w=256, mode='bilinear', cube_format='dice'):
else:
raise NotImplementedError('unknown mode')

xyz = utils.xyzcube(face_w)
xyz = utils.xyzcube(face_w, overlap=overlap)
uv = utils.xyz2uv(xyz)
coor_xy = utils.uv2coor(uv, h, w)

Expand Down
4 changes: 2 additions & 2 deletions py360convert/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from scipy.ndimage import map_coordinates


def xyzcube(face_w):
def xyzcube(face_w, overlap=0.):
'''
Return the xyz cordinates of the unit cube in [F R B L U D] format.
'''
out = np.zeros((face_w, face_w * 6, 3), np.float32)
rng = np.linspace(-0.5, 0.5, num=face_w, dtype=np.float32)
rng = np.linspace(-0.5 - overlap, 0.5 + overlap, num=face_w, dtype=np.float32)
grid = np.stack(np.meshgrid(rng, -rng), -1)

# Front face (z = 0.5)
Expand Down

0 comments on commit 1508967

Please sign in to comment.