OpenCV haartraining: Mergevec error: Input file does not exist or not readable - c++

Following this tutorial, I've created my positive samples but need to merge them now, using mergevec. I downloaded the mergevec.exe binary file provided and got the two required dlls cxcore100.dll and highgui100.dll. However, when I run it like so:
mergevec samples.txt samples.vec
it gives me the error:
ERROR: Input file <filename> does not exist or not readable.
What should I do to fix this? My vec files are fine, because I was able to view them using the opencv_createsamples utility. So I know they're fine.

I ran into this issue as well and made a python utility that combines .vec files to avoid installing openCV again: https://github.com/wulfebw/mergevec
Hope it helps.

I was in the same situation as you few days ago so i'll try to help you out =P.
First of all i am interested to know where you found the mergevec.exe, because it isn't available to download anymore if i recall. I ask because i think that you might have downloaded an exe compiled on Linux. I had the same error when i tried to execute the mergevec, i had compiled on Ubuntu, on my Windows computer. Even with the 2 dlls.
As i explained it here , The mergevec from Naotoshi was originally made for Unix distribution, so under windows you will encounter a lot of problems. I first tried to do it on windows but i abandonned because it was too complicated and even with a full Cygwin installation i could not compile the mergevec.cpp.
What i advise you to do is to create yourself an Ubuntu virtual machine and to compile your own mergevec.exe. Once done you can copy your vec files in your virtual machine and merge them under Ubuntu. After this you can bring back the merged vec file to Windows if you want (It is better to not run the training under a VM: less computation power).
Here is what i did:
Installed VMware player with Ubuntu 14.0.4 (although i don't recommend it, still some bugs)
Installed OpenCV from the sources with TBB. There are a lot of tutorials, but the only one that worked for me is the OPenCV website, they are the more accurate on the libraries you mandatorily need.
I downloaded the GitHub classifier training and then I followed the commands given and it worked well.
If you encounter any library problem or OpenCV Installation issue don't hesitate i went through them too.

Related

Integration of Armadillo in x86 C++ Application in Microsoft Visual Studio

since last week I'm working with the "Armadillo" C++-library.
I started with a default 64-bit C++ application in Microsoft Visual Studio. For the installation I followed the steps in the post below:
How can I install Armadillo on Windows?
Following these steps, everything worked fine for me.
But now I have to expand my C++-application and have to include/integrate another .dll. The problem for me is, that this .dll is a 32 bit .dll. So when I try to call it in my 64-bit application, which uses the Armadillo library, I always get the "class not registered"-error. This is why I want to migrate my whole project into a x86-application. But for some reason I'm not able to migrate the Armadillo-library into this x86-application (Following the instructions in the link above doesnt works anymore). While building the programm I always get more than 50 "LNK2019" errors.
Does anyone know how to fix the problem and know who to integrate Armadillo into a 32-bit application?
Thanks for your help!!
Solved it.
For me it works with replacing the x64-bit "libopenblas.lib" and "libopenblas.dll", which are installed from Armadillo by default, with the x86 "libopenblas.lib" and "libopenblas.dll", which are included in the "OpenBLAS-0.3.15-x86.zip" download file from the OpenBlas release page on GitHub:
https://github.com/xianyi/OpenBLAS/releases
Probably it is enough to only replace the "libopenblas.lib" file.

OpenCV in Code::Blocks: The application was unable to start correctly (0xc00000be)

I set up OpenCV with Code::Blocks as per this tutorial: http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/.
I've got as far as building the test program at the end successfully, but when I try to run it I get the following error: "The application was unable to start correctly (0xc00000be). Click OK to close the application."
The one thing that is certainly different from the tutorial for me is that I'm working with OpenCV 3.0.0, Code::Blocks 13.12 and the latest version of mingw (number not obvious from their website or the installer).
I found that other people had had this problem in the past, e.g. The application was unable to start correctly (0xc00000be)
However, it has been a long time since that thread was active, I'm working with newer versions of the software and, most importantly, the answer given there didn't help (I compiled openCV with the same mingw that I'm using with Code::Blocks), so I thought this question would be worth asking (sorry if it's not, I'm rather new to this).
Could anybody suggest a fix that might get rid of this error?
A few other things to note:
I didn't download the Code::Blocks that came with mingw as I was advised against it, I got them separately as per the tutorial
I have installed OpenCV and Code::Blocks on my E: drive, though mingw is still on my C:.
I have added both mingw and OpenCV to my PATH variable, and mingw to my Path variable
I have linked the libraries in both the main compiler settings for Code::Blocks and the Build Options of my project.
I'm working from a 64-bit Windows 7 Laptop, but I have done everything 32-bit style as advised in the tutorial.
Thanks in advance!
So, one solution I've found to this problem is to copy all the .dll files from "...\opencv\build\x86\mingw\bin" to the project file (build directory).
Having done that, the project will run fine. This still doesn't (directly) explain why it wont run without those files (at least, several sources including the tutorial imply it should), and so isn't really optimal. I will continue to look for a solution for this so I don't have to clutter every opencv project I make with the .dlls.
However, for anyone simply wanting to get stuck into coding who is having this problem, I recommend that solution.

How to install SPAMS toolbox in Matlab 2014b under windows 8.1

I am trying to learn how to successfully compile "Sparse Modeling Software" (SPAMS) in my machine which uses a Windows 8.1 OS and MATLAB R2014b.
The steps I have taken are as followed (some parts might have been unnecessary or missing)
Step 1. Installed "Microsoft Visual C++ 2013 Professional".
Step 2. Installed "Microsoft Windows Software Development Kit (SDK)".
Step 3. Download "spams-matlab-v2.4-svn2014-02-18.tar" from http://spams-devel.gforge.inria.fr/
Step 4. Unzip it in Windows using 7-zip. Only 1 error I received but all he other data were uncompressed. The error is this :
ERROR: Can not set reparse data: C:\Users\Yashar\Desktop\spams-matlab\cpp_library\spams.h
Step5: In MATLAB, I set the compiler:
>> mex -setup C++
message I recieve:
MEX configured to use 'Microsoft Visual C++ 2013 Professional' for C++ language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the
new API. You can find more information about this at:
http://www.mathworks.com/help/matlab/matlab_external/upgrading- mex-files-to-use-64-bit-api.html.
Step 6. Open compile.m in SPAMS (as recommended) and run it. The error I get looks like this:
compilation of: -I./linalg/ -I./decomp/ -I./prox/ -I./dictLearn/ dictLearn/mex/mexTrainDL.cpp
Error using mex
C:\Users\Yashar\Desktop\spams-matlab\Files not found; check that you are in the
correct current folder, and check the spelling of
'C:\Users\Yashar\Desktop\spams-matlab\Files'.
Error in compile (line 391)
mex(args{:});
Question : What I am doing to me looks pretty standard but I know it takes a while learning how to cope with issues with regard to interfacing codes with MATLAB, etc. Can you please help me with getting around the problems I have and managing to compile SPAMS toolbox in my machine? FYI, I am interested in using mexLasso function in this toolbox.
Hmm. Compiling this toolbox is a bit tricky.
Here is how I do it in Windows 7 + MATLAB 2013a.
Hope it works for you.
(I don't have the issue of unzip)
First, you want to make sure that 'mex' works properly, I have compiled some smaller packages and they worked in general.
Second, change the line
compiler='gcc';
to
compiler='mex';
Third, you can find a lot of lines look like
-I./linalg/ -I./decomp/ -I./prox/ -I./spams/dictLearn/ dictLearn/mex/mexArchetypalAnalysis.cpp
Here 'I./lib_name/' is Linux style path, and you need to change it into something that Windows can understand.
Here is an example:
-I./linalg/ ---> -IC:\Users\XXX\Downloads\SPAMS\linalg
There are totally six pieces that you need to change as following,
-I./linalg/
-I./decomp/
-I./prox/
-I./dictLearn/
-I./dags/
-I./image/
After replacing these strings, just run compile.m, then it should work.
Select 2.5 version the SPAMS software you are running for Windows version. Set the compiler to VS in compile.m and execute the code. This generates the required files. Finally run start_spams.m, which in turn creates the source folders. Now you can run the respective code.

Installation wxWidgets with mingw64

I try to get wxWidgets installed on a Windows7 x64 Machine but wxWidgets Installation doesn't even work, I cannot get a Hello World App running.
I found out there are several ways to get the library installed and I tried some of them (with Cygwin and the included mingw64 compiler, with mingw64 using diffrent settings), all the time I get Errors while building the library. Could somebody point me out what's wrong with my current setup (which was also my first try) or show another solution?
First I installed mingw64 with the online installer to c:/mingw64. I tried some different setups concerning Version and Threads, but ended up with 4.9.2, x86_64, posix Threads, sjlj Exceptions.
Then I downloaded MYSYS from sourceforge.net and extracted it to C:/mysys.
Then I created a folder C:/wxWidgets and mounted it as /wxWidgets, downloaded the wxWidgets 3.0.2 source and put in into my mysys-home folder.
From /wxWidgets I executed: /home/Martin/wxWidgets-3.0.2/configure --host=x86_64-w64-mingw32 --disable-shared --enable-monolithic
The configure did his job without errors though some libraries couldn't be found and built-in libraries were taken instead (jpeg, png, regex, tiff, expat).
Then I executed make and it ran for some minutes and suddenly crashed. The only output was make: *** [monolib_any.o] Error 1
The last executed command was /wxWidgets/bk-make-pch ./.pch/wxprec_monolib -D__WXMSW__ ...
Right before, there is an note concerning POSIX paths: "CYGWIN environment variable option "nodosfilewarning" turns off this warning...
All the other tries ended up like this one, make suddenly hung up. Any help appreciated.
If the make/compile process really dies without any other error messages, the most likely explanations are that either it runs out of memory (but even then normally there would be some error message) or some hardware problem, it's really not supposed to do this on a working machine.
So my advice would be to run some hardware diagnostics. If this shows nothing, run make -n and execute the command used to compile any.cpp by hand by copy and pasting it.

OpenCV - How do I get started?

I just don't seem to be able to get OpenCV to work properly. Here's what I want to accomplish:
Use CodeBlocks (which I installed using codeblocks-10.05mingw-setup.exe) with OpenCV (installer: OpenCV-2.4.2.exe) on my Windows x64.
I've tried a lot of different configurations which will only bother you if I posted them all, so I hope you don't mind if I just ask the simple question: how do I get this to work?
I think I'm missing the smallest detail right now, so a detailed description of how to get started would be welcome.
If the OpenCV installer did the job, you should have by now OpenCV libraries and headers already installed in your system.
I would then go ahead and try to compile a hello world basic code, like the one you can get from here. If you would like to program using an IDE, like VisualC++ in Windows, you can follow this guide that will help you setting up the environment.
OpenCV team just introduced their new web site. There you can find Introduction to OpenCV section with installation instructions, including detailed instructions for Windows. Don't forget to cleanup your system before installation to avoid problems with mixing different install options. If you still can't get it working with CodeBlocks, follow Dan's advice and try compiling from command line.
When you are done with installation, go on and read there great new tutorials!