All Projects → HenryLulu → video-to-text-ocr-demo

HenryLulu / video-to-text-ocr-demo

Licence: other
视频硬字幕提取

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to video-to-text-ocr-demo

Nkocr
🔎📝 This is a module to make specifics OCRs at food products and nutritional tables.
Stars: ✭ 15 (-85.71%)
Mutual labels:  ocr
paperless-ng
A supercharged version of paperless: scan, index and archive all your physical documents
Stars: ✭ 4,840 (+4509.52%)
Mutual labels:  ocr
textocry
Textocry - Copy text from Images (chrome extension)
Stars: ✭ 29 (-72.38%)
Mutual labels:  ocr
OCR-Test
An experiment about OCR in Android
Stars: ✭ 47 (-55.24%)
Mutual labels:  ocr
insightocr
MXNet OCR implementation. Including text recognition and detection.
Stars: ✭ 100 (-4.76%)
Mutual labels:  ocr
blinkid-ui-android
Customizable UI library that includes camera management, scanning screen, and document selection module.
Stars: ✭ 33 (-68.57%)
Mutual labels:  ocr
CRNN
Convolutional recurrent neural network for scene text recognition or OCR in Keras
Stars: ✭ 96 (-8.57%)
Mutual labels:  ocr
Persian-OCR
Optical character recognition of Farsi and Arabic letters
Stars: ✭ 36 (-65.71%)
Mutual labels:  ocr
DocumentLab
OCR using tesseract, ImageMagick, EmguCV, an advanced query language and a fluent query interface for C#
Stars: ✭ 64 (-39.05%)
Mutual labels:  ocr
vietnamese-ocr-toolbox
A toolbox for Vietnamese Optical Character Recognition.
Stars: ✭ 26 (-75.24%)
Mutual labels:  ocr
Document-Scanner-and-OCR
A simple document scanner with OCR implemented using Python and OpenCV
Stars: ✭ 31 (-70.48%)
Mutual labels:  ocr
OCRmyPDF
OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched
Stars: ✭ 6,560 (+6147.62%)
Mutual labels:  ocr
nashi
Some bits of javascript to transcribe scanned pages using PageXML
Stars: ✭ 13 (-87.62%)
Mutual labels:  ocr
LoL-TFT-Champion-Masking
League Of Legends - Teamfight Tactics Champion Masking
Stars: ✭ 23 (-78.1%)
Mutual labels:  ocr
FileBasedMiniDMS
This php script sorts your documents (by using hardlinks) into subfolders based on the hashtags it finds in your documents filenames.
Stars: ✭ 35 (-66.67%)
Mutual labels:  ocr
normcap
OCR powered screen-capture tool to capture information instead of images
Stars: ✭ 441 (+320%)
Mutual labels:  ocr
Hyper-Table-OCR
A carefully-designed OCR pipeline for universal boarded table recognition and reconstruction.
Stars: ✭ 96 (-8.57%)
Mutual labels:  ocr
LaraOCR
Laravel Optical Character Reader(OCR) package using ocr engines like Tesseract
Stars: ✭ 88 (-16.19%)
Mutual labels:  ocr
jp-ocr-prunned-cnn
Attempting feature map prunning on a CNN trained for Japanese OCR
Stars: ✭ 15 (-85.71%)
Mutual labels:  ocr
LaTeX-OCR
pix2tex: Using a ViT to convert images of equations into LaTeX code.
Stars: ✭ 1,566 (+1391.43%)
Mutual labels:  ocr

是什么?

利用OCR、OpenCV等提取视频硬字幕

做了什么

从视频提取硬字幕要做以下事情:

1、视频切割

把视频切成若干张包含字幕的静态图片(这里是等距切,密度在config里splitDuration配置�)。应在考虑调用成本的前提下尽量�细切,保证字幕都切到(不用怕重复,这有去重)

2、图片OCR

百度OCR能返回所有识别结果的坐标。

3、去重

去重有两个目的: 一是防止结果重复;二是能把固定位置的文字收敛(比如台标),避免字幕定位错误。

4、字幕定位

每张图可能识别出若干组文字(每组都有位置信息),在获得所有�切图�OCR结果后,我们需要确定哪些是字幕的内容。

