mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 06:49:13 +08:00
Frozen opacity MLP at the 2nd step of training + just fast exposure for 2nd step + evaluation scripts
This commit is contained in:
1 parent
c3c151f3ae
commit
0ab3139b19
18 files changed
+875
-50
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import os
|
||||
import numpy as np
|
||||
import cv2
|
||||
from pathlib import Path
|
||||
from tqdm import tqdm
|
||||
import argparse
|
||||
import json
|
||||
|
||||
os.environ["OPENCV_IO_ENABLE_OPENEXR"] = "1"
|
||||
|
||||
|
||||
def apply_correction(coefs, img, CORRECTION_CURVE_TYPE) -> np.ndarray:
|
||||
# check that img is in range 0-255
|
||||
assert img.dtype == np.uint8
|
||||
assert CORRECTION_CURVE_TYPE in ['gamma']
|
||||
img = ((img.astype(np.float32) / 255.0) ** np.array(coefs).T) # * 255.0
|
||||
# img = ((img.astype(np.float32) / 255.0) ** coefs[None, None, :]) * 255.0
|
||||
return img
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--data_dir', type=str, default='/Users/momo/Desktop/Pandora-HDR_NeRF/final_results/meeting_room/LDR_Nerfacto/pano_jpeg/')
|
||||
parser.add_argument('--out_dir', type=str, default='/Users/momo/Desktop/Pandora-HDR_NeRF/final_results/meeting_room/LDR_Nerfacto/pano/')
|
||||
args = parser.parse_args()
|
||||
well_addr = args.data_dir
|
||||
|
||||
with open(f'./linearize-ricoh-z10-wb-3500.json') as f:
|
||||
camera_data = json.load(f)
|
||||
CORRECTION_CURVE_TYPE = 'gamma'
|
||||
|
||||
well_images = []
|
||||
for path in Path(well_addr).rglob('*.jpg'):
|
||||
well_images.append(path)
|
||||
|
||||
for well_addr in tqdm(well_images):
|
||||
|
||||
well_addr = str(well_addr)
|
||||
hdr_well_image = cv2.imread(well_addr, cv2.IMREAD_UNCHANGED)
|
||||
final_output = apply_correction((camera_data["b"], camera_data["g"], camera_data["r"]), np.array(hdr_well_image), CORRECTION_CURVE_TYPE)
|
||||
|
||||
output_addr = well_addr.replace(args.data_dir, args.out_dir)
|
||||
output_addr = output_addr.replace('.jpg', '.exr')
|
||||
cv2.imwrite(output_addr, np.float32(final_output) )
|
||||
# cv2.imwrite(output_addr, np.float32(final_output*255) )
|
||||
Reference in new issue
Block a user