Spaces:
Sleeping
Sleeping
Final Bove
Browse files
app.py
CHANGED
|
@@ -22,6 +22,12 @@ 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 = cv.split(lab)
|
| 27 |
+
clahe = cv.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
|
| 28 |
+
l_clahe = clahe.apply(l)
|
| 29 |
+
lab_clahe = cv.merge([l_clahe, a, b])
|
| 30 |
+
img = cv.cvtColor(lab_clahe, cv.COLOR_LAB2BGR)
|
| 31 |
if img is None:
|
| 32 |
raise ValueError("Não foi possível decodificar a imagem.")
|
| 33 |
|