Three ways to configure OpenCV with Visual Studio? - opencv

I've been trying to configure OpenCV 2.4.6 C++ VS for many weeks with a pre-built library. I'm getting nowhere. It seems there are three ways:
Manually by changing the environmental variables.
Nuget. Apparently, out of my league.
Cmake, again out of my league.
I've been down many paths with the manual method. Tutorials, etc. They just don't cut it. Something is just different that stops me. For example, a moment ago, I noticed in the "close" list above, "OpenCV and VS config " looked hopeful. Someone there said to see his web site. It was in Spanish. Often the IDEs are just not the same.
Comments?

Read this page. This is a sample CMakeLists.txt file:
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
project (SO_example)
FIND_PACKAGE (OpenCV REQUIRED)
file (GLOB SOURCES "*.h" "*.cpp")
add_executable (so_example ${SOURCES})
target_link_libraries (so_example ${OpenCV_LIBS})
Put this along with your header and source files and then build your project files using the CMake GUI. That should do it.
HTH

Related

java.lang.UnsatisfiedLinkError: no jnind4jcpu in java.library.path

I started using the 1.0.0-beta2 version of deeplearning4j and I am getting the following error when attempting to start:
java.lang.UnsatisfiedLinkError: no jnind4jcpu in java.library.path
In looking around, I came across this issue: https://github.com/deeplearning4j/nd4j/issues/1687
where the solution seemed to be an incomplete set of packages. I have confirmed that I have nd4j-native-platform-1.0.0-beta2.jar, but this jar file contains no libraries as what seemed to be the problem in the issue mentioned above.
I have looked at the maven repository and things are strange there as well:
For https://mvnrepository.com/artifact/org.nd4j/nd4j-native-platform, the list of files under "View All" seems incomplete for the 1.0.0-beta2 version and the existing jar files under older versons also don't seem to contain any binaries so I am unsure as to where the binaries are supposed to be.
Thanks,
Jason
Do you have a specific OS you are trying? It should work out of the box if you just use platform. Platform includes numerous dependencies. I'm not sure what "incomplete" might be, but if you browse the real maven central (not this website, please do not use it):
https://repo1.maven.org/maven2/org/nd4j/nd4j-native/1.0.0-beta2/
You'll see jars for everything here. We have pretty good coverage publishing for every OS all the way to android and IOS.

How can I add contrib modules to opencv3.1.0? (Windows 10, Visual Studio 2015)

I'm doing a simple AR-Project for school and have to use opencv for it. I found it quite tricky to install in visual studio but now it's working fine. Now I want to use the aruco module, I tried this tutorial, but after building the bin folder is missing and the includes in my code don't work anymore... Is there a (preferably easy) way of adding the contrib modules into my (saved and functioning) opencv-folder?
EDIT: I successfully build opencv with modules (using cmake gui and vs14) and the includes for my old code are working fine, but when I try to use the aruco module I get these: Error Message
The files are all where they are supposed to be and I set all paths and additional dependencies as well as the include directory...
Any Idea what's wrong?
OK - I did it.
I disabled all other modules in cmake and now the includes for aruco work.
But I can't really explain myself why the other (unused) modules corrupt the aruco libraries?

OpenCV 2.4.2 library files using CMake and MinGW - Target IDE CodeBlocks

I have been having this issue with OpenCV 2.4.2 that it doesn't really get installed properly with Microsoft VS 2010 Express; It is always missing a dll file or two doesn't matter what I follow by Googling. Also, Visual Studio 2010 Express is only valid for a few days, so it is acceptable that VS will not behave well with OpenCV at that point. However, when I changed my IDE to CodeBlocks, it is even stranger because now I have missing dll files and also "Missing Entry Point" error because of a duplicate .dll file. I found this guide and followed what it told me to do:
http://conanhung.wordpress.com/2012/05/23/opencv-2-2c-codeblocks-and-mingw-got-it-working-on-windows/
But it still doesn't work!! What I am after is a complete and definitive solution to integrating OpenCV (preferrably 2.4.2 version) on a Windows 7 64-bit machine. I have been turning Stackoverflow inside out but no solution is working for me. The problems are
WHEN USING VISUAL STUDIO:
Missing dll file (e.g. libopencv_core242d.dll, etc.)
WHEN USING CODE BLOCKS:
First it complains that libstdc++-6.dll is missing. When I download it to my C:\MinGW\libexec\gcc\mingw32\4.7.0 folder, it stops complaining about this. But now it complains that there is any entry point problem and some other .dll file is missing!!!
If someone has managed to make it work by hook or crook, I will be more than happy to know what it is, IN DEPTH. I don't believe that such an important library can be so stupidly distributed so that developers have to struggle night and day to make this work.
FYI, I have tried even the OPenCV website and frankly their instructions are a bit useless. Also, all the necessary information e.g. adding PATH, adding includes and libraries, etc. Please someone point me to the right direction as it has been two days and I cannot get anywhere. It is literally stopping my job now :(
As an answer, but probably a very simple one, I did the following and got rid of the problem:
1) Uninstalled code::blocks completely from the PC and downloaded the IDE-only version (i.e. withouth MinGW compiler), then installed it.
2) Downloaded the latest stable version of MinGW, installed, and added C:\MinGW\bin to PATH
3) Followed rest of the instructions from [link] http://conanhung.wordpress.com/2012/05/23/opencv-2-2c-codeblocks-and-mingw-got-it-working-on-windows/
4) Just to be sure, copied the opencv .dll files from the build folder (i.e. the one that you have created "make" and "install" files using CMake) to the debug (i.e. the executables') folder.
This will fix the problems. In case, it doesn't it might be that you need to add some environment variables.

What is windows system path?-About Devcpp Opencv

I've looked into it through older questions and by using google, but I can't find an asnwe to my problem.
I have been trying to get devcpp to work with opencv2.1. I configured it with cmake and generated files. Then I compiled it with Mingw32-make command through a windows 7 cmd. Whichever way I tried to link stuff from devcpp, it's never worked. It keeps giving me cv::freecast(void) error.
I have seen some people talking about setting things to the system path. What is that system path exactly ?
Thanks in advance.
You have to tell Windows where to look for the openCV libraries when asked. There are two options:
Not to tell windows where to look for the .dll and put them in the same folder as the project
Tell windows where are the .dll by adding them to the system path
Here in "Compile using Visual Studio" point 3 you can see how to do it.

OpenCV 2.1 Strange Errors

I'm not sure if this is the right place for asking these kind of question but I have no better place in mind.
After LOTS of coding in OpenCV, I'm trying to migrate to new C++ interface of openCV which has been introduced in OpenCV 2.0. but I keep getting strange errors.
For example:
trying to use pre-built dlls and libs, I got exceptions in "cv::warpAffine" and "findContours" cv::function at runtime. I compiled the openCV, used my own build of libs and dlls and everything got fixed!
the same problem happened in linux.
linking the "Debug" built dlls with "Release" built of program cause some unexpected runtime errors, and vice versa.
and some other errors.
can anyone helping me with what I'm doing wrong? (please keep in mind that I coded alot with older version of openCV).
When I migrated to C++ interface I couldnt make openCV work until I compiled the source by myself. Probably DLL's and Libs that are installed with opencv are good only to a specific machine.
Another thing. Try to do the following if you use Visual Studio
go to Project Properties->Click the C/C++ folder->Code Generation->Runtime Library and change it to /MDd in Debug configuration and /MD in release
It solves a problem with esceptions related to STL
Some of the functions ave moved out to new libs (especially some of the stereo functions are in calib3d) and the header file structure is completely changed in 2.2
There are some guides to the configuration eg for visual studio

Resources