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
Related
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!
I did not download and unzip OpenCV manually. Instead I relied on apt-get to install OpenCV.
The only place I can find are header files in /usr/include/opencv2
No link to OpenCV GitHub link please. It would be a pain later if it turns out that the code I am using on my PC is different from the one in GitHub.
I have looked at this post but I am not sure where OPENCV_HOME is.
If you do a pkg-config:
pkg-config --cflags opencv
You will find the include files, header files like you give above. I think you are referring to cpp files. Since you downloaded with apt-get you dont have cpp files on your disk. You are going to face the github reality in this case. Just get the same version source code from github. But I dont think of any usage of source code besides compiling. If you want to search the source of a function just use the github web interface, it is easier and a lot helpful
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.
I would like to to build and install OpenCV in debug mode on my Mac. I prefer do do this in Homebrew since Homebrew manages everything else in my /usr/local and is able to properly uninstall.
I have edited the Homebrew formula to add -DCMAKE_BUILD_TYPE=DEBUG to the cmake command-line.
But the main challenge now is to keep the source around after the build, or perhaps, copy the source first to a permanent location and do the build from there. I believe this is necessary to be able step into OpenCV in Xcode debugger.
Is there a simple way to do this in Homebrew? If not, are there any examples of custom formulas that do this sort of thing? I'm not very familiar with Ruby so any sample code would be helpful.
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.