Fix node
Browse files
nodes.py
CHANGED
@@ -31,66 +31,49 @@ class NovaNodes:
|
|
31 |
|
32 |
@classmethod
|
33 |
def INPUT_TYPES(s):
|
|
|
34 |
return {
|
35 |
"required": {
|
36 |
"image": ("IMAGE",),
|
37 |
|
38 |
-
#
|
39 |
-
"
|
40 |
-
|
41 |
-
# EXIF
|
42 |
-
"apply_exif_o": ("BOOLEAN", {"default": True}),
|
43 |
-
|
44 |
-
# Noise
|
45 |
-
"noise_std_frac": ("FLOAT", {"default": 0.015, "min": 0.0, "max": 0.1, "step": 0.001}),
|
46 |
-
"hot_pixel_prob": ("FLOAT", {"default": 1e-6, "min": 0.0, "max": 1e-3, "step": 1e-7}),
|
47 |
-
"perturb_mag_frac": ("FLOAT", {"default": 0.008, "min": 0.0, "max": 0.05, "step": 0.001}),
|
48 |
-
|
49 |
-
# CLAHE
|
50 |
-
"clahe_clip": ("FLOAT", {"default": 2.0, "min": 0.5, "max": 10.0, "step": 0.1}),
|
51 |
"clahe_grid": ("INT", {"default": 8, "min": 2, "max": 32, "step": 1}),
|
52 |
-
|
53 |
-
# Fourier
|
54 |
"apply_fourier_o": ("BOOLEAN", {"default": True}),
|
55 |
-
"fourier_strength": ("FLOAT", {"default": 0.
|
56 |
"fourier_randomness": ("FLOAT", {"default": 0.05, "min": 0.0, "max": 0.5, "step": 0.01}),
|
57 |
"fourier_phase_perturb": ("FLOAT", {"default": 0.08, "min": 0.0, "max": 0.5, "step": 0.01}),
|
58 |
-
"fourier_alpha": ("FLOAT", {"default": 1.0, "min": 0.1, "max": 4.0, "step": 0.1}),
|
59 |
"fourier_radial_smooth": ("INT", {"default": 5, "min": 0, "max": 50, "step": 1}),
|
60 |
"fourier_mode": (["auto", "ref", "model"], {"default": "auto"}),
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
"apply_vignette_o": ("BOOLEAN", {"default": True}),
|
64 |
-
"vignette_strength": ("FLOAT", {"default": 0.
|
65 |
-
|
66 |
-
# Chromatic aberration
|
67 |
"apply_chromatic_aberration_o": ("BOOLEAN", {"default": True}),
|
68 |
-
"ca_shift": ("FLOAT", {"default": 1.
|
69 |
-
|
70 |
-
|
|
|
71 |
"apply_banding_o": ("BOOLEAN", {"default": True}),
|
72 |
-
"banding_strength": ("FLOAT", {"default": 0.
|
73 |
-
|
74 |
-
# Motion blur
|
75 |
"apply_motion_blur_o": ("BOOLEAN", {"default": True}),
|
76 |
-
"motion_blur_ksize": ("INT", {"default":
|
77 |
-
|
78 |
-
#
|
79 |
-
"
|
80 |
-
"jpeg_cycles": ("INT", {"default": 2, "min": 1, "max": 10, "step": 1}),
|
81 |
-
"jpeg_quality": ("INT", {"default": 85, "min": 10, "max": 100, "step": 1}),
|
82 |
-
|
83 |
-
# Camera simulation
|
84 |
-
"sim_camera": ("BOOLEAN", {"default": False}),
|
85 |
-
"enable_bayer": ("BOOLEAN", {"default": True}),
|
86 |
-
"iso_scale": ("FLOAT", {"default": 1.0, "min": 0.1, "max": 16.0, "step": 0.1}),
|
87 |
-
"read_noise": ("FLOAT", {"default": 2.0, "min": 0.0, "max": 50.0, "step": 0.1}),
|
88 |
-
|
89 |
-
# LUT
|
90 |
-
# --- CHANGE 1: Added enable_lut toggle ---
|
91 |
-
"enable_lut": ("BOOLEAN", {"default": False}),
|
92 |
-
"lut": ("STRING", {"default": "X://insert/path/here.npy", "vhs_path_extensions": lut_extensions}),
|
93 |
-
"lut_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
94 |
},
|
95 |
"optional": {
|
96 |
"awb_ref_image": ("IMAGE",),
|
@@ -103,40 +86,43 @@ class NovaNodes:
|
|
103 |
FUNCTION = "process"
|
104 |
CATEGORY = "postprocessing"
|
105 |
|
106 |
-
def process(self, image,
|
107 |
-
|
108 |
-
apply_exif_o=True,
|
109 |
-
noise_std_frac=0.015,
|
110 |
-
hot_pixel_prob=1e-6,
|
111 |
-
perturb_mag_frac=0.008,
|
112 |
clahe_clip=2.0,
|
113 |
clahe_grid=8,
|
|
|
114 |
apply_fourier_o=True,
|
115 |
fourier_strength=0.9,
|
116 |
fourier_randomness=0.05,
|
117 |
fourier_phase_perturb=0.08,
|
118 |
-
fourier_alpha=1.0,
|
119 |
fourier_radial_smooth=5,
|
120 |
fourier_mode="auto",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
apply_vignette_o=True,
|
122 |
-
vignette_strength=0.
|
123 |
apply_chromatic_aberration_o=True,
|
124 |
-
ca_shift=1.
|
125 |
-
apply_banding_o=True,
|
126 |
-
banding_strength=0.5,
|
127 |
-
apply_motion_blur_o=True,
|
128 |
-
motion_blur_ksize=7,
|
129 |
-
apply_jpeg_cycles_o=True,
|
130 |
-
jpeg_cycles=2,
|
131 |
-
jpeg_quality=85,
|
132 |
-
sim_camera=False,
|
133 |
-
enable_bayer=True,
|
134 |
iso_scale=1.0,
|
135 |
read_noise=2.0,
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
if process_image is None:
|
142 |
raise ImportError(f"Could not import process_image function: {IMPORT_ERROR}")
|
@@ -223,14 +209,13 @@ class NovaNodes:
|
|
223 |
motion_blur_kernel=motion_blur_ksize if apply_motion_blur_o else 1,
|
224 |
jpeg_cycles=jpeg_cycles if apply_jpeg_cycles_o else 1,
|
225 |
jpeg_qmin=jpeg_quality,
|
226 |
-
jpeg_qmax=
|
227 |
sim_camera=sim_camera,
|
228 |
no_no_bayer=not enable_bayer, # FIX: Inverted logic corrected
|
229 |
iso_scale=iso_scale,
|
230 |
read_noise=read_noise,
|
231 |
-
seed=None,
|
232 |
-
cutoff=
|
233 |
-
# --- CHANGE 3: Updated logic to check enable_lut toggle ---
|
234 |
lut=(lut if enable_lut and lut != "" else None),
|
235 |
lut_strength=lut_strength,
|
236 |
)
|
|
|
31 |
|
32 |
@classmethod
|
33 |
def INPUT_TYPES(s):
|
34 |
+
# --- MODIFICATION: Rearranged inputs and updated defaults to match the reference image ---
|
35 |
return {
|
36 |
"required": {
|
37 |
"image": ("IMAGE",),
|
38 |
|
39 |
+
# Parameters (Manual Mode) - Order and defaults match the image
|
40 |
+
"noise_std_frac": ("FLOAT", {"default": 0.02, "min": 0.0, "max": 0.1, "step": 0.001}),
|
41 |
+
"clahe_clip": ("FLOAT", {"default": 2.00, "min": 0.5, "max": 10.0, "step": 0.1}),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
"clahe_grid": ("INT", {"default": 8, "min": 2, "max": 32, "step": 1}),
|
43 |
+
"fourier_cutoff": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 1.0, "step": 0.01}),
|
|
|
44 |
"apply_fourier_o": ("BOOLEAN", {"default": True}),
|
45 |
+
"fourier_strength": ("FLOAT", {"default": 0.90, "min": 0.0, "max": 1.0, "step": 0.01}),
|
46 |
"fourier_randomness": ("FLOAT", {"default": 0.05, "min": 0.0, "max": 0.5, "step": 0.01}),
|
47 |
"fourier_phase_perturb": ("FLOAT", {"default": 0.08, "min": 0.0, "max": 0.5, "step": 0.01}),
|
|
|
48 |
"fourier_radial_smooth": ("INT", {"default": 5, "min": 0, "max": 50, "step": 1}),
|
49 |
"fourier_mode": (["auto", "ref", "model"], {"default": "auto"}),
|
50 |
+
"fourier_alpha": ("FLOAT", {"default": 1.00, "min": 0.1, "max": 4.0, "step": 0.1}),
|
51 |
+
"perturb_mag_frac": ("FLOAT", {"default": 0.01, "min": 0.0, "max": 0.05, "step": 0.001}),
|
52 |
+
"enable_awb": ("BOOLEAN", {"default": True}),
|
53 |
+
"sim_camera": ("BOOLEAN", {"default": True}), # This corresponds to "Enable camera pipeline simulation"
|
54 |
+
"enable_lut": ("BOOLEAN", {"default": True}),
|
55 |
+
"lut": ("STRING", {"default": "X://insert/path/here(.png/.npy/.cube)", "vhs_path_extensions": lut_extensions}),
|
56 |
+
"lut_strength": ("FLOAT", {"default": 1.00, "min": 0.0, "max": 1.0, "step": 0.01}),
|
57 |
+
|
58 |
+
# Camera simulator options - Order and defaults match the image
|
59 |
+
"enable_bayer": ("BOOLEAN", {"default": True}),
|
60 |
+
"apply_jpeg_cycles_o": ("BOOLEAN", {"default": True}),
|
61 |
+
"jpeg_cycles": ("INT", {"default": 1, "min": 1, "max": 10, "step": 1}),
|
62 |
+
"jpeg_quality": ("INT", {"default": 88, "min": 10, "max": 100, "step": 1}),
|
63 |
"apply_vignette_o": ("BOOLEAN", {"default": True}),
|
64 |
+
"vignette_strength": ("FLOAT", {"default": 0.35, "min": 0.0, "max": 1.0, "step": 0.01}),
|
|
|
|
|
65 |
"apply_chromatic_aberration_o": ("BOOLEAN", {"default": True}),
|
66 |
+
"ca_shift": ("FLOAT", {"default": 1.20, "min": 0.0, "max": 5.0, "step": 0.1}),
|
67 |
+
"iso_scale": ("FLOAT", {"default": 1.00, "min": 0.1, "max": 16.0, "step": 0.1}),
|
68 |
+
"read_noise": ("FLOAT", {"default": 2.00, "min": 0.0, "max": 50.0, "step": 0.1}),
|
69 |
+
"hot_pixel_prob": ("FLOAT", {"default": 1e-7, "min": 0.0, "max": 1e-3, "step": 1e-7}),
|
70 |
"apply_banding_o": ("BOOLEAN", {"default": True}),
|
71 |
+
"banding_strength": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01}),
|
|
|
|
|
72 |
"apply_motion_blur_o": ("BOOLEAN", {"default": True}),
|
73 |
+
"motion_blur_ksize": ("INT", {"default": 1, "min": 1, "max": 31, "step": 2}),
|
74 |
+
|
75 |
+
# Other options
|
76 |
+
"apply_exif_o": ("BOOLEAN", {"default": True}),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
},
|
78 |
"optional": {
|
79 |
"awb_ref_image": ("IMAGE",),
|
|
|
86 |
FUNCTION = "process"
|
87 |
CATEGORY = "postprocessing"
|
88 |
|
89 |
+
def process(self, image,
|
90 |
+
noise_std_frac=0.02,
|
|
|
|
|
|
|
|
|
91 |
clahe_clip=2.0,
|
92 |
clahe_grid=8,
|
93 |
+
fourier_cutoff=0.25,
|
94 |
apply_fourier_o=True,
|
95 |
fourier_strength=0.9,
|
96 |
fourier_randomness=0.05,
|
97 |
fourier_phase_perturb=0.08,
|
|
|
98 |
fourier_radial_smooth=5,
|
99 |
fourier_mode="auto",
|
100 |
+
fourier_alpha=1.0,
|
101 |
+
perturb_mag_frac=0.01,
|
102 |
+
enable_awb=True,
|
103 |
+
sim_camera=True,
|
104 |
+
enable_lut=True,
|
105 |
+
lut="",
|
106 |
+
lut_strength=1.0,
|
107 |
+
enable_bayer=True,
|
108 |
+
apply_jpeg_cycles_o=True,
|
109 |
+
jpeg_cycles=1,
|
110 |
+
jpeg_quality=88,
|
111 |
apply_vignette_o=True,
|
112 |
+
vignette_strength=0.35,
|
113 |
apply_chromatic_aberration_o=True,
|
114 |
+
ca_shift=1.20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
iso_scale=1.0,
|
116 |
read_noise=2.0,
|
117 |
+
hot_pixel_prob=1e-7,
|
118 |
+
apply_banding_o=True,
|
119 |
+
banding_strength=0.0,
|
120 |
+
apply_motion_blur_o=True,
|
121 |
+
motion_blur_ksize=1,
|
122 |
+
apply_exif_o=True,
|
123 |
+
awb_ref_image=None,
|
124 |
+
fft_ref_image=None
|
125 |
+
):
|
126 |
|
127 |
if process_image is None:
|
128 |
raise ImportError(f"Could not import process_image function: {IMPORT_ERROR}")
|
|
|
209 |
motion_blur_kernel=motion_blur_ksize if apply_motion_blur_o else 1,
|
210 |
jpeg_cycles=jpeg_cycles if apply_jpeg_cycles_o else 1,
|
211 |
jpeg_qmin=jpeg_quality,
|
212 |
+
jpeg_qmax=96, # As per image range
|
213 |
sim_camera=sim_camera,
|
214 |
no_no_bayer=not enable_bayer, # FIX: Inverted logic corrected
|
215 |
iso_scale=iso_scale,
|
216 |
read_noise=read_noise,
|
217 |
+
seed=None, # Seed is not user-configurable in this version
|
218 |
+
cutoff=fourier_cutoff,
|
|
|
219 |
lut=(lut if enable_lut and lut != "" else None),
|
220 |
lut_strength=lut_strength,
|
221 |
)
|