# AntiCAP **Repository Path**: NewArk81/AntiCAP ## Basic Information - **Project Name**: AntiCAP - **Description**: No description available - **Primary Language**: Python - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2025-04-06 - **Last Updated**: 2026-01-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
# AntiCAP
Version:3.3.5
识别率随缘,全靠内置模型和算法
| 类型 | 状态 | 描述 |
|------------|-|--------------------------------------------|
| `OCR识别` |✅| 返回图片字符串 |
| `数学计算` |✅| 返回计算结果 |
| `缺口滑块` |✅| 返回坐标 |
| `阴影滑块` |✅| 返回坐标 |
| `图标点选` |✅| 侦测图标位置 或 按序返回坐标 |
| `文字点选` |✅| 侦测文字位置 或 按序返回坐标 |
| `相似对比` |✅| 图片中文字的相似度对比 |
| `双图旋转验证码` |✅| 返回角度 |
| `单图旋转验证码` |✅| 返回角度 |
| `WebApi服务` | ✅ | https://github.com/81NewArk/AntiCAP-WebApi |
```python
# example.py
import base64
import AntiCAP
with open("captcha.jpg", "rb") as img_file:
img_base64 = base64.b64encode(img_file.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.OCR(img_base64=img_base64) #传入图片Base64编码字符串
print(result) # 返回字符串 jepy
```
---
### 2. 算术验证码识别
#### 参考例图 (加减乘除)
```python
# example.py
import base64
import AntiCAP
with open("captcha.jpg", "rb") as img_file:
img_base64 = base64.b64encode(img_file.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.Math(img_base64=img_base64) #传入图片Base64编码字符串
print(result) #返回计算结果 8
```
---
### 3. 图标侦测
#### 参考例图
```python
# example.py
import base64
import AntiCAP
with open("captcha.jpg", "rb") as img_file:
img_base64 = base64.b64encode(img_file.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.Detection_Icon(img_base64=img_base64) #传入图片Base64编码字符串
print(result)
# [{'class': 'icon', 'box': [9.12, 105.4, 111.73, 223.02]}...]
# box分别为 [x1, y1, x2, y2] 左上角和右下角坐标
```
---
### 4. 文字侦测
#### 参考例图
```python
# example.py
import base64
import AntiCAP
with open("captcha.jpg", "rb") as img_file:
img_base64 = base64.b64encode(img_file.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.Detection_Text(img_base64=img_base64) #传入图片Base64编码字符串
print(result)
# [{'class': 'Text', 'box': [145.71, 19.21, 223.99, 95.7]}...]
# box分别为 [x1, y1, x2, y2] 左上角和右下角坐标
```
---
### 5. 图标点选类
#### 提示图
#### 目标图片
```python
# example.py
import base64
import AntiCAP
with open("order_image.jpg", "rb") as f:
order_img_base64 = base64.b64encode(f.read()).decode('utf-8')
# 读取目标图(所有图标)并转为 base64
with open("target_image.jpg", "rb") as f:
target_img_base64 = base64.b64encode(f.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.ClickIcon_Order(
order_img_base64=order_img_base64,
target_img_base64=target_img_base64
)
print(result)
```
---
### 6. 文字点选类
#### 提示图
#### 目标图片
```python
# example.py
import base64
import AntiCAP
with open("order_image.jpg", "rb") as f:
order_img_base64 = base64.b64encode(f.read()).decode('utf-8')
# 读取目标图(所有图标)并转为 base64
with open("target_image.jpg", "rb") as f:
target_img_base64 = base64.b64encode(f.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.ClickText_Order(
order_img_base64=order_img_base64,
target_img_base64=target_img_base64
)
print(result)
```
---
### 7. 缺口滑块类
#### 缺口图
#### 背景图
```python
# example.py
import base64
import AntiCAP
# 读取滑块图片(小块)
with open("slider.png", "rb") as f:
target_base64 = base64.b64encode(f.read()).decode('utf-8')
# 读取背景图片(带缺口的大图)
with open("background.jpg", "rb") as f:
background_base64 = base64.b64encode(f.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.Slider_Match(target_base64=target_base64,
background_base64=background_base64
)
print(result)
```
---
### 8. 阴影滑块类
#### 目标图片
#### 背景图片
```python
# example.py
import base64
import AntiCAP
# 读取滑块图片(小块)
with open("target.jpg", "rb") as f:
target_base64 = base64.b64encode(f.read()).decode('utf-8')
# 读取背景图片(带缺口的大图)
with open("background.jpg", "rb") as f:
background_base64 = base64.b64encode(f.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.Slider_Match(target_base64=target_base64,
background_base64=background_base64
)
print(result)
```
---
### 9. 相似度对比
#### 图片1
#### 图片2
```python
# example.py
import base64
import AntiCAP
with open("image1.jpg", "rb") as f:
image1_base64 = base64.b64encode(f.read()).decode('utf-8')
with open("image2.jpg", "rb") as f:
image2_base64 = base64.b64encode(f.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result = Atc.Compare_Image_Similarity(image1_base64=image1_base64, image2_base64=image2_base64)
print("相似度结果:", result)
```
### 10. 双图旋转类验证码
#### 内圈
#### 外圈
```python
# example.py
import base64
import AntiCAP
with open("inside.jpg", "rb") as f:
inside_base64 = base64.b64encode(f.read()).decode('utf-8')
with open("outside.jpg", "rb") as f:
outside_base64 = base64.b64encode(f.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result= Atc.Double_Rotate(inside_base64=inside_base64, outside_base64=outside_base64)
print(result)
# {'similarity': 0.6651270985603333, 'inner_angle': 75.5, 'raw_angle': 151}
```
### 11. 单图旋转类验证码
#### 图片
```python
# example.py
import base64
import AntiCAP
with open("rotate_image.jpg", "rb") as f:
rotate_base64 = base64.b64encode(f.read()).decode('utf-8')
Atc = AntiCAP.Handler(show_banner=True)
result= Atc.Single_Rotate(image_base64=rotate_base64)
print(result)
# 229 返回旋转角度
```