opencv-python 中对PPT图象进行图象文字增强
Posted dabo_520
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了opencv-python 中对PPT图象进行图象文字增强相关的知识,希望对你有一定的参考价值。
话不多说直接上代码:
import cv2
import numpy as np
img = cv2.imread('D:\\\\picture\\\\dabo\\\\goal.png')
img = cv2.resize(img, None, fx=0.5, fy=0.5)
b, g, r = cv2.split(img)
bH = cv2.equalizeHist(b)
gH = cv2.equalizeHist(g)
rH = cv2.equalizeHist(r)
result = cv2.merge([bH, gH, rH])
res = np.hstack((img, result))
cv2.imshow('dbao', res)
cv2.waitKey(0)
threshold = 20
h, w = img.shape[:2]
for i in range(0, h):
for j in range(0, w):
B = result[i, j, 0]
G = result[i, j, 1]
R = result[i, j, 2]
if B > threshold and G > threshold and R > threshold:
result[i, j, 0] = 255
result[i, j, 1] = 255
result[i, j, 2] = 255
cv2.imshow('dabo', result)
cv2.waitKey(0)
以上是关于opencv-python 中对PPT图象进行图象文字增强的主要内容,如果未能解决你的问题,请参考以下文章