OpenCV 中使用 ANN 进行 OCR 的示例

发布于 2025-01-08 00:19:24 字数 275 浏览 0 评论 0原文

我是 OpenCV 的新手,我想用 ANN 实现 OCR。我尝试搜索示例,但没有看到任何使用 ANN 进行图像处理的示例。

然后我看到这个示例 basicOCRwithANN 但是当我分类时,当我尝试此代码时,错误率超过 90%

有人可以给我展示一个使用 ANN 实现 OCR 或图像处理的示例吗

I'm new in OpenCV and I want to implement OCR with ANN. I try to search for example but not see any example that use ANN with Image Processing.

Then I see this example basicOCRwithANN but when I classify it has error rate more than 90% when I try this code

Can someone show me an example that use ANN to implement OCR or Image Processing

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

涫野音 2025-01-15 00:19:24

您所需要做的就是下载 主页上提供的完整 zip 文件单击Zip Archive 链接即可查看项目

该应用程序使用 Qt,因此您最好将其安装在您的系统上。

在编译之前,您需要对代码进行一项快速更改。转到 src 目录并打开 ma​​in.cpp 并在 #if QUICKSTART 之前添加以下指令:

#undef QUICKSTART

要在 Linux 上编译此应用程序,请执行在 src 目录中执行以下命令:

g++ main.cpp blackbird.cpp tests/lkdemo.cpp tests/ocr/mainOCR.cpp tests/rectifytest.cpp tests/camshift.cpp tests/ocr/basicOCR.cpp tests/StreamImportExport.cpp tests/ocr/basicFunctions.cpp pipeline/Pipeline.cpp pipeline/Properties.cpp pipeline/MarkerArea.cpp pipeline/Utils.cpp pipeline/modules/perspective_correction/Blob.cpp pipeline/modules/perspective_correction/BlobExtraction.cpp pipeline/modules/perspective_correction/BlobResult.cpp pipeline/modules/output/Output.cpp pipeline/modules/test_module/TestModule.cpp pipeline/modules/beamer/Beamer.cpp pipeline/modules/beamer_calibration/BeamerCalibration.cpp pipeline/modules/perspective_correction/PerspectiveCorrect.cpp view/View.cpp -o main -I/usr/local/include/opencv -I/usr/local/include  -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -I/opt/qt_47x/include/ -L/opt/qt_47x/lib/ -lQtGui -lQtCore

这将生成一个名为 ma​​in 的可执行文件。 注意-I/opt/qt_47x/include/ 指的是 Qt 标头在我的系统中的位置,-L/opt/qt_47x/lib/< /code> 指定 Qt 库目录。这两个路径在您的系统上很可能不同,因此您需要适当调整它们。

然后要执行 ma​​in,您需要转到上一个目录并运行 ./src/main 并选择选项号 3。等待大约 5-10 分钟,直到网络训练完成将会弹出一个新窗口。通过此窗口,您可以绘制(希望是数字),完成后按键盘上的 C 对图像进行分类并在控制台上观看结果。

如果这不是这样做的方法,我相信您有能力自己发现如何使用该应用程序,因为应用程序的编译已经完成。

编辑:

在这种情况下,下载并测试最新可用软件包。该包带来了 CMake 项目文件,使编译更容易。也大大提高了分类的准确率。但我不知道这个版本是否使用ANN。也许您需要使用这两个版本进行一些弗兰肯斯坦编程。

All you need to do is download the full zip available at the main page of the project, by clicking on the link that says Zip Archive.

This application uses Qt, so you better install it on your system.

You need to do one quick change in the code before compiling it. Go to the src directory and open main.cpp and add the following instruction before #if QUICKSTART:

#undef QUICKSTART

To compile this application on Linux, execute the following command inside the src directory:

g++ main.cpp blackbird.cpp tests/lkdemo.cpp tests/ocr/mainOCR.cpp tests/rectifytest.cpp tests/camshift.cpp tests/ocr/basicOCR.cpp tests/StreamImportExport.cpp tests/ocr/basicFunctions.cpp pipeline/Pipeline.cpp pipeline/Properties.cpp pipeline/MarkerArea.cpp pipeline/Utils.cpp pipeline/modules/perspective_correction/Blob.cpp pipeline/modules/perspective_correction/BlobExtraction.cpp pipeline/modules/perspective_correction/BlobResult.cpp pipeline/modules/output/Output.cpp pipeline/modules/test_module/TestModule.cpp pipeline/modules/beamer/Beamer.cpp pipeline/modules/beamer_calibration/BeamerCalibration.cpp pipeline/modules/perspective_correction/PerspectiveCorrect.cpp view/View.cpp -o main -I/usr/local/include/opencv -I/usr/local/include  -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -I/opt/qt_47x/include/ -L/opt/qt_47x/lib/ -lQtGui -lQtCore

This will generate an executable named main. Note that -I/opt/qt_47x/include/ refers to the locations where Qt headers are in my system and -L/opt/qt_47x/lib/ specifices Qt libraries directory. These 2 paths are most probably different on your system, so you need to adjust them appropriately.

Then to execute main you need to go to the previous directory and run ./src/main and choose option number 3. Wait around 5-10 minutes until the network is trained and a new window will pop up. This window let's you draw (hopefully a number), and when you are finished press C on your keyboard to classify the image and watch the result on the console.

If this is not the way to do it, I believe you are capable of discovering how to use the application yourself since the compilation of the app is already done.

EDIT:

In that case, download and test the latest available package. This package brings CMake project files that makes the compilation easier. It also improves a lot the precision rate of the classification. But I don't know if this version is using ANN. Maybe you'll have to do some Frankenstein programming with the 2 versions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文