|
12 | 12 | import numpy as np
|
13 | 13 | import yaml
|
14 | 14 | import rawpy
|
15 |
| - |
| 15 | +import util.utils as util |
16 | 16 |
|
17 | 17 | from modules.dead_pixel_correction import DeadPixelCorrection as DPC
|
18 | 18 | from modules.hdr_stitching import HdrStitching as HDRS
|
|
81 | 81 | parm_sha = c_yaml["sharpen"]
|
82 | 82 | parm_jpg = c_yaml["jpeg_conversion"]
|
83 | 83 | parm_yuv = c_yaml["yuv_conversion_format"]
|
| 84 | +parm_swap = c_yaml["swap_uv_channels"] |
84 | 85 |
|
85 | 86 | # Get the path to the inputfile
|
86 | 87 | RAW_FOLDER = "./in_frames/normal/"
|
|
311 | 312 | # save module output if enabled
|
312 | 313 | if parm_csc["is_save"]:
|
313 | 314 | filename = save_dir + "Out_color_space_conversion_" + inFile.split(".")[0]
|
314 |
| - np.save(filename, csc_img) |
| 315 | + if parm_swap["color_space_conversion"]: |
| 316 | + swapped_arr = util.swap_uv(csc_img) |
| 317 | + np.save(filename, swapped_arr) |
| 318 | + else: |
| 319 | + np.save(filename, csc_img) |
315 | 320 |
|
316 | 321 | # x = np.load(save_dir +"Out_color_space_conversion_" + inFile.split(".")[0]+".npy")
|
317 | 322 | # print(np.array_equal(x, csc_img))
|
|
323 | 328 | # save module output if enabled
|
324 | 329 | if parm_ldci["is_save"]:
|
325 | 330 | filename = save_dir + "Out_ldci_" + inFile.split(".")[0]
|
326 |
| - np.save(filename, ldci_img) |
| 331 | + if parm_swap["ldci"]: |
| 332 | + swapped_arr = util.swap_uv(ldci_img) |
| 333 | + np.save(filename, swapped_arr) |
| 334 | + else: |
| 335 | + np.save(filename, ldci_img) |
327 | 336 |
|
328 | 337 | # x = np.load(save_dir +"Out_ldci_" + inFile.split(".")[0]+".npy")
|
329 | 338 | # print(np.array_equal(x, ldci_img))
|
|
335 | 344 | # save module output if enabled
|
336 | 345 | if parm_sha["is_save"]:
|
337 | 346 | filename = save_dir + "Out_sharpen_" + inFile.split(".")[0]
|
338 |
| - np.save(filename, sharp_img) |
| 347 | + if parm_swap["sharpen"]: |
| 348 | + swapped_arr = util.swap_uv(sharp_img) |
| 349 | + np.save(filename, swapped_arr) |
| 350 | + else: |
| 351 | + np.save(filename, sharp_img) |
339 | 352 |
|
340 | 353 | # x = np.load(save_dir +"Out_sharpen_" + inFile.split(".")[0]+".npy")
|
341 | 354 | # print(np.array_equal(x, sharp_img))
|
|
347 | 360 | # save module output if enabled
|
348 | 361 | if parm_2dn["is_save"]:
|
349 | 362 | filename = save_dir + "Out_2d_noise_reduction_" + inFile.split(".")[0]
|
350 |
| - np.save(filename, nr2d_img) |
| 363 | + if parm_swap["2d_noise_reduction"]: |
| 364 | + swapped_arr = util.swap_uv(nr2d_img) |
| 365 | + np.save(filename, swapped_arr) |
| 366 | + else: |
| 367 | + np.save(filename, nr2d_img) |
351 | 368 |
|
352 | 369 | # x = np.load(save_dir +"Out_2d_noise_reduction_" + inFile.split(".")[0]+".npy")
|
353 | 370 | # print(np.array_equal(x, nr2d_img))
|
|
359 | 376 | # save module output if enabled
|
360 | 377 | if parm_sca["is_save"]:
|
361 | 378 | filename = save_dir + "Out_scale_" + inFile.split(".")[0]
|
362 |
| - np.save(filename, scaled_img) |
| 379 | + if parm_swap["scale"]: |
| 380 | + swapped_arr = util.swap_uv(scaled_img) |
| 381 | + np.save(filename, swapped_arr) |
| 382 | + else: |
| 383 | + np.save(filename, scaled_img) |
363 | 384 |
|
364 | 385 | # x = np.load(save_dir +"Out_scale_" + inFile.split(".")[0]+".npy")
|
365 | 386 | # print(np.array_equal(x, scaled_img))
|
|
372 | 393 | # save module output if enabled
|
373 | 394 | if parm_yuv["is_save"]:
|
374 | 395 | filename = save_dir + "Out_yuv_conversion_format_" + inFile.split(".")[0]
|
375 |
| - np.save(filename, yuv_conv) |
| 396 | + if parm_swap["yuv_conversion_format"]: |
| 397 | + swapped_arr = util.swap_uv(yuv_conv) |
| 398 | + np.save(filename, swapped_arr) |
| 399 | + else: |
| 400 | + np.save(filename, yuv_conv) |
376 | 401 |
|
377 | 402 | # x = np.load(save_dir +"Out_yuv_conversion_format_" + inFile.split(".")[0]+".npy")
|
378 | 403 | # print(np.array_equal(x, yuv_conv))
|
|
0 commit comments