diff --git a/example/equirectangle/output.png b/example/equirectangle/output.png deleted file mode 100644 index f73f813..0000000 Binary files a/example/equirectangle/output.png and /dev/null differ diff --git a/lib/Perspec2Equirec.py b/lib/Perspec2Equirec.py deleted file mode 100644 index c843cf1..0000000 --- a/lib/Perspec2Equirec.py +++ /dev/null @@ -1,72 +0,0 @@ -import os -import sys -import cv2 -import numpy as np - -class Perspective: - def __init__(self, img_name , FOV, THETA, PHI ): - self._img = cv2.imread(img_name, cv2.IMREAD_COLOR) - [self._height, self._width, _] = self._img.shape - self.wFOV = FOV - self.THETA = THETA - self.PHI = PHI - self.hFOV = float(self._height) / self._width * FOV - - self.w_len = np.tan(np.radians(self.wFOV / 2.0)) - self.h_len = np.tan(np.radians(self.hFOV / 2.0)) - - - - def GetEquirec(self,height,width): - # - # THETA is left/right angle, PHI is up/down angle, both in degree - # - - x,y = np.meshgrid(np.linspace(-180, 180,width),np.linspace(90,-90,height)) - - x_map = np.cos(np.radians(x)) * np.cos(np.radians(y)) - y_map = np.sin(np.radians(x)) * np.cos(np.radians(y)) - z_map = np.sin(np.radians(y)) - - xyz = np.stack((x_map,y_map,z_map),axis=2) - - y_axis = np.array([0.0, 1.0, 0.0], np.float32) - z_axis = np.array([0.0, 0.0, 1.0], np.float32) - [R1, _] = cv2.Rodrigues(z_axis * np.radians(self.THETA)) - [R2, _] = cv2.Rodrigues(np.dot(R1, y_axis) * np.radians(-self.PHI)) - - R1 = np.linalg.inv(R1) - R2 = np.linalg.inv(R2) - - xyz = xyz.reshape([height * width, 3]).T - xyz = np.dot(R2, xyz) - xyz = np.dot(R1, xyz).T - - xyz = xyz.reshape([height , width, 3]) - inverse_mask = np.where(xyz[:,:,0]>0,1,0) - - xyz[:,:] = xyz[:,:]/np.repeat(xyz[:,:,0][:, :, np.newaxis], 3, axis=2) - - - lon_map = np.where((-self.w_len=width_dst or j>=width): + break; + + dst_img[i,position,k] = img_resize[i,j,k] + + + #print(dst_img[0:123,0:149]) + dst_img = dst_img.astype(np.uint8) + #print(dst_img[300,:]) + +for c in range(0,3): + for i in range(1,height): + pixel = 100; + for j in range(width_dst): + + if(dst_img[i,j,c]!=0): + pixel = dst_img[i,j,c] + + #print(pixel) + if(dst_img[i,j,c]==0): + dst_img[i,j,c] = pixel + + + + + +cv2.imwrite('./panorama/input.jpg',dst_img)