这里有两个假设:

  1. 字幕的纵向位置�基本不变
  2. 字幕是整个视频中同一位置不同内容文字量最大的部分

有这两个假设:

  1. 把top相近的识别结果分成一组
  2. 去重后量最大的组就是字幕组

5、字幕分段(Todo)

使用指南

环境

python:mac电脑自带,windows请自行百度安装

获取代码

方法一:git clone https://github.com/HenryLulu/video-to-text-ocr-demo.git 方法二:右上角 - clone or download - download zip

申请百度OCR

https://console.bce.baidu.com/ai/#/ai/ocr/overview/index 在百度云开放平台注册,创建文字识别应用得到APP_ID、API_KEY、SECRET_KEY,就可以用了。 我们用到的是:通用文字识别(含位置信息版)。每天前500次调用免费。

配置

在代码目录新建一个 config.py 文件,贴入以下内容(配置项替换成自己的)

def getConfig(videoname):
    return {
        'APP_ID': '�百度OCR APP_ID',
        'API_KEY': '百度OCR APP_KEY',
        'SECRET_KEY': '百度OCR SECRET_KEY',
        'videoDir': './video/' + videoname + '.mp4',
        'imgDir': './videoframes/' + videoname,
        'outputDir': './output/' + videoname + '/',

        'splitDuration': 1
    }

执行

创建上面配置的 videoDir 中的文件夹,比如这里的 video,把视频文件放进去。 修改 index.py video 为某个视频文件名,执行 python index.py

测试结果

美妆教程

视频长度:4:51

切图密度:2s(145pic)

OCR时长:99s

识别内容:

正确的化妆步骤,可以缩短化妆的时间,让你化妆更加有条理性,回常生活中,应用到裸妆的机会比较多,那么今天我就,教给大家裸妆的化妆步骤,让你轻轻松松快速搞定自已的妆容,美美的去上班,太好了快教教我们吧,下面开始今天的化妆教学了,大家一定要看好哦,希望大家会喜欢,今天模特呢是打好底妆了,下面呢开始化妆的第一步,就是先要画眉毛,因为模特前面的眉毛较重,我们人眉峰的位置开始画,要顺着眉毛生长的方向刻画,眉笔选用的颜色,要根据头发的颜色来选择,眉头呢可以画的淡一些,这样眉毛就刻画好了,大家可以看,接下来是眼妆的刻画,首先呢是眼影,要用裸色的眼影对眼部进行打底,因为今天呢画的是棵妆,但是呢我不想用大地色系的眼影,选用一款比较明媚的颜色,桃红色涂于眼窝上,淡淡的画层,然后选用金色的眼影涂于睫毛很部,然后选用金色的眼影涂号睡毛根部,向上进行除,但是范围呢不要超炒桃红色,接下来呢要用银白色在眉骨处进行提亮,这样上眼影就完成了,下面我们来画下眼影,下眼影呢要用金色的眼影,涂于后眼尾三分之一处,然后用桃红色,渐渐的向前进行一个过渡,同时可以用银色在眼角处进行提亮,这样眼影部分就打造完成了,眼妆的第二个步骤呢是眼线,下面我们来刻画眼线,要从眼头,画一条紧贴于睫毛根部的平行线,到眼尾的时候呢可以略粗一些,填满睫毛根部的缝隙,下眼线呢我们刻画到,后眼尾三分之一处,画的可以淡一些,这样眼线部分就完成了,大家可以看一下,眼妆的第三个步骤呢是瞳毛部分,首先要用睫毛夹把睫毛夹弯,然后是贴假睫毛,贴假睫毛的时候呢,一定要先贴假哦睫毛的中部,然后贴假睫毛的头部,最后贴假睫毛的末端,然后要用睫毛膏,对真假睫毛进行一个融合,同时呢下睫毛也要画上,这样眼部妆容就完成了,大家有没有看见明显的变化呀,化妆的第三个步骤呢是腮红部分,我们今天选用一款橘色的腮红,要涂于苹果肌上,苹果肌呢就是这个位置,比较凸起的部分,定要斜着画,这样才会使你的脸部,看上去比较有立体感,化妆的最后一个步骤呢是唇部,我们今天选用一个棵粉色的唇膏,涂于嘴唇上,这种颜色呢显得嘴唇特别的清新淡雅,下面我们来刻画另一边的脸
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].