Ask Your Question

mahmood's profile - activity

2020-09-26 13:22:34 -0600 received badge  Popular Question (source)
2017-06-04 11:57:42 -0600 asked a question Cmake searches for opencv library

I have installed Opencv-3.2 and I can see the bin and lib files

$ ls /share/apps/computer/opencv-3.2.0/built/bin/opencv_
opencv_annotation     opencv_createsamples  opencv_traincascade     opencv_version        opencv_visualisation
$ ls /share/apps/computer/opencv-3.2.0/built/lib/
libopencv_calib3d.so           libopencv_imgcodecs.so.3.2.0   libopencv_stitching.so.3.2
libopencv_calib3d.so.3.2       libopencv_imgproc.so           libopencv_stitching.so.3.2.0
libopencv_calib3d.so.3.2.0     libopencv_imgproc.so.3.2       libopencv_superres.so
libopencv_core.so              libopencv_imgproc.so.3.2.0     libopencv_superres.so.3.2
libopencv_core.so.3.2          libopencv_ml.so                libopencv_superres.so.3.2.0
libopencv_core.so.3.2.0        libopencv_ml.so.3.2            libopencv_videoio.so
...

Now, according to the tutorial, I wrote a simple program. Problem is that, cmake gets some errors and seems that it is not able to find the library.

CMake Error at CMakeLists.txt:3 (find_package):
  By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenCV", but
  CMake did not find one.

  Could not find a package configuration file provided by "OpenCV" with any
  of the following names:

    OpenCVConfig.cmake
    opencv-config.cmake

  Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
  "OpenCV_DIR" to a directory containing one of the above files.  If   "OpenCV"
  provides a separate development package or SDK, be sure it has been
  installed.

I don't know how to set CMAKE_PREFIX_PATH or OpenCV_DIR. How can I fix that?

The content of CMakeLists.txt is

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
2017-06-02 06:00:54 -0600 commented question opencv with non default python executable

This time, I see Interpreter: /usr/bin/python2 (ver 2.6.6) and Interpreter: /opt/python/bin/python3.3 (ver 3.3.6) and Python (for build): /usr/bin/python2. What does that mean?

2017-06-01 08:06:05 -0600 asked a question opencv with non default python executable

Hello

Following the manual of opencv-3.2, I used the following command

cmake -D CMAKE_BUILD_TYPE=Release \\
-D CMAKE_INSTALL_PREFIX=/opt/opencv-3.2.0/built/ \\
-D PYTHON2\(3\)_EXECUTABLE=/opt/python/bin/python3.3  \\
..

I expect that the compiler uses python 3.3, however, the output of the cmake command shows

--   Python 2:
--     Interpreter:                 /usr/bin/python2 (ver 2.6.6)
--
--   Python 3:
--     Interpreter:                 NO
--
--   Python (for build):            /usr/bin/python2

What did I miss in the command line?

2017-05-07 05:25:02 -0600 asked a question build error at window_gtk.cpp

With gcc-4.4.7, cmake-3.2.3, opencv-3.2.0 and gtk-2.18.9-10.el6 I get this error while making:

[ 30%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_gtk.cpp.o
/share/apps/computer/opencv-3.2.0/modules/highgui/src/window_gtk.cpp: In function 'void cvImageWidget_realize(GtkWidget*)':
/share/apps/computer/opencv-3.2.0/modules/highgui/src/window_gtk.cpp:177: error: 'gtk_widget_set_realized' was not declared in this scope
/share/apps/computer/opencv-3.2.0/modules/highgui/src/window_gtk.cpp: In function 'void cvImageWidget_size_allocate(GtkWidget*, GtkAllocation*)':
/share/apps/computer/opencv-3.2.0/modules/highgui/src/window_gtk.cpp:389: error: 'gtk_widget_get_realized' was not declared in this scope
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_gtk.cpp.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

As I checked, the versions are compatible with the documents.