Skip to content

Commit 5eb175a

Browse files
committed
update readme
1 parent 07147e5 commit 5eb175a

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ print('置信度', confidence)
128128
- 因此实际滑块的距离为 x1-offset (154-8=146)
129129
- 也就是说,实际的滑块距离为缺口的x1值减去滑块距离图片边框的偏移量(offset)
130130

131+
### 获取偏移量
132+
通常某一类的滑块验证码,滑块偏移量是固定的,可直接通过截图工具或测量工具获取
133+
如果是动态的偏移量,可通过 identify_offset 方法获取偏移量
134+
135+
```python3
136+
from captcha_recognizer.slider import Slider
137+
138+
offset, confidence = Slider().identify_offset(source='example.png')
139+
print(f'偏移量: {offset}')
140+
print('置信度', confidence)
141+
142+
```
143+
131144
## 图片缩放
132145

133146
某些验证码,前端渲染时会对图片进行缩放,因此实际的滑块距离也要按照图片缩放比例进行计算。

captcha_recognizer/slider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def identify(self, source: Union[str, Path, bytes, np.ndarray], conf=CONF_THRESH
375375
def identify_offset(self, source: Union[str, Path, bytes, np.ndarray], conf=CONF_THRESHOLD, iou=IOU_THRESHOLD,
376376
show=False):
377377
"""
378-
通过滑块图获取固定的offset
378+
通过滑块图或者全图获取offset
379379
"""
380380
box_list = []
381381
mask_ndarray = None

0 commit comments

Comments
 (0)