资源简介
基于深度学习的文本检测,不是文本识别!
https://blog.csdn.net/LuohenYJ
代码片段和文件信息
# Import required modules
import cv2 as cv
import math
import argparse
parser = argparse.ArgumentParser(description=‘Use this script to run text detection deep learning networks using OpenCV.‘)
# Input argument
parser.add_argument(‘--input‘ help=‘Path to input image or video file. Skip this argument to capture frames from a camera.‘)
# Model argument
parser.add_argument(‘--model‘ default=“./model/frozen_east_text_detection.pb“
help=‘Path to a binary .pb file of model contains trained weights.‘
)
# Width argument
parser.add_argument(‘--width‘ type=int default=320
help=‘Preprocess input image by resizing to a specific width. It should be multiple by 32.‘
)
# Height argument
parser.add_argument(‘--height‘type=int default=320
help=‘Preprocess input image by resizing to a specific height. It should be multiple by 32.‘
)
# Confidence threshold
parser.add_argument(‘--thr‘type=float default=0.5
help=‘Confidence threshold.‘
)
# Non-maximum suppression threshold
parser.add_argument(‘--nms‘type=float default=0.4
help=‘Non-maximum suppression threshold.‘
)
args = parser.parse_args()
############ Utility functions ############
def decode(scores geometry scoreThresh):
detections = []
confidences = []
############ CHECK DIMENSIONS AND SHAPES OF geometry AND scores ############
assert len(scores.shape) == 4 “Incorrect dimensions of scores“
assert len(geometry.shape) == 4 “Incorrect dimensions of geometry“
assert scores.shape[0] == 1 “Invalid dimensions of scores“
assert geometry.shape[0] == 1 “Invalid dimensions of geometry“
assert scores.shape[1] == 1 “Invalid dimensions of scores“
assert geometry.shape[1] == 5 “Invalid dimensions of geometry“
assert scores.shape[2] == geometry.shape[2] “Invalid dimensions of scores and geometry“
assert scores.shape[3] == geometry.shape[3] “Invalid dimensions of scores and geometry“
height = scores.shape[2]
width = scores.shape[3]
for y in range(0 height):
# Extract data from scores
scoresData = scores[0][0][y]
x0_data = geometry[0][0][y]
x1_data = geometry[0][1][y]
x2_data = geometry[0][2][y]
x3_data = geometry[0][3][y]
anglesData = geometry[0][4][y]
for x in range(0 width):
score = scoresData[x]
# If score is lower than threshold score move to next x
if(score < scoreThresh):
continue
# Calculate offset
offsetX = x * 4.0
offsetY = y * 4.0
angle = anglesData[x]
# Calculate cos and sin of angle
cosA = math.cos(angle)
sinA = math.sin(angle)
h = x0_data[x] + x2_data[x]
w = x1_data[x] + x3_data[x]
# Calculate offset
相关资源
- opencv-master.zip
- 基于OpenCV的智能视频监控系统设计源
- 基于 opencv 的车牌识别147642
- One cut in grabcut的OpenCV实现代码以及工
- opencv2.4.4库(.h/.lib/.dll)
- 摄像头实时监控与报警系统Opencv
- opencv在播放视频中画框框
- 学习OpenCV(中文版).pdf 高清版本
- 模板匹配算法实现
- Computer Vision with Opencv3 and Qt5.pdf
- 基于Opencv的手势识别147077
- 基于opencv的车辆检测
- opencv2.4.9 相机定标及图像矫正
- opencv2+vs2013实现表情识别 ,SVM+BP神经
- 基于opencv的三种人脸识别
- opencv求取多轮廓质心并在输出图像显
- 自己写的QT图像处理系统,和opencv进行
- OpenCV计算机视觉常用测试图
- 基于opencv颜色识别 - 图像(普通轮廓
- 基于OpenCV的车辆监测与计数
- 大华相机图像使用OpenCV显示
- opencv的单目标定API已经二次封装
- opencv_install
- 基于OpenCV的运动物体方向识别论文
- 基于Hough椭圆检测opencv
- 抠图代码opencv
- 基于opencv的鱼眼相机标定和透视投影
- MinGW编译的opencv3.2
- 基于 vs2010 opencv的人脸识别系统
- 鱼眼标定校正 opencv3.0 视场大小可调
评论
共有 条评论