I just built opencv version 3.3.1 from source and I'm trying to link the libraries in a CMakeLists.txt file. In order to do that I need to know the install location.
It looks like I found it to be located at /usr/local/include. What is throwing me off is there are two "opencv" titled folders in this directory, one is name open "opencv" the other is named "opencv2". However there is no "opencv3" folder, but when I run $opencv_version in my terminal I get output "3.3.1-dev". So I know I've successfully installed opencv version 3, however I don't see a similarly named directory.
When looking at my make install output I see lines like:
Installing: /usr/local/include/opencv2/highgui/highgui.hpp
-- Installing: /usr/local/include/opencv2/highgui/highgui_c.h
-- Installing: /usr/local/lib/libopencv_superres.so.3.4.1
-- Up-to-date: /usr/local/lib/libopencv_superres.so.3.4
so it looks like I'm installing opencv version 3 with a directory named "opencv2". Did the engineers who made opencv version 3 really name their install directory opencv2???
I just would like confirmation to make sure I'm not crazy.
The short answer is yes.
I set the install directory for opencv in my make file as "/usr/local/include/opencv2" and the library was found. Also thanks to api55 for confirming my suspensions.
Related
I am trying to run Lightgbm with gpu on Spyder. For installing the library I tried many commands but most have failed.
I tried "pip install lightgbm --install-option=--gpu" in anaconda prompt and got the
error.
The I followed the https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#build-gpu-version
I installed git, vs 2022, cmake and opencl(Cuda Toolkit)
For boost binaries I copied the boost_1_78_0 file in "C:\Boost".
But the file doesn't contain any "lib64-msvc-14.0"(or similar folder). This is the first problem but it contain libs folder so I gave that path(Hope that's right).
But then I get this error:
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.
"CMake Error: The source directory "C:/Users/User Name/LightGBM/build" does not appear to contain CMakeLists.txt"
Any help is appreciated. Thanks
I am trying to build this code:
https://docs.opencv.org/3.2.0/d5/d6f/tutorial_feature_flann_matcher.html
I am using Ubuntu 16.04 with CLion 2017.3 and have OpenCV 3.4 installed.
xfeatures2d.hpp can't be found on the system.
I have looked at many different problems on the internet, but couldn't find a solution.
Any help?
You have to include cmake comiplation flag to opencv OPENCV_EXTRA_MODULES_PATH and set it to the opencv_contrib/modules.
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules
Here's what I had to do to compile OpenCV with xfeatures2d:
Download opencv_contrib (I took a release from the releases page). This step is what gives us xfeatures2d.
Unpack the tarball somewhere, e.g., ~/src/opencv_contrib-4.5.5
When configuring OpenCV (the main OpenCV source like opencv-4.5.2) with CMake, add the following option to cmake command line (adjusting the value to be your actual path to the modules subdirectory of the opencv_contrib tarball):
-DOPENCV_EXTRA_MODULES_PATH=$HOME/src/opencv_contrib-4.5.5/modules/
Now just build as you normally would and install.
The above actions gave me the expected file (among others): /usr/include/opencv4/opencv2/xfeatures2d.hpp.
I am currently having issues with the find_package(opencv) which give me the error message:
-- Could not find the required component 'OpenCV'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
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.
So.. Yeah, a solution would add the prefix_path, but how do i make it work with find_package() without explicitly stating the path it has to look for.. why can't it find it in the first place, the problem by doing this is that the CMakelist is shared amongst a group a people, in which I am the only one having this issue despite, having the .cmake file at the same location..
I am running it on a ubuntu machine.
OpenCV v2.4.8
And the .cmake files are located at
/usr/local/share/OpenCV/OpenCVConfig.cmake
/usr/share/OpenCV/OpenCVConfig.cmake
opencv is installed as sudo apt-get install libopencv-dev
how can I change the cmake file provided with the package? I am having troubles with OpenCV and found one possible solution:
So you can edit cmake/OpenCVDetectionVTK.cmake.
At line 6, change "vtkRenderingOpenGL" to "vtkRenderingOpenGL2".
But where do I change that if I am using port install?
If you look on directory up (out of directory build whether you create it) you will see the "cmake/"
Mine is look like this:
3rdparty CONTRIBUTING.md README.md build data include platforms
CMakeLists.txt LICENSE apps cmake doc modules samples
Open cmake then you will find it.
I hope this help you.
I am compiling a dependency for a project on Ubuntu 10.10, and instead of having it install to /usr/local by default, I am instead installing it to /tmp/stage/usr/local. How do I go about informing CMake of the location of this custom installed dependency when I call it to generate the build files for said project.
I am running CMake 2.8.1, and I have tried to set CMAKE_PREFIX_PATH on the cmake command line, like so
cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local
but this doesn't seem to make a difference - the project doesn't seem to detect the dependency.
Also, if it matters, the project in question is OpenCV 2.2, and the dependency in question is FFMPEG...
I figured out how to fix my problem, and trying to point CMake at the appropriate install location isn't the issue.
Apparently, CMake is unable to find the pkg-config files for FFMPEG (i.e. libavcodec.pc, libavdevice.pc, etc.) that tell it where the FFMPEG headers and libraries are located. In a typical install scenario, these files would be located at /usr/lib/pkgconfig. However because of the custom install location, they are instead located at /tmp/stage/usr/local/lib/pkgconfig.
So that CMake could find these files, I had to add the following environment variable:
export PKG_CONFIG_PATH=/tmp/stage/usr/local/lib/pkgconfig
After which point, OpenCV built against FFMPEG as expected.