Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a749b14

Browse files
committed
2 parents c557b46 + b0f193a commit a749b14

File tree

7 files changed

+47
-0
lines changed

7 files changed

+47
-0
lines changed

‎moumoubaimifan/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Python技术 公众号文章代码库
99

1010
## 实例代码
1111

12+
[带带弟弟 ocr 对各种类型验证码说不](https://github.com/JustDoPython/python-examples/blob/master/moumoubaimifan/ddddocr/)
13+
1214
[情人节,25 行代码生成微信朋友圈的爱心九宫格。](https://github.com/JustDoPython/python-examples/blob/master/moumoubaimifan/qrj/)
1315

1416
[20 行代码,微信头像上加冰墩墩](https://github.com/JustDoPython/python-examples/blob/master/moumoubaimifan/bdd/)
13.4 KB
Loading[フレーム]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import ddddocr
2+
import cv2
3+
4+
5+
def hk():
6+
det = ddddocr.DdddOcr(det=False, ocr=False)
7+
8+
with open('hycdn.png', 'rb') as f:
9+
target_bytes = f.read()
10+
11+
with open('background.jpg', 'rb') as f:
12+
background_bytes = f.read()
13+
14+
res = det.slide_match(target_bytes, background_bytes, simple_target=True)
15+
16+
print(res)
17+
18+
19+
20+
def dx():
21+
det = ddddocr.DdddOcr(det=True)
22+
23+
with open("eb.jpg", 'rb') as f:
24+
image = f.read()
25+
26+
poses = det.detection(image)
27+
print(poses)
28+
29+
im = cv2.imread("eb.jpg")
30+
31+
for box in poses:
32+
x1, y1, x2, y2 = box
33+
im = cv2.rectangle(im, (x1, y1), (x2, y2), color=(0, 0, 255), thickness=2)
34+
35+
cv2.imwrite("result.jpg", im)
36+
37+
def zm():
38+
39+
ocr = ddddocr.DdddOcr(old=True)
40+
for i in ['z1.jpg', 'z2.jpg']:
41+
with open(i, 'rb') as f:
42+
image = f.read()
43+
44+
res = ocr.classification(image)
45+
print(res)

‎moumoubaimifan/ddddocr/eb.png‎

22.2 KB
Loading[フレーム]

‎moumoubaimifan/ddddocr/hycdn.png‎

5.33 KB
Loading[フレーム]

‎moumoubaimifan/ddddocr/z1.jpg‎

10.6 KB
Loading[フレーム]

‎moumoubaimifan/ddddocr/z2.jpg‎

10.3 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /