Bug 251391 - OpenCV not detected during configuration
Summary: OpenCV not detected during configuration
Status: RESOLVED NOT A BUG
Alias: None
Product: digikam
Classification: Applications
Component: Faces-RedEyes (show other bugs)
Version: 1.4.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-16 00:55 UTC by Andrzej
Modified: 2016-08-18 15:08 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.5.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrzej 2010-09-16 00:55:41 UTC
Version:           1.4.0 (using KDE 4.5.1) 
OS:                Linux

I do have OpenCV-2.1.0 and cmake-2.8.1 installed.

relevant parts of cmake output in 1.4.0:
CMake Warning at /usr/share/apps/cmake/modules/MacroOptionalFindPackage.cmake:32 (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

Call Stack (most recent call first):
  CMakeLists.txt:138 (MACRO_OPTIONAL_FIND_PACKAGE)


--  libopencv library found.................. NO  (optional)

--  RemoveRedEyes will be compiled........... NO  (optional - Look README file for more details about dependencies)


in 1.3.0 OpenCV is detected:
-- OpenCV root directory: /usr
-- OpenCV Include Directory: /usr/include/opencv;/usr/include/opencv;/usr/include/opencv;/usr/include/opencv
-- OpenCV Libraries: /usr/lib/libcv.so;/usr/lib/libcxcore.so;/usr/lib/libcvaux.so;/usr/lib/libhighgui.so


Reproducible: Always




OS: Linux (i686) release 2.6.35.4
Compiler: gcc
Comment 1 caulier.gilles 2010-09-16 08:39:07 UTC
I cannot confirm this under Mandriva 2010.1.

Opencv 2.1.0 package install a config file which will be used by Cmake to get settings :

[gilles@localhost opencv]$ pwd
/usr/share/opencv
[gilles@localhost opencv]$ ls
haarcascades/  lbpcascades/  OpenCVConfig.cmake  samples/
[gilles@localhost opencv]$ cat OpenCVConfig.cmake
# ===================================================================================
#  The OpenCV CMake configuration file
#
#             ** File generated automatically, do not modify **
#
#  Usage from an external project: 
#    In your CMakeLists.txt, add these lines:
#
#    FIND_PACKAGE(OpenCV REQUIRED )
#    TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})   
#
#    This file will define the following variables:
#      - OpenCV_LIBS          : The list of libraries to links against.
#      - OpenCV_LIB_DIR       : The directory where lib files are. Calling LINK_DIRECTORIES
#                                with this path is NOT needed.
#      - OpenCV_INCLUDE_DIRS  : The OpenCV include directories.
#      - OpenCV_VERSION       : The  version of this OpenCV build. Example: "1.2.0"
#      - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "1"
#      - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "2"
#      - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
#
# ===================================================================================


# Extract the directory where *this* file has been installed (determined at cmake run-time)
#  This variable may or may not be used below, depending on the parsing of OpenCVConfig.cmake
get_filename_component(THIS_OPENCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)

# ======================================================
# Include directories to add to the user project:
# ======================================================
INCLUDE_DIRECTORIES(/usr/include/opencv)
# Provide the include directories to the caller
SET(OpenCV_INCLUDE_DIRS /usr/include/opencv)

# ======================================================
# Link directories to add to the user project:
# ======================================================
LINK_DIRECTORIES("/usr/lib")
# Provide the libs directory anyway, it may be needed in some cases.
SET(OpenCV_LIB_DIR "/usr/lib")

# ====================================================================
# Link libraries: e.g.   cxcore110.so, cv110.lib / cv110d.lib, etc...
# ====================================================================
set(OPENCV_LIB_COMPONENTS cxcore cv ml highgui cvaux)
SET(OpenCV_LIBS "")
foreach(__CVLIB ${OPENCV_LIB_COMPONENTS})
        # CMake>=2.6 supports the notation "debug XXd optimized XX"
        if (CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)
                # Modern CMake:
                SET(OpenCV_LIBS ${OpenCV_LIBS} debug ${__CVLIB} optimized ${__CVLIB})
        else(CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)
                # Old CMake:
                SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB})
        endif(CMAKE_MAJOR_VERSION GREATER 2  OR  CMAKE_MINOR_VERSION GREATER 4)
endforeach(__CVLIB)

# For OpenCV built as static libs, we need the user to link against 
#  many more dependencies:
IF (NOT 1)
        # Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:
        LINK_DIRECTORIES("/home/mandrake/rpm/BUILD/OpenCV-2.1.0/build/3rdparty/lib")

        SET(OpenCV_LIBS 
                dl;m;pthread;rt 

                /usr/lib/libjpeg.so 
                /usr/lib/libpng.so;/usr/lib/libz.so 
                /usr/lib/libtiff.so 
                /usr/lib/libjasper.so;/usr/lib/libjpeg.so 
                gtk-x11-2.0;gdk-x11-2.0;atk-1.0;gio-2.0;pangoft2-1.0;gdk_pixbuf-2.0;pangocairo-1.0;cairo;pango-1.0;freetype;fontconfig;gobject-2.0;gmodule-2.0;gthread-2.0;rt;glib-2.0;gthread-2.0;rt;glib-2.0;gstbase-0.10;gstreamer-0.10;gobject-2.0;gmodule-2.0;xml2;gthread-2.0;rt;glib-2.0;avcodec;avformat;avutil;swscale;dc1394;v4l1;v4l2 
                ${OpenCV_LIBS}) # The standard libs BEFORE (OpenCV_LIBS) since these can have "debug","optimized".
ENDIF(NOT 1)


# ======================================================
#  Version variables: 
# ======================================================
SET(OpenCV_VERSION 2.1.0)
SET(OpenCV_VERSION_MAJOR  2)
SET(OpenCV_VERSION_MINOR  1)
SET(OpenCV_VERSION_PATCH  0)

Sound like CMake cannot find this file, because environnement variable are not set by OpenCV package on your computer. On my computer i can see that :

[gilles@localhost opencv]$ export |grep open
declare -x PWD="/usr/share/opencv"

Gilles Caulier
Comment 2 Johannes Wienke 2010-09-16 09:51:24 UTC
Can you have a look if FindOpenCV.cmake is on your computer or which package provides it? Maybe the velopment-packages for opencv are missing?
Comment 3 Andrzej 2010-09-20 00:08:18 UTC
I was preparing opencv package myself and apparently there was a mistake in the build script.
I was missing:
/usr/share/opencv/OpenCVConfig.cmake

With this file opencv is detected correctly during kipi-plugins-1.4.0 configuration.