未定义标识符imread包含在哪个头文件里

未定义标识符imread包含在哪个头文件里,第1张

可以加上万能头文件模板

#include <stdio.h>

#include <tchar.h>

#include <iostream>

#include <fstream>

#include <opencv2/opencv.hpp>

#define CV_VERSION_ID CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)

#ifdef _DEBUG

#define cvLIB(name) "opencv_" name CV_VERSION_ID "d"

#else

#define cvLIB(name) "opencv_" name CV_VERSION_ID

#endif

#pragma comment( lib, cvLIB("core") )

#pragma comment( lib, cvLIB("imgproc") )

#pragma comment( lib, cvLIB("highgui") )

#pragma comment( lib, cvLIB("flann") )

#pragma comment( lib, cvLIB("features2d") )

#pragma comment( lib, cvLIB("calib3d") )

#pragma comment( lib, cvLIB("gpu") )

#pragma comment( lib, cvLIB("legacy") )

#pragma comment( lib, cvLIB("ml") )

#pragma comment( lib, cvLIB("objdetect") )

#pragma comment( lib, cvLIB("ts") )

#pragma comment( lib, cvLIB("video") )

#pragma comment( lib, cvLIB("contrib") )

#pragma comment( lib, cvLIB("nonfree") )

拿走吧,应该能都解决opencv各个版本的问题

VideoCapture和cvCapture其实是一样的,你可以去看看源码,VideoCapture其实在内部调用了cvCapture。这是不同版本的opencv导致的。我接触到的opencv有过一次大升级,函数名有很多变化,其实是向着面向对象的方向发展了,也就是开始重c++而轻c了。

cvLoadImage和imread返回值略有差异,过去的opencv处理图像倾向使用IplImage类型。升级后更倾向于将图像、矩阵等等都统一使用Mat类型上。差别不大。

你看头文件也能发现imread位于highgui.hpp里面是c++,cvLoadImage位于highgui_c.h里,是c。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11807465.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存