mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-22 12:13:58 +08:00
猿人学第8题-验证码图文点选
This commit is contained in:
parent
0e34002ba0
commit
bc47f29271
@ -15,9 +15,15 @@ def turn_white(img, r1, g1, b1):
|
||||
def processing_image(img_file, standard=205):
|
||||
""" 1.将图片进行降噪处理, 通过二值化去掉后面的背景色并加深文字对比度 """
|
||||
img = Image.open(img_file)
|
||||
# for i in range(img.size[0]):
|
||||
# for j in range(img.size[1]):
|
||||
# r, g, b = img.getpixel((i, j))
|
||||
# print([r, g, b])
|
||||
|
||||
|
||||
# np.unique()该函数是去除数组中的重复数字,并进行排序之后输出,这里返回的是所有像素rgb值,以及对应的数量
|
||||
# colors, counts = np.unique(np.array(im).reshape(-1, 3), axis=0, return_counts=True)
|
||||
colors, counts = np.unique(np.array(img).reshape(-1, 3), axis=0, return_counts=True)
|
||||
print(colors, counts)
|
||||
# ct = np.sort(counts)
|
||||
# top2_counts = ct[-2:].tolist()
|
||||
# print(np.array(im).reshape(-1, 3))
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 49 KiB |
Loading…
x
Reference in New Issue
Block a user