嗨,我正在尝试显示 lena.jpg,这是 Instant OpenCV Starter Book 的第一个演示。
我可以很容易地构建和播放“hello world”。
问题代码
// opencv header files
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
// namespaces declaration
using namespace cv;
using namespace std;
// create a variable to store the image
Mat image;
int main( int argc, char** argv )
{
// open the image and store it in the 'image' variable
// Replace the path with where you have downloaded the image
// image=imread("<path to image">/lena.jpg");
image=imread("/home/nigel/Documents/ffmpeg/tests/lena.jpg");
// create a window to display the image
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );
// display the image in the window created
imshow( "Display window", image );
// wait for a keystroke
waitKey(0);
return 0;
}
错误
g++ -Wall -fexceptions 'pkg-config --cflags opencv' -g "pkg-config --cflags
opencv' -c/home/nigel/Drone/Test2/main.cpp -o obj/Debug/Drone/Test2/main.o
g++:fatal error:no input files
compilation terminated
process terminated with status 1 (0 minutes, 0 seconds)
我为 lena.jpg 尝试了不同的路径,我从 lena.pnm 更改了 lena.jpg 不确定我是否有正确的路径?
使用 OpenCv 的新手将不胜感激