首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >OpenCV :文本处理和噪声去除

OpenCV :文本处理和噪声去除
EN

Stack Overflow用户
提问于 2018-06-09 04:56:06
回答 1查看 3K关注 0票数 1

我想删除包含文本的图像的背景,使其在白色背景上的文本。

图像样本

到目前为止,我已经尝试过获得图像的HSV和上下限,但我找不到可以消除所有背景效果的上下限

到目前为止使用的代码:

import cv2
import numpy as np


# Take each frame
filename = 'img2.png'

img = cv2.imread(filename, 1)

# Convert BGR to HSV
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
# define range of blue color in HSV
lower_blue = np.array([110,50,50])
upper_blue = np.array([130,255,255])
# Threshold the HSV image to get only blue colors
image_final = cv2.inRange(hsv, lower_blue, upper_blue)
# Bitwise-AND mask and original image
res = cv2.bitwise_and(img,img, mask= mask)
cv2.imshow('frame',img)
cv2.imwrite('mask.png',image_final)


cv2.waitKey(0)

有没有更好的方法,或者我必须结合多个下限和上限才能达到我的目标?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50768295

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档