fffiloni commited on
Commit
95cb277
·
verified ·
1 Parent(s): 501be52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -28,9 +28,23 @@ matrices = {
28
  'dubois': [
29
  [0.456, 0.5, 0.176, -0.04, -0.038, -0.016, -0.015, -0.021, -0.005], # Left image
30
  [-0.043, -0.088, -0.002, 0.378, 0.734, -0.018, -0.072, -0.113, 1.226] # Right image
 
 
 
 
31
  ]
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
34
  def make_anaglyph(left_img, right_img, color_method):
35
  """Generate an anaglyph from left and right images using the specified color method"""
36
  if left_img is None or right_img is None:
@@ -146,7 +160,7 @@ with gr.Blocks(css=css) as app:
146
  )
147
 
148
  color_method = gr.Radio(
149
- ["optimized", "true", "mono", "color", "halfcolor", "dubois"],
150
  label="Color Method",
151
  value="optimized",
152
  info="Select the color processing method"
 
28
  'dubois': [
29
  [0.456, 0.5, 0.176, -0.04, -0.038, -0.016, -0.015, -0.021, -0.005], # Left image
30
  [-0.043, -0.088, -0.002, 0.378, 0.734, -0.018, -0.072, -0.113, 1.226] # Right image
31
+ ],
32
+ 'dubois_optimized': [
33
+ [0.4561, 0.500484, 0.176381, -0.400822, -0.0378246, -0.0157589, -0.0152161, -0.0205971, -0.00546856],
34
+ [-0.0434706, -0.0879388, -0.00155529, 0.378476, 0.73364, -0.0184503, -0.0721527, -0.112961, 1.2264]
35
  ]
36
  }
37
 
38
+ const mat3 left_filter = mat3(
39
+ vec3(0.4561, 0.500484, 0.176381),
40
+ vec3(-0.400822, -0.0378246, -0.0157589),
41
+ vec3(-0.0152161, -0.0205971, -0.00546856));
42
+
43
+ const mat3 right_filter = mat3(
44
+ vec3(-0.0434706, -0.0879388, -0.00155529),
45
+ vec3(0.378476, 0.73364, -0.0184503),
46
+ vec3(-0.0721527, -0.112961, 1.2264));
47
+
48
  def make_anaglyph(left_img, right_img, color_method):
49
  """Generate an anaglyph from left and right images using the specified color method"""
50
  if left_img is None or right_img is None:
 
160
  )
161
 
162
  color_method = gr.Radio(
163
+ ["optimized", "true", "mono", "color", "halfcolor", "dubois", "dubois_optimized"],
164
  label="Color Method",
165
  value="optimized",
166
  info="Select the color processing method"