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

fix deprecated numpy types #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
18 changes: 9 additions & 9 deletions omnicv/omnicv.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def cubemap2equirect(self,
tp[:, 7 * w // 8:] = 2

# Prepare ceil mask
mask = np.zeros((h, w // 4), np.bool)
mask = np.zeros((h, w // 4), bool)
idx = np.linspace(-np.pi, np.pi, w // 4) / 4
idx = h // 2 - np.round(np.arctan(np.cos(idx)) * h / np.pi).astype(int)
for i, j in enumerate(idx):
Expand Down Expand Up @@ -386,7 +386,7 @@ def eqruirect2persp(self,
z_map = -np.tile((np.arange(0, Hd) - c_y) * h_interval, [Wd, 1]).T
D = np.sqrt(x_map ** 2 + y_map ** 2 + z_map ** 2)

xyz = np.zeros([Hd, Wd, 3], np.float)
xyz = np.zeros([Hd, Wd, 3], np.float32)
xyz[:, :, 0] = (x_map / D)[:, :]
xyz[:, :, 1] = (y_map / D)[:, :]
xyz[:, :, 2] = (z_map / D)[:, :]
Expand All @@ -400,13 +400,13 @@ def eqruirect2persp(self,
xyz = np.dot(R1, xyz)
xyz = np.dot(R2, xyz).T
lat = np.arcsin(xyz[:, 2] / 1)
lon = np.zeros([Hd * Wd], np.float)
lon = np.zeros([Hd * Wd], np.float32)
theta = np.arctan(xyz[:, 1] / xyz[:, 0])
idx1 = xyz[:, 0] > 0
idx2 = xyz[:, 1] > 0

idx3 = ((1 - idx1) * idx2).astype(np.bool)
idx4 = ((1 - idx1) * (1 - idx2)).astype(np.bool)
idx3 = ((1 - idx1) * idx2).astype(bool)
idx4 = ((1 - idx1) * (1 - idx2)).astype(bool)

lon[idx1] = theta[idx1]
lon[idx3] = theta[idx3] + np.pi
Expand Down Expand Up @@ -464,7 +464,7 @@ def cubemap2persp(self,
y_map = np.tile((np.arange(0, Wd) - c_x) * w_interval, [Hd, 1])
z_map = -np.tile((np.arange(0, Hd) - c_y) * h_interval, [Wd, 1]).T
D = np.sqrt(x_map ** 2 + y_map ** 2 + z_map ** 2)
xyz = np.zeros([Hd, Wd, 3], np.float)
xyz = np.zeros([Hd, Wd, 3], np.float32)
xyz[:, :, 0] = (1 / D * x_map)[:, :]
xyz[:, :, 1] = (1 / D * y_map)[:, :]
xyz[:, :, 2] = (1 / D * z_map)[:, :]
Expand All @@ -478,13 +478,13 @@ def cubemap2persp(self,
xyz = np.dot(R1, xyz)
xyz = np.dot(R2, xyz).T
lat = np.arcsin(xyz[:, 2] / 1)
lon = np.zeros([Hd * Wd], np.float)
lon = np.zeros([Hd * Wd], np.float32)
theta = np.arctan(xyz[:, 1] / xyz[:, 0])
idx1 = xyz[:, 0] > 0
idx2 = xyz[:, 1] > 0

idx3 = ((1 - idx1) * idx2).astype(np.bool)
idx4 = ((1 - idx1) * (1 - idx2)).astype(np.bool)
idx3 = ((1 - idx1) * idx2).astype(bool)
idx4 = ((1 - idx1) * (1 - idx2)).astype(bool)

lon[idx1] = theta[idx1]
lon[idx3] = theta[idx3] + np.pi
Expand Down