How to setup opencv2.4.0 with mingw in Netbeans? - netbeans

How to setup opencv2.4.0 with mingw in Netbeans? I want to make the setup in windows xp x86 machine?
Updated:
I made a setup as set in this link SO link. My program get compiled properly but while executing, it got crahed.
I also Posted the same in this link-MyPost
User PATH Variables:
C:\ctags;C:\cscope;C:\MinGW\bin;C:\OpenCV2.4.0\build\x86\mingw\bin;
System PATH variable:
./bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem;C:\Program
Files\Intel\WiFi\bin;C:\Program
Files\TortoiseSVN\bin;C:\WINDOWS\system32\gs\gs7.05\bin;C:\cscope;C:\ctags;C:\Program
Files\Vim\vim73;C:\Program Files\QuickTime\QTSystem\;C:\Program
Files\Java\jre6\bin;C:\Program Files\Windows
Imaging\;C:\MinGW\msys\1.0\bin;C:\OpenCV2.4.0\build\x86\mingw\bin;C:\MinGW\bin;
Update:
I tried compiling and adding TBB path in windows 7. Even after adding the PATH I get the same issue and the snap shot of the error is below:
I tried the same in windows XP and I didnt get the above error but the application get crashed as before.

Did you do this?
Since version 2.1, OpenCV use the TBB library to support parallel processing.
If you use MinGW as a compile suite you should compile TBB yourself
http://opencv.willowgarage.com/wiki/TBB
http://opencv.willowgarage.com/wiki/MinGW
After compilation, you need to add its path to system path.
FYI, OpenCV 2.4.2 provided with compiled TBB dll for MingW.

Related

Problem with setting up Mingw w64 for C++. Possible conflict with existing Anaconda/Jupyter?

While I am setting up MinGW-W64 (from sourceforge) exe file (for Windows 10) for C++, it shows a message that it was not downloaded correctly. My best guess is that I have a Anaconda/Jupyter setup having MinGW-W64, and it is making all the fuss. How to set it up for both C++ (VS Code / Code lite) and Python/Jupyter/Anaconda?
Make sure you don't mix versions in environment variables like PATH.
Maybe your download was bad?
Or you may have an antivirus software preventing the installation...
You could try a standalone MinGW-w64 build from https://winlibs.com/, which doesn't requite installation - just extract the archive and point VSCode to it.

why does the error regarding gcc is occuring in matlab?

