Metadata-Version: 2.4
Name: CaptchaConda
Version: 0.1.0
Summary: Classical image-processing digit-CAPTCHA solver (no ML, no GPU needed). C++ backend + Python shell.
Author: CaptchaConda
License: MIT
Project-URL: Homepage, https://example.com/CaptchaConda
Project-URL: Source, https://example.com/CaptchaConda
Keywords: captcha,ocr,image-processing,digit-recognition,classical-cv
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: C++
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Classifier: Intended Audience :: Developers
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21
Requires-Dist: pillow>=9
Requires-Dist: scipy>=1.7
Requires-Dist: scikit-image>=0.19
Requires-Dist: pybind11>=2.10
Dynamic: license-file

# CaptchaConda

머신러닝 없이 **고전 이미지 처리만으로** 숫자 캡챠를 푸는 솔버. 학습 데이터도, GPU도,
프레임워크도 필요 없다. 매칭 코어는 **C++ 백엔드**로 이식돼 있고, Python은 얇은 껍데기
(전처리·세그멘테이션·오케스트레이션)로 남는다. 각 환경에 맞는 백엔드는 설치 후 한 번만
빌드한다.

## 설치

```bash
pip install CaptchaConda
python -m CaptchaConda init          # 이 환경에 맞게 C++ 백엔드 빌드 (CPU)
# 또는 GPU 환경:
python -m CaptchaConda init --cuda   # nvcc 로 CUDA 백엔드 빌드
```

`init`은 로컬 컴파일러(`c++` 또는 `nvcc`)로 백엔드를 빌드한다. 컴파일러가 없으면
순수 Python 폴백으로 자동 전환된다(동일 결과, 조금 느림).

## 사용

```python
from CaptchaConda import CaptchaConda

device = "cuda"  # 또는 "cpu"
cc = CaptchaConda(devices=device)   # 처음 1회만
cc.init()                            # 처음 1회만 (백엔드 빌드+로드)

print(cc.solve("captcha.png"))       # -> "39825"
print(cc.solve(pil_image, expected_n=5))
```

- `CaptchaConda(devices="cpu"|"cuda")` — 백엔드 종류 선택
- `init(force=False)` — 백엔드 빌드/로드(캐시됨; `force=True`로 재빌드)
- `solve(image, expected_n=None)` — 이미지(경로 또는 PIL) → 숫자 문자열

## 왜 이런 구조인가

- **Python은 그대로 배포** → 이식성. 무거운 계산은 **C++ 백엔드**가 담당.
- 백엔드는 **소스로 배포**되고 `init` 때 각 환경에 맞게 컴파일 → 배포 바이너리 호환성
  문제를 피하고, CUDA가 있으면 GPU 백엔드로 빌드.
- 학습이 없으므로 **모델 파일·GPU·데이터셋 비용이 0**. 필터 데이터(수십 KB)만 동봉.

## 동작 개요

이미지 → 배경 분리 → 숫자 분리 → (C++) 필터 매칭 + 위상 라우팅 + 이중필터 → 시퀀스.
정확도는 타깃 캡챠 분포에 맞춰 동봉 필터를 튜닝할수록 올라간다.
