C++ OpenCV imgcodecs.hpp 文件未找到错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25195031/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OpenCV imgcodecs.hpp file not found error
提问by metalaureate
I'm trying to compile a C++ program that uses OpenCV to score the similarity of two images:
我正在尝试编译一个 C++ 程序,该程序使用 OpenCV 对两个图像的相似性进行评分:
When I g++ compile the file:
当我 g++ 编译文件时:
'opencv2/imgcodecs.hpp' file not found
#include "opencv2/imgcodecs.hpp"
I updated the opencv formula on Mac OS X. I re-ran brew install, but I still get this error.
我在 Mac OS X 上更新了 opencv 公式。我重新运行了 brew install,但我仍然收到这个错误。
mdfind imgcodecs.hpp -name
returns nothing - the file is nowhere on my system.
什么都不返回 - 该文件在我的系统上无处可去。
Does anyone know my imgcodecs is not included, and how to include it? I'm really novice at C and OpenCV, and enormously grateful for any help.
有谁知道我的 imgcodecs 不包括在内,以及如何包括它?我真的是 C 和 OpenCV 的新手,非常感谢您的帮助。
采纳答案by Bull
I notice that you are looking at tutorial code on the master branch (aka 3.0.0). It uses an imgcodecs module that is not present in earlier versions of OpenCV (e.g. 2.4.9).
我注意到您正在查看 master 分支(又名 3.0.0)上的教程代码。它使用早期版本的 OpenCV(例如 2.4.9)中不存在的 imgcodecs 模块。
Check which version of OpenCV you have (it seems not 3.0.0) and use a matching version of tutorial code (e.g. OpenCV 2.4.9 Histograms_Matching/EqualizeHist_Demo.cpp)
检查您拥有哪个版本的 OpenCV(似乎不是 3.0.0)并使用匹配版本的教程代码(例如OpenCV 2.4.9 Histograms_Matching/EqualizeHist_Demo.cpp)