Skip to content

Commit 1902e97

Browse files
committed
Merged
2 parents 4c07070 + 2e2a514 commit 1902e97

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

gaussian_renderer/ever.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import numpy as np
2828
from icecream import ic
2929
from scene.dataset_readers import ProjectionType
30+
from utils import camera_utils_zipnerf
3031

3132
def get_ray_directions(H, W, focal, center=None, random=True):
3233
"""

scene/dataset_readers.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from scene.gaussian_model import BasicPointCloud
2525
import enum
2626
import json
27-
import cv2
2827

2928
class ProjectionType(enum.Enum):
3029
"""Camera projection type (perspective pinhole, fisheye, or 360 pano)."""
@@ -158,8 +157,7 @@ def readColmapCameras(cam_extrinsics, cam_intrinsics, images_folder, metadata_pa
158157
exposure = 1
159158
iso = 100
160159
aperature = 1
161-
image = cv2.imread(image_path)
162-
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
160+
image = None
163161

164162
cam_info = CameraInfo(uid=uid, R=R, T=T, FovY=FovY, FovX=FovX, image=image,
165163
image_path=image_path, image_name=image_name, width=width,

utils/camera_utils.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
import numpy as np
1414
from utils.general_utils import PILtoTorch
1515
from utils.graphics_utils import fov2focal
16-
from icecream import ic
16+
from PIL import Image
1717

1818
WARNED = False
1919

2020
def loadCam(args, id, cam_info, resolution_scale):
21-
orig_w, orig_h = cam_info.image.shape[1], cam_info.image.shape[0]
21+
image = Image.open(cam_info.image_path)
22+
orig_w, orig_h = image.size
2223

2324
if args.resolution in [1, 2, 4, 8]:
2425
resolution = round(orig_w/(resolution_scale * args.resolution)), round(orig_h/(resolution_scale * args.resolution))
@@ -39,7 +40,7 @@ def loadCam(args, id, cam_info, resolution_scale):
3940
scale = float(global_down) * float(resolution_scale)
4041
resolution = (int(orig_w / scale), int(orig_h / scale))
4142

42-
resized_image_rgb = PILtoTorch(cam_info.image, resolution)
43+
resized_image_rgb = PILtoTorch(image, resolution)
4344

4445
gt_image = resized_image_rgb[:3, ...]
4546
loaded_mask = None

utils/general_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def inverse_sigmoid(x):
2020
return torch.log(x/(1-x))
2121

2222
def PILtoTorch(pil_image, resolution):
23-
resized_image_PIL = cv2.resize(pil_image, resolution)
24-
# resized_image_PIL = pil_image.resize(resolution)
23+
# resized_image_PIL = cv2.resize(pil_image, resolution)
24+
resized_image_PIL = pil_image.resize(resolution)
2525
resized_image = torch.from_numpy(np.array(resized_image_PIL)) / 255.0
2626
if len(resized_image.shape) == 3:
2727
return resized_image.permute(2, 0, 1)

0 commit comments

Comments
 (0)