I want to compile an OpenCV program where there is the header :
#include <mrpt/otherlibs/do_opencv_includes.h>
#if (MRPT_OPENCV_VERSION_NUM>=0x240) && MRPT_HAS_OPENCV_NONFREE
# include <opencv2/nonfree/features2d.hpp>
#endif
It require a version of OpenCV higher that 0x240.
I installed the OpenCV3 in my computer and now I have two versions of Open CV one lower that 0x240 and the other one is 3.0. When executing the program, it doesn't recognize the version 3.0.
What should I do ?
Thanks,
Younès
Building MRPT against OpenCV 3.0.0 has been very recently fixed in the master branch on GitHub, so if you get the code from there it should work now.
Related
I'm a beginner in using OpenCV and I get this error when I try to compile my main.cpp-file (among many other errors):
I do not know what I'm doing wrong here. I downloaded OpenCV 2.4.13 zip-file, extracted it into my project folder (see the image) and included the cv.h-file into my main.cpp. What do I need to do? What causes this problem?
I'm using Ubuntu 14.04 LTS, Codeblocks 13.12.
According to the error messages, you are mixing the local OpenCV instance headers (/home/jjepoh/Document/codeblocks_workspace/opencv/opencv-2.4.13/include/opencv) with the system-wide instance (/usr/local/include/opencv2/).
The system-wide instance is probably a different version, and because the local instance most likely uses "#include <opencv/xxx.h>" for inclusion of dependent headers, the system-wide location is selected in preference. So at the end you get a mixture of two different versions of OpenCV, which apparently doesn't work.
There are basically two (or three) possibilities to fix:
Install the new version system-wide.
Remove the different system-wide version (probably an opencv devel package).
Not use the new version and use the system-wide version installed in the system.
Ok, just got my first Raspberry pi (3). Went on to install Opencv 3.1.0 using Adrian's guide:
How to Install Opencv 3 on Raspbian Jessie
Installed OpenCV WITH CONTRIB packages as I knew I would need them.
So OpenCV is working fine now. The issue is when I try to use SIFT:
"'module' object has no attribute 'xfeatures2d'"
I did and still do everything by the book, including working on 'cv' environment etc.
I tried checking the site-packages dir of both the python dir and the 'cv' env dir and couldn't find any mention of 'contrib' or 'xfeatures2d'.
Maybe that's the problem? How can I check that the contrib packages were actually compiled with OpenCV?
Thanks in advance.
Because u installed the latest version in OpenCV where they removed sift and surf, I am not sure how they substitute them, anyway u have to install older version of opencv 3.4.2.16 also make sure that opencv contrib of the same version is installed, thats the last working version working with sift/surf not sure if there are special versions for raspberry pi
I was able to install and build openCV following the instructions here (http://charliegerard.github.io/blog/Installing-OpenCV/). But after successfully creating the dynamic libraries I noticed in the lib directory there are 3 instances of each library named in the following format:
libopencv_LibName.3.1.0.dylib
libopencv_LibName.3.1.dylib
libopencv_LibName.dylib
Screenshot of the libraries
My next step is to single out only the header files and libraries I need for my project, and I'm not sure if I really need all 3 instances of every library in use. Why does make create all these extras? And which ones do I need?
Additional Info:
OS: OSX El Capitan
IDE: Xcode 7.3.1
When you build the opencv library it creates the actual *.dylib binary (libopencv_LibName.3.1.0.dylib) that contains the release, the major, and minor version. (Release = 3, Major = 1, Minor = 0). This allows you to have a dynamic style of linking to a specific version of the library. (For example, opencv often is not completely compatible between release versions. (From 2.x.x to 3.x.x), however it often is compatible between major/minor versions.(3.0.x to 3.1.x) )
By linking to the 3.1.0 version, you are locking in on requiring that specific version of the libary. (If you update opencv, it will still be using openCV 3.1.0).
However if you link to the 3.1 version, it is only caring about the Release and Major version, but will allow minor version updates. (Currently the 3.1 is a symlink to 3.1.0, but if you installed 3.1.1, it would now reference the 3.1.1 library.) I generally find it best to link to this one as it will allow you to update for bug fixes, but will not break any functionality.
Finally there is the version-less symlink, this one will always reference the latest version of opencv you have installed. Currently it references 3.1.0, but if you installed 3.1.1 it will now reference 3.1.1. This would not be bad, but if you were to install 4.0.0, it would now be referencing this binary and likely break some of the API.
I'm trying to compile a C++ program that uses OpenCV to score the similarity of two images:
Image Histogram Compare
When I g++ compile the file:
'opencv2/imgcodecs.hpp' file not found
#include "opencv2/imgcodecs.hpp"
I updated the opencv formula on Mac OS X. I re-ran brew install, but I still get this error.
mdfind imgcodecs.hpp -name
returns nothing - the file is nowhere on my system.
Does anyone know my imgcodecs is not included, and how to include it? I'm really novice at C and OpenCV, and enormously grateful for any help.
I notice that you are looking at tutorial code on the master branch (aka 3.0.0). It uses an imgcodecs module that is not present in earlier versions of OpenCV (e.g. 2.4.9).
Check which version of OpenCV you have (it seems not 3.0.0) and use a matching version of tutorial code (e.g. OpenCV 2.4.9 Histograms_Matching/EqualizeHist_Demo.cpp)
I am trying to build and use a piece of C++ code that uses OpenCV. I am working on Linux, working in Code::Blocks (and the code was originally also developed on a Linux platform using C::B).
I followed this to install OpenCV (Ubuntu 12.04 & OpenCV 2.4.3). The project compiles fine, but when I try to execute it, it crashes on launch, with the following message about how it can not find the library:
(file_address): error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
Process returned 127 (0x7F) execution time : 0.017 s Press ENTER to continue.
I set all the parameters for the linker according to several Code::Blocks install tutorials.
I also checked in /usr/local/lib/ for my libraries (it is the folder I gave to Code::Blocks' compiler); and while I do have a libopencv_core.so, a libopencv_core.so.2.4 and a libopencv_core.2.4.3, I do not have a libopencv_core.so.2.3.
So I'm wondering what the issue is. Is it about backwards compatibility, i.e. do I have to install the exact same version of OpenCV used to develop the original code? (This would be a bit concerning, since I am trying to make a widely-usable library).
Could I force it to use libopencv_core.so.2.4 instead?
EDIT: I managed to make it work by removing everything and reinstalling with a simple apt-get. Sometimes it's the simplest method that works the best! From now on I'll try to apt-get before following installation tutorials. ;)
Have a nice day!