Problem with OpenCV C++ Ubuntu 16.04-/usr/bin/ld: cannot find -lopencv_* - opencv

I am new to Ubuntu. I installed OpenCV following http://milq.github.io/install-opencv-ubuntu-debian/. Note that opencv_contrib are not installed. I had an error initially that opencv4.pc file was not found which I corrected by creating a new opencv4.pc in usr/local/lib and making appropriate changes in ~/.bashrc file. Now the error while compiling using c++ file from :
https://cv-tricks.com/installation/opencv-4-1-ubuntu18-04/.
This is the error I got:
.
I tried to locate the missing files in other locations but I was unable to find them. Please help me solve my problem.

Related

Lightgbm gpu installation

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

fatal error: opencv2/xfeatures2d.hpp: No such file or directory

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.

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.

OpenCV library file not present(imgproc.hpp) in Windows

I am a newbie to OpenCV. Followed the openCV tutorial. Now when i Build the project, the error comes. It says the include directory imgproc.hpp was not found. When i checked in the opencv/include/opencv2 folder, there were no imgproc.hpp and ml.hpp and video.hpp files. Please help. Working on Win32 and OpenCV2.4
You might be missing a directory, try: opencv/include/opencv2/imgproc/imgproc.hpp

Resources