imgboost-ai 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imgboost/__init__.py +10 -0
- imgboost/cli.py +169 -0
- imgboost/core.py +162 -0
- imgboost/processors/__init__.py +9 -0
- imgboost/processors/document.py +269 -0
- imgboost/processors/filters.py +257 -0
- imgboost/processors/superres.py +252 -0
- imgboost/utils/__init__.py +7 -0
- imgboost/utils/image_io.py +231 -0
- imgboost_ai-0.1.0.dist-info/METADATA +387 -0
- imgboost_ai-0.1.0.dist-info/RECORD +15 -0
- imgboost_ai-0.1.0.dist-info/WHEEL +5 -0
- imgboost_ai-0.1.0.dist-info/entry_points.txt +2 -0
- imgboost_ai-0.1.0.dist-info/licenses/LICENSE +21 -0
- imgboost_ai-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import cv2
|
|
2
|
+
import numpy as np
|
|
3
|
+
from PIL import Image
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ImageIO:
|
|
8
|
+
"""
|
|
9
|
+
Utilitários para carregar e salvar imagens.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
SUPPORTED_FORMATS = {'.jpg', '.jpeg', '.png', '.bmp', '.tiff', '.tif', '.webp'}
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def load(self, path):
|
|
18
|
+
"""
|
|
19
|
+
Carrega uma imagem de arquivo.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
path: Caminho do arquivo
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
Imagem BGR ou None se falhar
|
|
26
|
+
"""
|
|
27
|
+
path = Path(path)
|
|
28
|
+
|
|
29
|
+
if not path.exists():
|
|
30
|
+
raise FileNotFoundError(f"Arquivo não encontrado: {path}")
|
|
31
|
+
|
|
32
|
+
if path.suffix.lower() not in self.SUPPORTED_FORMATS:
|
|
33
|
+
raise ValueError(f"Formato não suportado: {path.suffix}")
|
|
34
|
+
|
|
35
|
+
# Tentar carregar com OpenCV primeiro
|
|
36
|
+
img = cv2.imread(str(path), cv2.IMREAD_COLOR)
|
|
37
|
+
|
|
38
|
+
if img is None:
|
|
39
|
+
# Fallback para PIL
|
|
40
|
+
try:
|
|
41
|
+
pil_img = Image.open(path)
|
|
42
|
+
img = np.array(pil_img)
|
|
43
|
+
|
|
44
|
+
# Converter RGB para BGR se necessário
|
|
45
|
+
if len(img.shape) == 3 and img.shape[2] == 3:
|
|
46
|
+
img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
|
|
47
|
+
elif len(img.shape) == 3 and img.shape[2] == 4:
|
|
48
|
+
# RGBA para BGR
|
|
49
|
+
img = cv2.cvtColor(img, cv2.COLOR_RGBA2BGR)
|
|
50
|
+
|
|
51
|
+
except Exception as e:
|
|
52
|
+
raise IOError(f"Erro ao carregar imagem: {e}")
|
|
53
|
+
|
|
54
|
+
return img
|
|
55
|
+
|
|
56
|
+
def save(self, img, path, quality=95):
|
|
57
|
+
"""
|
|
58
|
+
Salva uma imagem em arquivo.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
img: Imagem BGR
|
|
62
|
+
path: Caminho de destino
|
|
63
|
+
quality: Qualidade JPEG (1-100)
|
|
64
|
+
"""
|
|
65
|
+
path = Path(path)
|
|
66
|
+
|
|
67
|
+
# Criar diretório se não existir
|
|
68
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
69
|
+
|
|
70
|
+
# Parâmetros de salvamento
|
|
71
|
+
params = []
|
|
72
|
+
|
|
73
|
+
if path.suffix.lower() in {'.jpg', '.jpeg'}:
|
|
74
|
+
# JPEG
|
|
75
|
+
params = [cv2.IMWRITE_JPEG_QUALITY, quality]
|
|
76
|
+
elif path.suffix.lower() == '.png':
|
|
77
|
+
# PNG - comprimir mas manter qualidade
|
|
78
|
+
compression = int((100 - quality) / 10)
|
|
79
|
+
params = [cv2.IMWRITE_PNG_COMPRESSION, min(compression, 9)]
|
|
80
|
+
elif path.suffix.lower() == '.webp':
|
|
81
|
+
# WebP
|
|
82
|
+
params = [cv2.IMWRITE_WEBP_QUALITY, quality]
|
|
83
|
+
|
|
84
|
+
# Salvar
|
|
85
|
+
success = cv2.imwrite(str(path), img, params)
|
|
86
|
+
|
|
87
|
+
if not success:
|
|
88
|
+
raise IOError(f"Erro ao salvar imagem: {path}")
|
|
89
|
+
|
|
90
|
+
def load_batch(self, directory, pattern='*'):
|
|
91
|
+
"""
|
|
92
|
+
Carrega múltiplas imagens de um diretório.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
directory: Diretório de origem
|
|
96
|
+
pattern: Padrão de busca (ex: '*.jpg')
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Lista de tuplas (path, imagem)
|
|
100
|
+
"""
|
|
101
|
+
directory = Path(directory)
|
|
102
|
+
|
|
103
|
+
if not directory.is_dir():
|
|
104
|
+
raise NotADirectoryError(f"Não é um diretório: {directory}")
|
|
105
|
+
|
|
106
|
+
images = []
|
|
107
|
+
|
|
108
|
+
for file_path in directory.glob(pattern):
|
|
109
|
+
if file_path.suffix.lower() in self.SUPPORTED_FORMATS:
|
|
110
|
+
try:
|
|
111
|
+
img = self.load(file_path)
|
|
112
|
+
if img is not None:
|
|
113
|
+
images.append((str(file_path), img))
|
|
114
|
+
except Exception as e:
|
|
115
|
+
print(f"Erro ao carregar {file_path}: {e}")
|
|
116
|
+
|
|
117
|
+
return images
|
|
118
|
+
|
|
119
|
+
def get_image_info(self, path):
|
|
120
|
+
"""
|
|
121
|
+
Obtém informações sobre uma imagem sem carregar completamente.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
path: Caminho da imagem
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Dicionário com informações
|
|
128
|
+
"""
|
|
129
|
+
path = Path(path)
|
|
130
|
+
|
|
131
|
+
if not path.exists():
|
|
132
|
+
raise FileNotFoundError(f"Arquivo não encontrado: {path}")
|
|
133
|
+
|
|
134
|
+
try:
|
|
135
|
+
pil_img = Image.open(path)
|
|
136
|
+
|
|
137
|
+
info = {
|
|
138
|
+
'format': pil_img.format,
|
|
139
|
+
'mode': pil_img.mode,
|
|
140
|
+
'width': pil_img.width,
|
|
141
|
+
'height': pil_img.height,
|
|
142
|
+
'size_mb': path.stat().st_size / (1024 * 1024),
|
|
143
|
+
'path': str(path),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# Calcular megapixels
|
|
147
|
+
info['megapixels'] = (pil_img.width * pil_img.height) / 1_000_000
|
|
148
|
+
|
|
149
|
+
pil_img.close()
|
|
150
|
+
|
|
151
|
+
return info
|
|
152
|
+
|
|
153
|
+
except Exception as e:
|
|
154
|
+
raise IOError(f"Erro ao ler informações: {e}")
|
|
155
|
+
|
|
156
|
+
def convert_format(self, input_path, output_path, quality=95):
|
|
157
|
+
"""
|
|
158
|
+
Converte formato de imagem.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
input_path: Caminho de entrada
|
|
162
|
+
output_path: Caminho de saída
|
|
163
|
+
quality: Qualidade (para formatos com perda)
|
|
164
|
+
"""
|
|
165
|
+
img = self.load(input_path)
|
|
166
|
+
self.save(img, output_path, quality=quality)
|
|
167
|
+
|
|
168
|
+
def validate_image(self, path):
|
|
169
|
+
"""
|
|
170
|
+
Valida se o arquivo é uma imagem válida.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
path: Caminho do arquivo
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
True se válido, False caso contrário
|
|
177
|
+
"""
|
|
178
|
+
try:
|
|
179
|
+
path = Path(path)
|
|
180
|
+
|
|
181
|
+
if not path.exists():
|
|
182
|
+
return False
|
|
183
|
+
|
|
184
|
+
if path.suffix.lower() not in self.SUPPORTED_FORMATS:
|
|
185
|
+
return False
|
|
186
|
+
|
|
187
|
+
# Tentar abrir
|
|
188
|
+
img = cv2.imread(str(path))
|
|
189
|
+
|
|
190
|
+
if img is None:
|
|
191
|
+
pil_img = Image.open(path)
|
|
192
|
+
pil_img.verify()
|
|
193
|
+
pil_img.close()
|
|
194
|
+
|
|
195
|
+
return True
|
|
196
|
+
|
|
197
|
+
except Exception:
|
|
198
|
+
return False
|
|
199
|
+
|
|
200
|
+
def resize_if_needed(self, img, max_size=4096):
|
|
201
|
+
"""
|
|
202
|
+
Redimensiona imagem se exceder tamanho máximo.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
img: Imagem BGR
|
|
206
|
+
max_size: Dimensão máxima permitida
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
Imagem redimensionada se necessário
|
|
210
|
+
"""
|
|
211
|
+
height, width = img.shape[:2]
|
|
212
|
+
|
|
213
|
+
if max(height, width) <= max_size:
|
|
214
|
+
return img
|
|
215
|
+
|
|
216
|
+
# Calcular nova dimensão
|
|
217
|
+
if height > width:
|
|
218
|
+
new_height = max_size
|
|
219
|
+
new_width = int(width * (max_size / height))
|
|
220
|
+
else:
|
|
221
|
+
new_width = max_size
|
|
222
|
+
new_height = int(height * (max_size / width))
|
|
223
|
+
|
|
224
|
+
# Redimensionar
|
|
225
|
+
resized = cv2.resize(
|
|
226
|
+
img,
|
|
227
|
+
(new_width, new_height),
|
|
228
|
+
interpolation=cv2.INTER_AREA
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
return resized
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: imgboost-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Melhore a qualidade de imagens com IA - Processamento avançado para documentos, screenshots e fotos
|
|
5
|
+
Home-page: https://github.com/yourusername/imgboost
|
|
6
|
+
Author: ImgBoost Team
|
|
7
|
+
Author-email: João Pedro Silva <jpedrops092@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/JPEDROPS092/imgboost
|
|
10
|
+
Project-URL: Documentation, https://github.com/JPEDROPS092/imgboost#readme
|
|
11
|
+
Project-URL: Repository, https://github.com/JPEDROPS092/imgboost
|
|
12
|
+
Project-URL: Issues, https://github.com/JPEDROPS092/imgboost/issues
|
|
13
|
+
Keywords: image,processing,ai,enhancement,super-resolution,ocr,document
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: opencv-python>=4.8.0
|
|
29
|
+
Requires-Dist: numpy>=1.24.0
|
|
30
|
+
Requires-Dist: Pillow>=10.0.0
|
|
31
|
+
Requires-Dist: click>=8.1.0
|
|
32
|
+
Requires-Dist: scikit-image>=0.21.0
|
|
33
|
+
Requires-Dist: tqdm>=4.65.0
|
|
34
|
+
Requires-Dist: torch>=2.0.0
|
|
35
|
+
Requires-Dist: torchvision>=0.15.0
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
40
|
+
Dynamic: author
|
|
41
|
+
Dynamic: home-page
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
Dynamic: requires-python
|
|
44
|
+
|
|
45
|
+
# 🚀 ImgBoost
|
|
46
|
+
|
|
47
|
+
Biblioteca CLI profissional para melhorar qualidade de imagens usando IA e técnicas avançadas de processamento.
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
## ✨ Características
|
|
53
|
+
|
|
54
|
+
- 🎯 **4 Modos especializados** de processamento
|
|
55
|
+
- 🔧 **Denoise inteligente** com OpenCV
|
|
56
|
+
- 📈 **CLAHE** para melhoria de contraste adaptativo
|
|
57
|
+
- ✂️ **Sharpening** profissional
|
|
58
|
+
- 🌙 **Modo Dark UI** otimizado para interfaces escuras
|
|
59
|
+
- 📄 **Modo Texto/OCR** para documentos
|
|
60
|
+
- 🚀 **Super-resolução** com upscaling de alta qualidade
|
|
61
|
+
- ⚡ **Processamento em lote** com suporte a paralelização
|
|
62
|
+
- 💾 **Múltiplos formatos** (PNG, JPG, BMP, TIFF, WebP)
|
|
63
|
+
|
|
64
|
+
## 📦 Instalação
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Clone o repositório
|
|
68
|
+
git clone https://github.com/jpedrops092/imgboost.git
|
|
69
|
+
cd imgboost
|
|
70
|
+
|
|
71
|
+
# Instale em modo desenvolvimento
|
|
72
|
+
pip install -e .
|
|
73
|
+
|
|
74
|
+
# Ou instale as dependências manualmente
|
|
75
|
+
pip install -r requirements.txt
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Dependências
|
|
79
|
+
|
|
80
|
+
- Python >= 3.8
|
|
81
|
+
- OpenCV >= 4.8.0
|
|
82
|
+
- NumPy >= 1.24.0
|
|
83
|
+
- Click >= 8.1.0
|
|
84
|
+
- scikit-image >= 0.21.0
|
|
85
|
+
- tqdm >= 4.66.0
|
|
86
|
+
- PyTorch >= 2.0.0 (opcional, para super-resolução com IA)
|
|
87
|
+
|
|
88
|
+
## 🎯 Uso Rápido
|
|
89
|
+
|
|
90
|
+
### Modo Geral (melhoria padrão)
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
imgboost process foto.jpg
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Modo Texto/Documento (OCR)
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
imgboost process documento.png --mode text
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Modo Dark UI (WhatsApp, interfaces escuras)
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
imgboost process screenshot_whatsapp.png --mode dark
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Super-resolução (upscale 2x)
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
imgboost process imagem_baixa_res.jpg --mode superres
|
|
112
|
+
# Ou adicionar upscale a qualquer modo:
|
|
113
|
+
imgboost process foto.jpg --mode general --upscale
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Processar diretório inteiro
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
imgboost process ./minhas_fotos --mode general --output ./melhoradas
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Processamento em lote (paralelo)
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
imgboost batch ./minhas_fotos --workers 8
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 📋 Modos de Processamento
|
|
129
|
+
|
|
130
|
+
### 1. **General** (Padrão)
|
|
131
|
+
Melhoria geral balanceada:
|
|
132
|
+
- Denoise (redução de ruído)
|
|
133
|
+
- CLAHE (contraste adaptativo)
|
|
134
|
+
- Sharpening (nitidez)
|
|
135
|
+
|
|
136
|
+
**Ideal para:** Fotos gerais, prints, screenshots
|
|
137
|
+
|
|
138
|
+
### 2. **Text** (Texto/Documento)
|
|
139
|
+
Otimizado para leitura e OCR:
|
|
140
|
+
- Denoise focado
|
|
141
|
+
- Binarização adaptativa
|
|
142
|
+
- Deskew (correção de inclinação)
|
|
143
|
+
- Remoção de sombras
|
|
144
|
+
|
|
145
|
+
**Ideal para:** Documentos escaneados, fotos de papel, notas
|
|
146
|
+
|
|
147
|
+
### 3. **Dark** (Interfaces Escuras)
|
|
148
|
+
Otimizado para UIs com fundo escuro:
|
|
149
|
+
- Ajuste de gamma
|
|
150
|
+
- CLAHE agressivo
|
|
151
|
+
- Denoise seletivo
|
|
152
|
+
- Realce de texto em fundos escuros
|
|
153
|
+
|
|
154
|
+
**Ideal para:** WhatsApp Dark, apps com tema escuro, capturas noturnas
|
|
155
|
+
|
|
156
|
+
### 4. **Superres** (Super-resolução)
|
|
157
|
+
Upscaling com preservação de qualidade:
|
|
158
|
+
- Denoise pré-processamento
|
|
159
|
+
- Upscale 2x com LANCZOS4
|
|
160
|
+
- Unsharp mask pós-processamento
|
|
161
|
+
- Realce de textura
|
|
162
|
+
|
|
163
|
+
**Ideal para:** Imagens de baixa resolução, ampliação para impressão
|
|
164
|
+
|
|
165
|
+
## ⚙️ Opções Avançadas
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
imgboost process imagem.jpg \
|
|
169
|
+
--mode general \
|
|
170
|
+
--output ./output \
|
|
171
|
+
--upscale \
|
|
172
|
+
--quality 95 \
|
|
173
|
+
--format png \
|
|
174
|
+
--denoise-strength 15 \
|
|
175
|
+
--contrast 4.0 \
|
|
176
|
+
--sharpen \
|
|
177
|
+
--verbose
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Parâmetros
|
|
181
|
+
|
|
182
|
+
- `--output, -o`: Pasta de saída (padrão: `output`)
|
|
183
|
+
- `--mode, -m`: Modo de processamento (`general`, `text`, `dark`, `superres`)
|
|
184
|
+
- `--upscale, -u`: Aplicar super-resolução 2x
|
|
185
|
+
- `--quality, -q`: Qualidade JPEG 1-100 (padrão: 95)
|
|
186
|
+
- `--format, -f`: Formato de saída (`auto`, `png`, `jpg`)
|
|
187
|
+
- `--denoise-strength, -d`: Força do denoise 0-30 (padrão: 10)
|
|
188
|
+
- `--contrast, -c`: Intensidade CLAHE 1.0-5.0 (padrão: 3.0)
|
|
189
|
+
- `--sharpen, -s`: Aplicar sharpening extra
|
|
190
|
+
- `--verbose, -v`: Modo verboso
|
|
191
|
+
|
|
192
|
+
## 📊 Exemplos Práticos
|
|
193
|
+
|
|
194
|
+
### Melhorar print de WhatsApp escuro
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
imgboost process whatsapp_dark.png --mode dark --sharpen --quality 100
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Preparar documento para OCR
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
imgboost process documento_foto.jpg --mode text --format png --output ./ocr
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Upscale de imagem para impressão
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
imgboost process logo_pequeno.png --mode superres --quality 100 --format png
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Processar pasta de fotos antigas
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
imgboost process ./fotos_antigas --mode general --upscale --denoise-strength 20
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Lote em paralelo (rápido)
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
imgboost batch ./muitas_fotos --workers 8
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## 🔧 Uso Programático
|
|
225
|
+
|
|
226
|
+
Você também pode usar o ImgBoost como biblioteca Python:
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from imgboost import Engine
|
|
230
|
+
|
|
231
|
+
# Criar engine
|
|
232
|
+
engine = Engine(
|
|
233
|
+
output_dir='output',
|
|
234
|
+
quality=95,
|
|
235
|
+
denoise_strength=10,
|
|
236
|
+
contrast_clip=3.0
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
# Processar imagem
|
|
240
|
+
output_path = engine.run(
|
|
241
|
+
'input.jpg',
|
|
242
|
+
mode='general',
|
|
243
|
+
upscale=True
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
print(f"Imagem salva em: {output_path}")
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Processamento customizado
|
|
250
|
+
|
|
251
|
+
```python
|
|
252
|
+
from imgboost.processors import ImageFilters, SuperResolution
|
|
253
|
+
from imgboost.utils import ImageIO
|
|
254
|
+
|
|
255
|
+
# Carregar
|
|
256
|
+
io = ImageIO()
|
|
257
|
+
img = io.load('input.jpg')
|
|
258
|
+
|
|
259
|
+
# Processar
|
|
260
|
+
filters = ImageFilters(denoise_strength=15)
|
|
261
|
+
img = filters.denoise(img)
|
|
262
|
+
img = filters.enhance_contrast(img)
|
|
263
|
+
img = filters.sharpen(img)
|
|
264
|
+
|
|
265
|
+
# Upscale
|
|
266
|
+
sr = SuperResolution()
|
|
267
|
+
img = sr.upscale(img, scale=2)
|
|
268
|
+
|
|
269
|
+
# Salvar
|
|
270
|
+
io.save(img, 'output.jpg', quality=95)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 📚 Informações do Sistema
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
imgboost info
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Mostra:
|
|
280
|
+
- Versão do ImgBoost
|
|
281
|
+
- Versões das dependências
|
|
282
|
+
- Disponibilidade de CUDA
|
|
283
|
+
- Modos disponíveis
|
|
284
|
+
|
|
285
|
+
## 🛠️ Desenvolvimento
|
|
286
|
+
|
|
287
|
+
### Estrutura do Projeto
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
imgboost/
|
|
291
|
+
├── imgboost/
|
|
292
|
+
│ ├── __init__.py
|
|
293
|
+
│ ├── cli.py # Interface CLI
|
|
294
|
+
│ ├── core.py # Engine principal
|
|
295
|
+
│ ├── processors/
|
|
296
|
+
│ │ ├── filters.py # Filtros OpenCV
|
|
297
|
+
│ │ ├── document.py # Processamento de documentos
|
|
298
|
+
│ │ └── superres.py # Super-resolução
|
|
299
|
+
│ └── utils/
|
|
300
|
+
│ └── image_io.py # I/O de imagens
|
|
301
|
+
├── setup.py
|
|
302
|
+
├── requirements.txt
|
|
303
|
+
└── README.md
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Adicionar novos processadores
|
|
307
|
+
|
|
308
|
+
1. Crie um arquivo em `imgboost/processors/`
|
|
309
|
+
2. Implemente sua classe de processamento
|
|
310
|
+
3. Importe em `imgboost/processors/__init__.py`
|
|
311
|
+
4. Use no `core.py`
|
|
312
|
+
|
|
313
|
+
### Executar testes
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Teste básico
|
|
317
|
+
imgboost process test_image.jpg --verbose
|
|
318
|
+
|
|
319
|
+
# Teste de lote
|
|
320
|
+
imgboost batch test_images/ --workers 4
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## 🎓 Técnicas Implementadas
|
|
324
|
+
|
|
325
|
+
### Denoise
|
|
326
|
+
- **Fast Non-Local Means**: Preserva bordas enquanto remove ruído
|
|
327
|
+
- Força ajustável (0-30)
|
|
328
|
+
|
|
329
|
+
### Contraste
|
|
330
|
+
- **CLAHE**: Histogram equalization adaptativo
|
|
331
|
+
- Evita sobre-saturação
|
|
332
|
+
- Tile grid 8x8
|
|
333
|
+
|
|
334
|
+
### Sharpening
|
|
335
|
+
- **Unsharp Mask**: Sharpening profissional
|
|
336
|
+
- **Kernel customizado**: Controle de intensidade
|
|
337
|
+
- Preserva naturalidade
|
|
338
|
+
|
|
339
|
+
### Super-resolução
|
|
340
|
+
- **LANCZOS4**: Interpolação de alta qualidade
|
|
341
|
+
- **Multi-scale**: Preservação de detalhes
|
|
342
|
+
- **Texture enhancement**: Realce de texturas
|
|
343
|
+
|
|
344
|
+
### Processamento de Documentos
|
|
345
|
+
- **Adaptive Thresholding**: Binarização inteligente
|
|
346
|
+
- **Deskew**: Correção de inclinação
|
|
347
|
+
- **Shadow removal**: Remoção de sombras
|
|
348
|
+
- **Morphological operations**: Limpeza de ruído
|
|
349
|
+
|
|
350
|
+
## 🚀 Próximos Passos
|
|
351
|
+
|
|
352
|
+
- [ ] Integração com Real-ESRGAN para super-resolução com IA
|
|
353
|
+
- [ ] Suporte a vídeos
|
|
354
|
+
- [ ] Processamento de PDFs
|
|
355
|
+
- [ ] Interface web
|
|
356
|
+
- [ ] Presets customizáveis
|
|
357
|
+
- [ ] Batch processing com GPU
|
|
358
|
+
- [ ] Plugin para Photoshop/GIMP
|
|
359
|
+
|
|
360
|
+
## 📄 Licença
|
|
361
|
+
|
|
362
|
+
MIT License - veja LICENSE para detalhes
|
|
363
|
+
|
|
364
|
+
## 🤝 Contribuindo
|
|
365
|
+
|
|
366
|
+
Contribuições são bem-vindas! Por favor:
|
|
367
|
+
|
|
368
|
+
1. Fork o projeto
|
|
369
|
+
2. Crie uma branch para sua feature (`git checkout -b feature/AmazingFeature`)
|
|
370
|
+
3. Commit suas mudanças (`git commit -m 'Add some AmazingFeature'`)
|
|
371
|
+
4. Push para a branch (`git push origin feature/AmazingFeature`)
|
|
372
|
+
5. Abra um Pull Request
|
|
373
|
+
|
|
374
|
+
## 📧 Suporte
|
|
375
|
+
|
|
376
|
+
- 🐛 **Issues**: [GitHub Issues](https://github.com/jpedrops092/imgboost/issues)
|
|
377
|
+
- 💬 **Discussões**: [GitHub Discussions](https://github.com/jpedrops092/imgboost/discussions)
|
|
378
|
+
|
|
379
|
+
## 🌟 Agradecimentos
|
|
380
|
+
|
|
381
|
+
- OpenCV pela biblioteca de processamento de imagens
|
|
382
|
+
- Real-ESRGAN pela inspiração em super-resolução
|
|
383
|
+
- Click pela excelente biblioteca CLI
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
Feito com ❤️ por ImgBoost Team
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
imgboost/__init__.py,sha256=f7asSpI1tSmnODKo-1a8AyZt0vjVk3FBZ_cquTbUkas,169
|
|
2
|
+
imgboost/cli.py,sha256=0F8R7MUJ4S_Yo9RrD-a0uIDoGrNS5wNZlvWwPtIYx6M,6285
|
|
3
|
+
imgboost/core.py,sha256=KCj-m5qfQE39qdvis-Y-BLR6YQkZ3_NxaIA-cMURJUQ,5510
|
|
4
|
+
imgboost/processors/__init__.py,sha256=C1dcg4ies5KA2xwnZaT827WoNoEK69JrUXCjf2oS2B4,234
|
|
5
|
+
imgboost/processors/document.py,sha256=_vSaNVZ1ICzFfsb_b2qddtLtnCJ9e_DPyNE8FVTBkbU,7739
|
|
6
|
+
imgboost/processors/filters.py,sha256=TVgAy0b6SI3xmQRjcMrw2fnIm4hvS4WDO5d6kehXY3Q,7332
|
|
7
|
+
imgboost/processors/superres.py,sha256=-dtuURGM2Q8GC0oSAm8c5UJ6Za_gfyjMnHO6qRoXKOg,7697
|
|
8
|
+
imgboost/utils/__init__.py,sha256=9PDSxEq549702TVbUMtAgI_98NbGz2Ftal1SDtABfqw,94
|
|
9
|
+
imgboost/utils/image_io.py,sha256=Io_xTJ8yiJJgPCRgn0QwGqAVBpfXHgZpvoVGHzmLqKM,6787
|
|
10
|
+
imgboost_ai-0.1.0.dist-info/licenses/LICENSE,sha256=xWKsKcIRX-JUGCEHuGB-VwHNPyDB6EdKqzXeZ29W__M,1070
|
|
11
|
+
imgboost_ai-0.1.0.dist-info/METADATA,sha256=y2VqESvc9DZPMj6vniIPIUWBstHZHxdHKI5DAbWNqWw,10135
|
|
12
|
+
imgboost_ai-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
imgboost_ai-0.1.0.dist-info/entry_points.txt,sha256=TZcqC8QOrXU1GBHnHQrTsOm4_I78DMPYiUwgQ6AxRng,46
|
|
14
|
+
imgboost_ai-0.1.0.dist-info/top_level.txt,sha256=SBl9I-TbzqywBCI8IdcZ8FRtHBZqmMoAVaK_syFJ87c,9
|
|
15
|
+
imgboost_ai-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ImgBoost Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
imgboost
|