From 0b107e258d0b6c1a0967bfa8d3e3f2689a99de09 Mon Sep 17 00:00:00 2001 From: suellenvareiroferreiro-rgb Date: Tue, 21 Oct 2025 11:48:19 -0400 Subject: [PATCH] =?UTF-8?q?Create=20Anhandu=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Anhandu\303\255" | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "Anhandu\303\255" diff --git "a/Anhandu\303\255" "b/Anhandu\303\255" new file mode 100644 index 0000000..90df02f --- /dev/null +++ "b/Anhandu\303\255" @@ -0,0 +1,30 @@ +import cv2 +from cv2 import dnn_superres + +# Caminho da imagem original (substitua pelo nome do seu print) +input_path = "mapa_territorial.jpg" +output_path = "mapa_territorial_melhorado.png" + +# --- 1. Carrega a imagem original --- +img = cv2.imread(input_path) + +# --- 2. Cria o super-resolução (aumento de qualidade) --- +sr = dnn_superres.DnnSuperResImpl_create() +path = "EDSR_x4.pb" # modelo de IA (baixar uma vez) +sr.readModel(path) +sr.setModel("edsr", 4) # aumento 4x +upscaled = sr.upsample(img) + +# --- 3. Filtros de nitidez e redução de ruído --- +# Remove ruído leve +denoised = cv2.fastNlMeansDenoisingColored(upscaled, None, 10, 10, 7, 21) + +# Aumenta nitidez +kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3,3)) +sharpened = cv2.filter2D(denoised, -1, + kernel=np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])) + +# --- 4. Salva o resultado em PNG --- +cv2.imwrite(output_path, sharpened) + +print("✅ Imagem melhorada e salva como:", output_path)