系列文章目录
提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加
例如:第一章 Python 机器学习入门之pandas的使用
提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档
前言
提示:这里可以添加本文要记录的大概内容:
前面已经完成了ESP32S3+LVGL+OV2640的工作,下一步就可以在这个基础上去增加OPENCV的模块了。
源代码还是用的GitHub上的:
esp32-opencv
提示:以下是本篇文章正文内容,下面案例可供参考
一、将OPENCV添加到工程
根据开源作者的描述,有三种方法。一个是直接用编译好的库,直接使用。再一个是利用写好的.sh文件重新编译一下,生成库,然后使用。第三种就是所有的命令一步步来。咱们就不用多想了直接使用编译好的库。
Faster way:
The first way is to simply get the pre-built OpenCV library in esp32/lib/ folder, and copy it into your project (see Compiling-esp-idf-project-using-opencv)
Fast way:
The second way is by using the script in build_opencv_for_esp32.sh. This script automatically compiles OpenCV from this repository sources, and install the needed files into the desired project. It can be tweaked as needed to add and remove some parts (see esp32/doc/build_configurations.md).
The script has 2 arguments. The first is the path to the toolchain-esp32.cmake (default is $HOME/esp/esp-idf/tools/cmake/toolchain-esp32.cmake), and the second is the path where the OpenCV library is installed (default is in ./esp32/lib).
Detailed way:
The last way explains all the commands and modifications done to be able to compile and run OpenCV on the ESP32. The detailed procedure is in esp32/doc/detailed_build_procedure.md.
由于我对cmake文件这些还不了解,直接按照提供的方法,把生成的库放到main文件夹下,修改CMakeList.txt。就可以直接编译通过了。
二、解决 undefined reference to sysconf 错误
编译好之后,如果调用例程,就会出现这样的提示。这个问题好像是因为获取内核数量的一个方法出现的异常,可能ESP32相关的支持还没有完善起来。这里说按照如下修改即可,但是查看下载后的源码其实都已经是修改好的,另外可能其他位置在编译的时候也会报错。
parallel.cpp:949:58: undefined reference to sysconf
This error appeared while trying to use the canny() method of the imgproc module
Fix: Modify modules/core/src/parallel.cpp
Change the