kebincontreras commited on
Commit
5b1575a
·
verified ·
1 Parent(s): d370a77

Update Scripts/image_processing.py

Browse files
Files changed (1) hide show
  1. Scripts/image_processing.py +26 -27
Scripts/image_processing.py CHANGED
@@ -1,27 +1,26 @@
1
-
2
- import cv2
3
- import numpy as np
4
-
5
- def modulo(x, L):
6
- positive = x > 0
7
- x = x % L
8
- x = np.where( ( x == 0) & positive, L, x)
9
- return x
10
-
11
- def apply_blur(image, kernel_size):
12
- """Aplica desenfoque gaussiano a la imagen."""
13
- return cv2.GaussianBlur(image, (kernel_size, kernel_size), 0)
14
-
15
- def clip_image(image, correction, sat_factor):
16
- """Clips image with saturation factor and correction."""
17
- processed_image = np.power(image, correction) * sat_factor
18
- clipped_image = np.clip(processed_image, 0, 1)
19
- return clipped_image
20
-
21
- def wrap_image(image, correction, sat_factor):
22
- """Wraps image with saturation factor and correction."""
23
- processed_image = np.power(image, 1.0) * sat_factor
24
- wrapped_image = modulo(processed_image, 1.0)
25
- return wrapped_image
26
-
27
-
 
1
+ import cv2
2
+ import numpy as np
3
+
4
+ def modulo(x, L):
5
+ positive = x > 0
6
+ x = x % L
7
+ x = np.where( ( x == 0) & positive, L, x)
8
+ return x
9
+
10
+ def apply_blur(image, kernel_size):
11
+ """Aplica desenfoque gaussiano a la imagen."""
12
+ return cv2.GaussianBlur(image, (kernel_size, kernel_size), 0)
13
+
14
+ def clip_image(image, correction, sat_factor):
15
+ """Clips image with saturation factor and correction."""
16
+ processed_image = np.power(image, correction) * sat_factor
17
+ clipped_image = np.clip(processed_image, 0, 1)
18
+ return clipped_image
19
+
20
+ def wrap_image(image, correction, sat_factor):
21
+ """Wraps image with saturation factor and correction."""
22
+ processed_image = np.power(image, 1.0) * sat_factor
23
+ wrapped_image = modulo(processed_image, 1.0)
24
+ return wrapped_image
25
+
26
+