CMake error configuring opencv - opencv

I have been trying to work with the flandmark code for facial detection. in order to compile the libraries, I need to run CMAKE.gui.exe. However I keep getting the same error and no one seems to have an idea how to get around it. I would really appreciate if please someone could help.
Error:
Cmake Warning at /OpenCV2.3/cmake/OpenCVConfig.cmake:153(message):
Found OpenCV 2.4.3 Windows Super Pack but it has not binaries compatible with your configuration.
You should manually point Cmake variable OpenCV_DIR to your build of OpenCV library.
Call Stack(most recent call first):
CMakeLists.txt:2(find_package)
CMake Error at CMakeLists.txt:2(find_package):
Found package configuration file:
/OpenCV2.3/cmake/OpenCVConfig.cmake
but it set OPENCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND

Just delete CMake cache.
I've had more or less the same problem, posted & answered a question myself.
Check it at https://stackoverflow.com/a/36622706/3292304 for the whole problem if you want. I hope this will help.

I would suggest you take a look at this post
It happened in my case since I had already installed another version of OpenCV.
I hope it helps

Something weird is going on with the cmake configuration files.
For me the problem was solved by simply setting OPENCV_FOUND to TRUE and OpenCV_FOUND to TRUE.
Also I had to set OpenCV_DIR to /usr/local/share/OpenCV.

Related

Problems when building Drake from source with cmake

