Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions hy3dworld/utils/perspective_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def __init__(self, img_name=None, FOV=None, THETA=None, PHI=None, img_width=512,
self.THETA = THETA
self.PHI = PHI
if self._width > self._height:
self.wFOV = FOV
self.hFOV = (float(self._height) / self._width) * FOV
self.w_len = np.tan(np.radians(FOV / 2.0))
self.h_len = self.w_len * float(self._height) / self._width
else:
self.wFOV = (float(self._width) / self._height) * FOV
self.hFOV = FOV
self.h_len = np.tan(np.radians(FOV / 2.0))
self.w_len = self.h_len * float(self._width) / self._height

self.w_len = np.tan(np.radians(self.wFOV / 2.0))
self.h_len = np.tan(np.radians(self.hFOV / 2.0))
self.wFOV = np.degrees(2 * np.arctan(self.w_len))
self.hFOV = np.degrees(2 * np.arctan(self.h_len))

def GetEquirec(self, height, width, img=None):
#
Expand Down Expand Up @@ -99,7 +99,7 @@ def GetEquirec(self, height, width, img=None):
0)
# Remap the image using the longitude and latitude maps
persp = cv2.remap(self._img, lon_map.astype(np.float32), lat_map.astype(
np.float32), cv2.INTER_CUBIC, borderMode=cv2.BORDER_WRAP) # BORDER_CONSTANT) #))
np.float32), cv2.INTER_CUBIC, borderMode=cv2.BORDER_CONSTANT, borderValue=(0, 0, 0))
# Apply the mask to the equirectangular image
mask = mask * inverse_mask
mask = np.repeat(mask[:, :, np.newaxis], 3, axis=2)
Expand Down