henrylulu / video-to-text-ocr-demo Goto Github PK
View Code? Open in Web Editor NEW视频硬字幕提取
视频硬字幕提取
用的VS编译,在import cv2哪里会报错“unresolved import”。
用python直接打开,直接就关了,这是我第一次用github,之前也没有接触过python,但确实按着readme里面操作下来不太行啊。(哭哭~)
root@:~# python3 index.py
Traceback (most recent call last):
File "index.py", line 1, in
import getframe
File "/root/getframe.py", line 31
print c
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(c)?
windows的Ubuntu子系统运行报错,windows搭建python环境也会报同样的错
您好:
想嘗試用您的程序來提取韓劇的硬字幕
請問該如何使用呢?
可否請您寫一下簡單的教學?
謝謝
https://github.com/duangsuse-valid-projects/extract-subtitles
这个是我改的,原作者比较学院派,没有那些 fixed rate 什么的,主要是 absdiff(m1, m2)
和 scipy.signal.argrelextrema
提取关键帧(key frame)
也就是说没有这种算法:
for frame_no in range(0, video.getprop(cv2.CAP_PROP_FRAME_COUNT), cfg.step):
video.setprop(cv2.CAP_PROP_POS_FRAMES, frame_no)
imwrite(f"{frame_no}.png", video.read()[1])
OCR 当然是 PyTesseract ,一个本地的 OCR。 去重的话不是在字幕区图像上面去重,是在文字上应用编辑距离算法。
效果请参看 https://t.me/dsuset/7167
此外你的这个描述… 有点不准确吧
video-to-text-ocr-demo/README.md
Line 12 in c853d8b
什么叫做『收敛』…… 这个名词好像是常用在机器学习领域,另外其实还有一种思路是预先裁剪好图像再去 OCR,因为字幕位置复杂的视频嘛… 一般会同时包含纵向字幕,这样即便一次提取完效果其实也不咋样。
像这样比较自动化的识别整个图像然后选 y 位置一致集合里最大的一组视为字幕也可以,如果要优化,你可以参考 extract-subtitle 的关键帧识别算法:
提示没有CV2,怎么安装?
我怎么没找到。。。
pathDir = sorted(filter(is_img, os.listdir(imgDir)))
positionData = [];
for imgName in pathDir:
----------Subtitle Analysis----------
Start subtitle analysis
Traceback (most recent call last):
File "index.py", line 91, in
main()
File "index.py", line 77, in main
if not getsubtitle.main():
File "/Users/MonKong/Downloads/video-subtitle-recognize-master/getsubtitle.py", line 82, in main
if float(word['probility']) < probability:
KeyError: 'probility'
希望能直接获取时间轴啊,每条字幕都有对应的时间起止。
大家记得在必要的时候转换
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.