欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

opencv 15 OCR 文本检测(textdetection) vs2015

程序员文章站 2022-07-12 20:30:44
...

01 资源

OpenCV自带的OCR文本检测用例,opencv_contrib\modules\text\samples\textdetection.cpp。textdetection.cpp检测图片中文本。
模型文件(需要拷贝到Debug或Release目录中):

opencv_contrib/modules/text/samples/trained_classifierNM1.xml
opencv_contrib/modules/text/samples/trained_classifierNM2.xml

测试图片:

opencv_contrib/modules/text/samples/scenetext_segmented_word01.jpg
opencv_contrib/modules/text/samples/scenetext_segmented_word01_mask.png
opencv_contrib/modules/text/samples/scenetext_segmented_word02.jpg
opencv_contrib/modules/text/samples/scenetext_segmented_word02_mask.png
opencv_contrib/modules/text/samples/scenetext_segmented_word03.jpg
opencv_contrib/modules/text/samples/scenetext_segmented_word03_mask.png
...

02 编译textdetection

参考opencv01 相对完整的编译opencv3.3.0 win版本,编译opencv3.3.0 vs2015版本。
生成文件:D:\git\opencv\build\v3.3.0\x64\bin\Debug\text-example-textdetection.exe

03 textdetection项目配置

设置textdetection项目为启动项。

# 如果路径中有空格,需要使用双引号,参数路径根据自己实际情况调整
配置属性==>调试==>命令参数=../../../../../../opencv_contrib/modules/text/samples/scenetext_segmented_word03.jpg 
配置属性==>调试==>工作目录=$(OutDir)

opencv 15 OCR 文本检测(textdetection) vs2015

04 运行结果

scenetext_segmented_word03.jpg原图:opencv 15 OCR 文本检测(textdetection) vs2015
运行结果:
opencv 15 OCR 文本检测(textdetection) vs2015

相关标签: opencv