Does OpenCV need to be compiled before using? - opencv

I'm trying to install OpenCV on Windows. Following are how I installed it:
Download OpenCV 2.4.2.exe from sourceforge.
unarchived it.
open Eclipse CDT.
Add C:/opencv/include/opencv to "Includes"
Add opencv_highgui, opencv_core, opencv_ml... to "Libraries"
Create a small project and compiled it.
The compiler complained about "opencv2/core/core_c.h:No such file or directory"...
I remember that when I install OpenCV on Ubuntu, I did compiled the project (it took quite a bit of time). Do I have to do the same thing on Windows? Or is any other thing causing this error?
Thanks.

You should add correct directories to includes.
Since you added C:/opencv/include/opencv, there is no way for compiler to find C:/opencv/include/opencv2/core/core.h.
I believe you should enter C:/opencv/include/ to includes directories as well.

Related

How do I remove openCV

I am trying to remove opencv fully from my system. I was trying to learn ROS, while in tutorials I faced an issue. After creating empty workspace I invoke
catkin_make
It gives an common error, I searched and asked around in answers.ros
here is the link of the question
I think I found out the problem was opencv libraries which I had build before installing ROS-Noetic, creating the error, I searched around how to remove opencv, but non of the answers totally remove opencv without removing my opencv names files.
Is there a common solution on how to remove opencv?
Ubuntu 20.04
ROS Noetic
Best way if you installed opencv from source and still have the build directory, simply go there and call make uninstall. Another solution is to delete all opencv related files as you already know and suggested in many other similar questions like this. You could also try to use synaptic package manager if you installed using a package.
I suggest for the future to install development libraries a custom folder, so it will be just a matter of deleting that folder if something goes wrong. In this way you can also have different opencv versions in your system, this is how I do.

Cannot compile OpenCV for iOS with nonfree module

I'm attempting to compile the OpenCV framework for iOS using the nonfree module. Right now, I'm not able to compile the OpenCV framework, period. I would use the stock iOS opencv2.framework download from the website, except it doesn't include the nonfree module that I need for my project. I've been following the instructions as prescribed here:
http://answers.opencv.org/question/61663/how-to-make-opencv2framework-with-opencv_contrib/
as these appear they might be out of date
http://docs.opencv.org/2.4/doc/tutorials/introduction/ios_install/ios_install.html
https://github.com/Itseez/opencv/issues/4712
However, when I run the command from a folder outside the building directories "python opencv-master/platforms/ios/build_framework.py --contrib opencv_contrib-master ios_contrib" it spits out the following error:
http://pastebin.com/LUep8Tdw
The error doesn't mean much to me. I thought at first it was related to me building it inside the same directory as opencv, but I tried it outside of it and it still failed. Any thoughts? I've tried everything I can possibly think of, and done a bunch of research without coming up with anything.
It appears there's some issue with one of the modules in opencv_contrib. I'm not sure what it is, but I was using version 3.0.0-rc-1. The way I got around it was by moving specific modules from the module folder in the contrib folder into the regular opencv directory's modules folder and then compiling the framework from scratch.

Linking Header File with Main.Cpp file in Codeblocks

I am trying to use codeblocks to compile the code available here
The thing is every time I try to build and run, I run into the following error:
|/.../head_pose_estimation/opencv2/core/core.hpp|48|fatal error: opencv2/core.hpp: No such file or directory
Does anyone know how I can fix this? Thank you!
You do not have the pre-built (compiled) version of OpenCV, what you currently have are the source files. If you want to do something special with OpenCV (Target/GPU SUpport etc) then you will need to build the framework using an appropriate guide.
If however you simply want to use OpenCV in the most common way then download the pre-built libraries from the OpenCV.org website.
NOTE:
If you are using OpenCV with MinGW compiler, I do not remember if the pre-built is actually pre-built for MinGW. (I dont think they do) In this case you will HAVE to built the libraries. You can find a guide here

Opencv dll issues

I was following a tutorial for object detection using opencv, I did it step by step but when I run it, I got this error -
The program can't start because opencv_244d.dll is missing from your computer.
Try reinstalling the program to fix this problem.
I don't know what is the problem because I can see this dll in opencv libraries, I have added the following to the input dependencies:
opencv_core244d.lib
opencv_imgproc244d.lib
opencv_highgui244d.lib
opencv_ml244d.lib
opencv_video244d.lib
opencv_features2d244d.lib
opencv_calib3d244d.lib
opencv_objdetect244d.lib
opencv_contrib244d.lib
opencv_legacy244d.lib
opencv_flann244d.lib
This is still not working, what can I do?
You can find the required dll files into the bin folder (that is next to lib folder where the .lib files are located), and you have two options:
1) copy the required dlls into the same folder with your application //this is a little better because it kind of prepares you for when you'll need to deploy your application on systems that don't have opencv installed (for then don't forget to build the release version of your application)
or
2) add to the Path in the Environment Variables your path to that bin folder (be carefull that the path in there are separated by ; )
I would advise you to build the OpenCV libraries from source so that you can have a custom installation specific for your system (this is always better since it gives you the option of using what you want/need and also the performance is better since the libs are custom-made for your system).
OpenCV does not contain a library file called "opencv_244d.dll".
Check all your dependencies and their names so you don't have any misspelled names. All the names are something like "opencv_name244d.dll" such as "opencv_photo244d.dll".

OpenCvSharp throws DllNotFoundException

I have similiar problem as was presented here, but with opencv_imgproc231.dll (opencv_core231.dll is loaded correctly in my case).
I installed OpenCV 2.3.1 and set environment variable PATH to foldres in "vc9\bin" folder. I added all OpenCvSharp dlls to references. When I run my c# program, it loads opencv_core231.dll correctly, but opencv_imgproc231.dll cant find (is in tha same directory as all opencv dlls). I tried copy opencv dlls to folder where is executable file, but it showed same error.
I did all what he did - C++ red. pack. 2008, 2010SP1, set PATHs, copy openCV dlls to folder, where is executable file - but nothing works, still DllNotFoundException for opencv_imgproc231.dll.
I have VS2008 and Windows 7 32bit.
My program contains only one row: "IplImage image = new IplImage(128, 128, BitDepth.U8, 1);".
Thanks for any advice.
Pavel.
I found this issue at google code http://code.google.com/p/opencvsharp/issues/detail?id=97
add tbb.dll (from opencv/build/common/tbb) to PATH or same folder of the executable works for me :)
Ok, I solved it. There is problem in precompiled openCV DLL. So if you have similar problem, recompile openCV and it will work. I dont why, but precompiled opencv_imgproc230.dll has 1579008 bytes and my recompiled opencv_imgproc230.dll has 1568768 bytes, but it works.

Resources