操作系统:Win10

工具:VS2019、OpenCV4.0.0

测试结果 OpenCV图像处理入门即巅峰:Mat类的使用(读取图像)测试代码 #include <opencv.hpp> #include int main(int argc, char* argv[])
{
//imread读取图像,返回Mat类用于存储
cv::Mat src_mat = cv::imread(“C:/Users/Cocos/Desktop/1.JPG”);

//判断是否读取成功
if (src_mat.empty())
{
std::cout << “读取文件失败” << std::endl;
return EXIT_FAILURE;
}
std::cout << “读取文件成功” << std::endl;
//创建标识符为hello的窗体
cv::namedWindow(“hello”,cv::WINDOW_AUTOSIZE);
//将srt_mat显示在hello窗体上
cv::imshow(“hello”, src_mat);
cv::waitKey(0);
return EXIT_SUCCESS;
}

相关文章:

  • 2022-01-20
  • 2021-06-01
  • 2022-12-23
  • 2021-12-01
  • 2021-08-02
  • 2021-12-06
  • 2021-11-24
  • 2023-02-20
猜你喜欢
  • 2021-12-29
  • 2021-04-20
  • 2021-08-26
  • 2022-12-23
  • 2021-11-08
  • 2021-05-05
  • 2021-11-18
相关资源
相似解决方案