You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
查到的相关教程说增加 #include <opencv2/imgcodecs/imgcodecs_c.h>
然后查看 opencv2/imgcodecs/imgcodecs_c.h文件:#error "This header with legacy C API declarations has been removed from OpenCV. Legacy constants are available from legacy/constants_c.h file."
然而并没有opencv2/legacy/constants_c.h这个文件
参考E0035 This header with legacy C API declarations has been removed from OpenCV
增加 #include <opencv2/imgcodecs/legacy/constants_c.h> ,问题解决✅
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
参考链接
ncnn和opencv在vs2022上创建工程推理示例
创建项目
个人更倾向不勾选将解决方案和项目放在同一目录中,这样在项目目录中有一个项目文件夹和.sln文件。而不是.sln文件也混入项目文件夹中,相关链接
添加依赖
点击视图=>其他窗口=>属性管理器,在Release | x64(与上面编译过程中的参数对应)处右击进入属性界面。
点击VC++ 目录,在包含目录中依次添加如下内容:
在我的电脑上是
在库目录中依次添加如下内容:
在我的电脑上是
在属性界面选择链接器=>输入,在附加依赖项中依次添加如下内容:
将opencv/build/x64/vc15/bin目录下面的opencv_world460.dll和opencv_world460d.dll文件复制到C:\Windows\System32这个文件夹里面,否则会报错找不到dll文件
其他问题
E0020 未定义标识符 "CV_LOAD_IMAGE_COLOR"
查到的相关教程说增加
#include <opencv2/imgcodecs/imgcodecs_c.h>
然后查看
opencv2/imgcodecs/imgcodecs_c.h
文件:#error "This header with legacy C API declarations has been removed from OpenCV. Legacy constants are available from legacy/constants_c.h file."
然而并没有
opencv2/legacy/constants_c.h
这个文件参考E0035 This header with legacy C API declarations has been removed from OpenCV
增加
#include <opencv2/imgcodecs/legacy/constants_c.h>
,问题解决✅错误 LNK2001 无法解析的外部符号 "bool cdecl glslang::InitializeProcess(void)" (?InitializeProcess@glslang@@YA_NXZ)
相关issue
在属性界面选择链接器=>输入,参考之前编译的项目squeeze.net,在附加依赖项中依次添加对应内容
全都替换成编译出来的:
成功!✅
版本信息
Beta Was this translation helpful? Give feedback.
All reactions