I have download that code from github.
Whenever that code tries to check mexopencv (a file inside lib folder). It shows an error on Matlab 2017a that is:
[error 3] please make sure gcc >= 4.4 g++ >= 4.4 is installed ...
I am having a gcc version of 8.8.0
Following is the description of system
Window 10
Visual Studio 2012
Matlab 2017a
opencv 2.4.10
mexopencv (install from your folder LIB)
You might lack of standard libraries (.dll in Windows but .lib in Linux). The code was developed under Linux (help is also only provided for Linux systems) and once tested under Windows 7.
The method was tested under OS linux lubuntu 14.04, CPU intel i5 and
16GB of RAM. This guide was written under a linux-based distribution
scope, more precisely debian. Unfortunately we lack experience to
address bugs or any problem that could emerge in non-linux OS, we will
provide only linux OS help regarding execution problems, we apologise.
we tested this code on Windows7. We successfully installed opencv
2.4.10 following this tutorial: [http://www.learnopencv.com/install-opencv3-on-windows/]
This suggests that the mex-function is also linux-based. The error should vanish if you compile the source code yourself on your system, e.g. with MinGW (also GCC), see here.
EDITED:
the README.markdown file (under LIB/mexopencv-master.zip) provides a little guide through the installation process of both, openCV and the mexopencv function for unix (including ubuntu 14.04) and Windows systems. The latter states:
Browse to mexopencv root folder, and type the following in the MATLAB
command window:
>> mexopencv.make
By default, mexopencv assumes the OpenCV library is installed in
C:\opencv. If this is not the case, specify the path as an argument:
>> mexopencv.make('opencv_path', 'c:\your\path\to\opencv')
Note that if you build OpenCV from source, this path specification
might not work out of the box. You need to replace dll files in the
OpenCV package with newly built binaries. Or, you need to modify
+mexopencv/make.m to correctly link your MEX-files with the library.
To remove existing mexopencv binaries, use the following command.
>> mexopencv.make('clean', true)
It requires a standard C++ compiler supported by Matlab (see here), any Visual Studio installation should be OK, as an open-source option MinGW is recommended. Just remember to pick the right system (usually 64-bit).

library error after compiling

Using 2012b on Centos6 I compiled my code using deploytool.
To be sure I'm doing things correctly, I re-install the MCR to make sure I'm using the exact version matlab wants me to use. Following the instructions after installing the MCR (v83) I append the corresponding paths to LD_LIBRARY_PATH and XAPPLRESDIR.
When I use the run_myProgram.sh script. It echos out the library paths and I can see that the MCR paths are correct.
However, at the startup of my compiled program, I'm getting this error:
"error while loading shared libraries: libmwmclmcrrt.so.8.0: cannot open shared object file: No such file or directory"
Anyone out there have a way to fix this? For example, is it a problem with my system configuration or a problem with my deployment?
The plot thickens. I noticed that in the MCR installation, I only have libmwmclmcrrt.so.8.3. How does the deploytool not give me the version I need?
thanks!
You need to download MCR version 8.0 for r2012b. Please see the table here : MCR Version Table

How to set up Matlab MCR for Ubuntu and Netbeans (UnsatisfiedLinkedError)

I am deploying a Java EE project in a server that uses the MCR of Matlab for some image processing functions. I've been trying this for months I can't make it work. The problem is when it is going to uses the MCR it cannot find the .so libraries. I got this error:
javax.servlet.ServletException: Failed to find the library libmwmclmcrrt.so.7.13, required by MATLAB builder JA, on java.library.path. This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or r the current path configuration. The MCR version that this component is trying to use is 7.13.
ROOT CAUSE:
java.lang.UnsatisfiedLinkError: Failed to find the library libmwmclmcrrt.so.7.13, required by MATLAB Builder JA, on java.library.path. This library is typically installed along with MATLAB or the MCR, its absence may indicate an issue with that installation or the current path configuration. The MCR version that this component is trying to use is: 7.13.
The servers uses:
Ubutuntu 64 bits.
Netbeans 7.4
Glassfish
java 6 sdk
first it uses MCR 7.13 now it uses MCR 8.1
Things I've already tried:
Setting the environment variables LD_LIBRARY_PATH and XAPPLERSDIR with export:
export LD_LIBRARY_PATH=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64:$LD_LIBRARY_PATH
export XAPPLRESDIR=/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults
Setting the environment variables LD_LIBRARY_PATH and XAPPLERSDIR with setenv:
Command setenv not found
Edit ld.so.conf file and run ldconfig
Add -Djava.library.path=my/path/to/so in glassfish
Add -Djava.library.path=my/path/to/so in Netbeans like says here:
giving 'java.library.path' in netbeans for .dll/.so files
I tried to set environment variables in Netbeans like said in this post: How to set Environment Variable in Netbeans?
But I can't find "Actions"
I tried to set environment variables in Netbeans like said in this post: https://askubuntu.com/questions/267071/ld-library-path-specification
But I can't find "Environment"
I've tried lots of more things that I can't remember and none of them works, it keeps showing the same error (now for version 8.1 instead of 7.13). Please I would I appreciate any help.
I had the same problem working with Linux, Java EE and Matlab. My solution was:
Open a terminal
Log as root $ su and type password
Edit the /etc/enviroment $ gedit /etc/enviroment
Add the needed variables, in our case:
LD_LIBRARY_PATH="/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/sys/java/jre/glnxa64/jre/lib/amd64"
XAPPLRESDIR="/usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/X11/app-defaults"
Save the file and reboot.
Start the server as root.
What happened with your other solutions, like the export, was that there was no visibility between the variables that you created and the GlassFish server. Setting variables in the environment will asure you that they are visible from any other program/process.

Error: Invalid MEX file, the specified module could not be found

I have compiled Mex file successfully on my laptop. But when I am running it, it says Invalid mex file 'c:\newfolder\filename.mexw32' The specified module could not be found.
System specification:
OS: windows 7
MATLAB 2010a
Microsoft Visual Studio 2008.
The same mex file is compiled and run successfully on my PC under XP SP3.
This MathWorks support link suggests two possible reasons to your problem:
You do not have all of the necessary libraries that the MEX-function is dependent upon.
You are running a MEX-file on a different version of MATLAB than it was compiled on.
Either way, to locate the source of this error it says that you need to list all dependent library files and verify their existence in the system you're trying to run the MEX file on, and also recommends the Dependecy Walker as the tool to to do that.
Do you you the mex file on another system than the one it is created on?
If so, then you need to install the Microsoft Visual C++ Redistributable on that machine.
I had this problem also when upgrading from Matlab2010a/VS2008 to Matlab2013a/VS2010.
All my environment variables were sent correctly.
A reboot fixed problems with OpenCV dlls not being found, I assume that it was still trying to link to the OpenCV dlls for VS2008 (even though I had changed the path). However still my mex file could not find libmex.dll.
When I installed Matlab2013a, I did not uninstall the old version (in case I wanted to go back).
However that was the cause of my problem.
Once I uninstalled the old version of Matlab and rebooted again, the problem was gone.
I had a similar problem. I was only linking against 1 'lib' so I simply copied that lib into the same folder as the mexw64 and it worked.
I have not poked around for the correct place to tell MATLAB to add the lib's real location to whatever path it's looking at.