标签:ini window rar sage https pack tutorials image txt
本文来源于https://docs.opencv.org/3.4.1/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html#linux-gcc-usage
经测试整理后发布
上一节安装完成了openCV,这一节进行测试。
新建测试文件DisplayImage.cpp
1 #include <stdio.h> 2 #include <opencv2/opencv.hpp> 3 4 using namespace cv; 5 6 int main(int argc, char** argv ) 7 { 8 if ( argc != 2 ) 9 { 10 printf("usage: DisplayImage.out <Image_Path>\n"); 11 return -1; 12 } 13 14 Mat image; 15 image = imread( argv[1], 1 ); 16 17 if ( !image.data ) 18 { 19 printf("No image data \n"); 20 return -1; 21 } 22 namedWindow("Display Image", WINDOW_AUTOSIZE ); 23 imshow("Display Image", image); 24 25 waitKey(0); 26 27 return 0; 28 }
保存后,新建CMakeLists.txt文件,这个是用来生成Makefile的
cmake_minimum_required(VERSION 2.8) project( DisplayImage ) find_package( OpenCV REQUIRED ) add_executable( DisplayImage DisplayImage.cpp ) target_link_libraries( DisplayImage ${OpenCV_LIBS}
然后编译,运行
cmake . make ./DisplayImage xxx.jpg
请注意make .后边的.
如果能正常显示图片,这openCV测试完成
标签:ini window rar sage https pack tutorials image txt
原文地址:https://www.cnblogs.com/jourluohua/p/9131753.html