File size: 788 Bytes
5b1575a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import cv2
import numpy as np

def modulo(x, L):
    positive = x > 0
    x = x % L
    x = np.where( ( x == 0) &  positive, L, x)
    return x

def apply_blur(image, kernel_size):
    """Aplica desenfoque gaussiano a la imagen."""
    return cv2.GaussianBlur(image, (kernel_size, kernel_size), 0)

def clip_image(image, correction, sat_factor):
    """Clips image with saturation factor and correction."""
    processed_image = np.power(image, correction) * sat_factor
    clipped_image = np.clip(processed_image, 0, 1)
    return clipped_image

def wrap_image(image, correction, sat_factor):
    """Wraps image with saturation factor and correction."""
    processed_image = np.power(image, 1.0) * sat_factor
    wrapped_image =  modulo(processed_image, 1.0)
    return wrapped_image