window上vs2017 opencv图片路径问题(附3种加载路径方法)
1.图片路径
2.项目路径
3.3种加载图片路径方式
#include<iostream>
#include<opencv2/core.hpp>//核心接口
#include<opencv2/highgui.hpp>//图形接口
int main()
{
cv::Mat image;
//std::cout << "width:" << image.rows << "height:" << image.cols << std::endl;
/*方法一*/image = cv::imread("D://vs2017//File//OpenCV//opencv//opencv//images//fw.jpg");
/*方法二*/image = cv::imread("D:/vs2017/File/OpenCV/opencv/opencv/images/fw.jpg");
/*方法三*/image = cv::imread("./images/fw.jpg");
if (image.empty())
{
std::cout << "未找到图片" << std::endl;
}
std::cout << "width:" << image.rows << "height:" << image.cols << std::endl;
cv::namedWindow("nic");
cv::imshow("nic",image);
cv::waitKey();
}
4.问题
5.解决方式
注:项目属性->链接器->输入->附加依赖项 ,去掉opencv_world400.lib就可以解决