资源简介
自己弄得小程序,提取字符,省事省心,没了,为啥不能免费
代码片段和文件信息
import numpy as np
import cv2.cv2 as cv
from matplotlib import pyplot as plt
import os
import heapq
# deal the image with binaryzation
def thresh_binary(img):
gray = cv.cvtColor(imgcv.COLOR_BGR2GRAY)
blur = cv.GaussianBlur(gray (9 9) 0)
# OTSU‘s binaryzation
(ret3 th3) = cv.threshold(blur100 255 cv.THRESH_OTSU)
kernel = np.ones((2 2) np.uint8)
opening = cv.morphologyEx(th3 cv.MORPH_OPEN kernel)
#看看有几个非零像素
# cl = opening.shape
# feiling = cv.countNonZero(opening)
cv.namedWindow(“Image“0)
cv.imshow(“Image“ opening)
return opening
# sum the black pixel numbers in each cols
def hist_col(img):
list=[]
row col = img.shape
for i in xrange(col):
list.append((img[: i] < 200).sum())
return list
def cut_col(imgl):
minlist = []
np_list = np.array(l)
a = max(l)
row col = img.shape
avg = col/8
if(cv.countNonZero(img) < col*row/2): #黑底子白字
i = 20
while i < col - 1:
if i >= col - 10:
if np_list[i] > a - 10 and np_list[i] >= np_list[i+1:col].max():
minlist.append(i)
break
if i == col - 1:
minlist.append(i)
break
else:
if np_list[i]>a - 20 and np_list[i] >= np_list[i:i+10].max():
minlist.append(i)
i += avg
i += 1
return minlistrow
else:
pass
#切竖着的图并接着处理
def cut_img(imgminlistrow):
colpics = []
for j in xrange(len(minlist)-1):
cv.namedWindow(str(j)0)
cv.imshow(str(j) img[0:row minlist[j]+10:minlist[j+1]+10])
相关资源
- OpenCV入门教程+OpenCV官方教程中文版
- opencv+Python的教程大全
- opencv手势识别
- Python+OpenCv项目代码
- python 识别物体跟踪
- 通过python使用opencv计算图像的中心
- 用Pythonopencv提取图像中的红色区域
- 段力辉大神翻译原版OpenCV-Python
- OpenCV-Python 中文教程278991
- OpenCV官方教程中文版Python版带完整书
- dlib18.17 编译好的python-dlib库 不需要
- OpenCV Python 手册
- 带图形界面、车牌识别源码python+ope
- 从视频中分离前景目标的Python & Matl
- Python opencv库 cv2.so (armhf版
- OpenCV-Python-Tutorial-中文版段立辉译
- OpenCV Python 计算机视觉 官方教程中文
- 《机器学习-使用OpenCV和Python进行智能
- 利用python和opencv进行人脸识别
- OpenCV图像处理总结
- 基于OpenCV 的回转体零件表面缺陷检测
- 车牌号码识别python+opencv
- 基于python3 与openCV的面部表情识别
- python+OpenCV实现全景图像拼接和图像黑
- opencv3+python人脸检测和识别- 完整实战
- python2.6 opencv win 32
- opencv3+python人脸检测和识别- 完整实战
- opencv3+python人脸检测和识别 完整项目
- opencv3视频中检测人脸python
- Learning OpenCV 3 Computer Vision with Python
评论
共有 条评论