Could not find module FindOpenCV.cmake

1.4k Views Asked by At

I am connected to a virtual linux machine where I don't have any privilege... I installed opencv with

cadenv opencv

(very nice....someone else did all the job for me).

now I am trying to run a simple code to show an image

#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 compile it with cmake

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

when I run cmake . I get

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!

I dont know this environment so I dont know how to tell Cmake where it can find what it looks for... can you help me?

Thanks

OUTPUT FROM INSTALLATION

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).
0

There are 0 best solutions below