joao-dutra commited on
Commit
e9815c7
·
verified ·
1 Parent(s): c792c63
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -22,6 +22,13 @@ def process_image_bytes(img_bytes: bytes):
22
  # lê bytes em numpy + OpenCV
23
  nparr = np.frombuffer(img_bytes, np.uint8)
24
  img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
 
 
 
 
 
 
 
25
  if img is None:
26
  raise ValueError("Não foi possível decodificar a imagem.")
27
 
 
22
  # lê bytes em numpy + OpenCV
23
  nparr = np.frombuffer(img_bytes, np.uint8)
24
  img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
25
+ lab = cv.cvtColor(img, cv.COLOR_BGR2LAB)
26
+ l, a, b = cv2.split(lab)
27
+ clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
28
+ l_clahe = clahe.apply(l)
29
+ lab_clahe = cv2.merge([l_clahe, a, b])
30
+ img = cv2.cvtColor(lab_clahe, cv2.COLOR_LAB2BGR)
31
+
32
  if img is None:
33
  raise ValueError("Não foi possível decodificar a imagem.")
34