I am trying to build and install Drake from source in order to get support for Mosek. I keep running into trouble, however. For the record, I am running macOS Catalina.
Right now my approach has been this:
Clone drake from github to a location on my computer (from https://github.com/RobotLocomotion/drake.git)
Install prereqs
with ./setup/mac/install_prereqs.sh
Run bazel build //... Make a
directory called build and cd build cmake .. and then make
and make install
And in my C++ project, which I build using cmake, I add this to CMakeLists.txt:
link_directories(drakelocation/build/install/lib)
include_directories(drakelocation/build/install/include)
However, when I try to build my project, I get an error that Drake is unable to locate Eigen: 'Eigen/Core' file not found. I was able to work around this by adding:
target_link_libraries(my_lib Eigen3::Eigen) to my CMakeLists.txt
I found this a bit strange, as I expect that Drake includes Eigen when it is built, but at least this made me able to get a bit further.
After this I get a bunch of messages of the type:
no member named 'signbit' in the global namespace
i.e. it seems like Drake suddenly is missing all the standard C++ libraries. I have not yet been able to fix this issue, so this is where I am currently stuck.
Do you have any suggestions, or have you encountered any similar problems before?
Other information:
Using find_package(drake) does not work with my current approach at all (cmake is not able to locate drake-config.cmake). Am I missing something here that is required to make this work? Where does cmake expect libraries to be installed, and how do I install them in that place?
I have also tried skipping the entire bazel build //... step, going directly to the cmake .. step, which did not seem to make any difference.
In between every different build approach I have run bazel clean --expunge to make sure that nothing sticks around from the previous run.
Thanks!
You need to tell CMake where your Drake installation is located:
list(APPEND CMAKE_PREFIX_PATH /absolute/path/to/drakelocation/build/install)
find_package(drake REQUIRED)
add_library(my_lib ...)
target_link_libraries(my_lib drake::drake)
This ensures you have all the necessary compiler and linker flags. Setting the include directory to simply /absolute/path/to/drakelocation/build/install/include is insufficient since it does not contain the include directories of the various dependencies of Drake.
Note that you do not need to call bazel yourself before calling cmake. When you run make install, it will call bazel internally.
Thanks #Jamie that solved the find_package() problem I had.
I still had some trouble with the build. Turns out that there was something wrong with my default SDK path, and that setting "CMAKE_OSX_SYSROOT" according to this: Catalina C++: Using <cmath> headers yield error: no member named 'signbit' in the global namespace after an update to XCode did the trick.
After this, I got a lot of strange error messages from Eigen, complaining that i.e. MatrixXd was not defined in the namespace 'Eigen'. For some reason, uninstalling it with brew uninstall eigen and then downloading and building eigen from source solved those problems.
It now works!

CMAKE wont install OPENCV

Having loads of problems trying to make my own Haar Cascade Classifier using Opencv. I have followed this tutorial (https://pythonprogramming.net/haar-cascade-object-detection-python-opencv-tutorial/) and with initial success I have been unable to replicate my results. I have turned to the Opencv Documentation and it has suggested using CMAKE but I keep getting the following error;
Im sure its something simple but i cant see it. I would appreciate any help, thank you.
Simple answer is build a temporary folder in the OPENCV directory. Go into the new directory. Then type;
cmake /root/opencv/
In the new folder and type
make
then;
sudo make install

cmake error - cannot find opencv libraries or headers

I've set the opencv environment variable and updated the path but I'm still getting an error when I try to make the opencv aruco library with cmake gui on windows - the error says
"OpenCV required but some headers or libs not found. Please specify OpenCV directory using OpenCV_DIR env. variable"
I've looked at the FindOpenCV.cmake file where the error is coming from, but I can't tell what part is causing an error and was wondering if anyone else has had similar problems or knows how to fix it it would be much appreciated!
#DeirdreMeehan are you getting error as shown in the following image?
If this is the same error you are getting then you are supposed to link openCV directory from your computer to ArUco. That is you add OpenCV path in to value field where the name field is "OpenCV_DIR".

Error while building opencv_contrib opencv 3.0

I wanted to use the "extra" modules, that come as opencv_contrib from here for other functions of opencv 3.0. I followed the instructions as per the page, for building and compiling the modules, but am stuck with this error
Command:
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..
Error:
<Skipping the common Cmake statements and going straight to the error>
CMake Error at opencv_contrib/modules/adas/tools/fcw_train/CMakeLists.txt:16 (ocv_include_modules_recurse):
Unknown CMake command "ocv_include_modules_recurse".
-- Configuring incomplete, errors occurred!
I checked the CMakeLists.txt as mentioned in the path and there were other lines of code that had ocv_xxx , thus it was not a rename issue (I thought they misspelt opencv).
This is my folder structure:
Opencv
- build
- opencv_contrib
This is to verify if my CMake command was correct, as I had posted above.
Can you please tell me how to rectify this error?
UPDATE 1
As per a suggestion, I tried,by putting the opencv_contrib folder outside the opencv folder structure. The new structure was like this
-Opencv
- build
-opencv_contrib
and my new command was
cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
the error is still the same.
Fixed it, thanks to this question. From that question, I understood that the value of the argument should be correct, to turn on the build or something like that. So I changed my command from
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..
to
cmake -DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules .
Plain and simple, without hierarchy information and it worked. Cheers.

Open CV using Cmake

I am working on a harr detecttion project. I want to generate the exe files using the .cpp files that come with Opencv. I am using CMake for it. When I try to do that I am getting an error like this. Don`t know how to solve it.
CMake Error at CMakeLists.txt:7 (ocv_check_dependencies):
Unknown CMake command "ocv_check_dependencies".
Configuring incomplete, errors occurred!
Source link: C:/opencv/apps/haartraining
Destination link: D:/build
Please help me.
I was working on some image processing that involves Haar detection. And i was having a hard time trying to configure with Cmake at first but i finally found manual configuration tutorial with out using Cmake or else. It has helped me a lot and you can get it here. I hope it will work perfect as it worked for me too. Click here -> http://www.anlak.com/using-opencv-2-3-1-with-visual-studio-2010-tutorial/. The tutorial uses open CV 2.3.1 but it will work perfect for recent versions too with the need for Cmake ore else.If you more questions, hit me up and i will explain.Good luck!
It looks like You need to compile the whole library with build examples option enabled (if You are using windows then I bet You use graphic cmake interface, so it shouldn't be a problem), and then You will find the .exe in bin directory,
or You would need to include OpenCVModule.cmake file found in cmake catalogue to CMake file You are trying to use for the build.
I didn't test the second option myself, but it looks like CMake file You are trying to use does not load all macros needed for it to run, but macros are loaded when the root library CMake file is used.

Resources