我连接到虚拟linux机器,我没有任何特权...... 我用
安装了opencv cadenv opencv
(非常好......其他人为我做了所有工作)。
现在我正在尝试运行一个简单的代码来显示图像
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
}
Mat image;
image = imread( argv[1], 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", CV_WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
anc用cmake编译它
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
当我运行cmake时。 我得到了
CMake Error at CMakeLists.txt:3 (find_package):
Could not find module FindOpenCV.cmake or a configuration file for package
OpenCV.
Adjust CMAKE_MODULE_PATH to find FindOpenCV.cmake or set OpenCV_DIR to the
directory containing a CMake configuration file for OpenCV. The file will
have one of the following names:
OpenCVConfig.cmake
opencv-config.cmake
-- Configuring incomplete, errors occurred!
我不知道这个环境,所以我不知道如何告诉Cmake哪里可以找到它的样子...... 你能救我吗?
由于
安装输出
Package OpenCV release 2.4.8 has been installed.
You can now:
- use the commands:
opencv_createsamples, opencv_haartraining,
opencv_performance and opencv_traincascade.
- use pkg-config to obtain information about compiler
and linker flags by placing the directory
/cadappl/opencv/2.4.8/lib/pkgconfig
in the environment variable PKG_CONFIG_PATH and
using package 'opencv' as package name.
- let CMake obtain information about OpenCV from the
files /cadappl/opencv/2.4.8/share/OpenCV/OpenCV*.cmake;
- View sample source files that use OpenCV in the folder
/cadappl/opencv/2.4.8/share/OpenCV/samples and its
subfolders c, cpp, gpu and ocl.
- Use OpenCV from Java 1.7.0 (/usr/bin/java) by using
/cadappl/opencv/2.4.8/share/OpenCV/java/opencv-248.jar
which at requires the shared library
/cadappl/opencv/2.4.8/share/OpenCV/java/libopencv_java248.so
Note: all OpenCV 2.4.8 programs & libraries have been
compiled with the GNU C compiler 4.4.7 (/usr/bin/gcc).