0

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.

user961627
  • 12,379
  • 42
  • 136
  • 210
  • that tutorial was nice, but its 7 years old now. create_samples is ok for a quick start, but you won't get any good cascade from that. instead, get a lot of 'real' positive images. for the training. – berak Apr 07 '14 at 14:57
  • Thanks.... unfortunately I've only got a few. At least for demonstration purposes, would about 10-15 positive samples and about 100 negative samples make for a reasonable classifier? :( just for demonstration purposes... – user961627 Apr 07 '14 at 15:08

2 Answers2

5

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.

randomcastle
  • 111
  • 1
  • 11
  • It doesn't work. I have 5 .vec files with 1000 samples each but after running your code, I still get the output file having only 1000 and not 5000 samples. – Sumeet_Jain Apr 17 '16 at 07:08
1

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.

Community
  • 1
  • 1
Lucas
  • 106
  • 1
  • 5