Opencv_createsamples suddenly stopped producing vector files
Hello there,
I'm working a university project which makes use of haarclassifiers. I had been able to call the opencv_createsamples application to generate [num] vector files from a single image in the past. I understand that this method is less accurate for objects that are not rigid but it definitely helps boost the training data have.
My problem is that all of a sudden, whenever I call the opencv_createsamples application and I specify vector name, image name and background collection file, I get an error message from the computer that opencv stating the program has stopped working. When I try to use the debug function, it opens up visual studio and gives the following error:
Unhandled exception at 0x00007FF8D0DC775F (ntdll.dll) in opencv_createsamples.exe: 0xC0000374: A heap has been corrupted (parameters: 0x00007FF8D0E286B0).
I don't understand what I could be doing wrong and would very much appreciate any insight.
Information possibly related
- I am running opencv version 3.3
- I use a windows 64 bit computer
- I call the command on the windows command line interface
- I already setup my environment variables and just calling "opencv_createsamples" shows the usage
- I have previously generated vector files from on single image using this program
- My -w -h is proportional to my cropped images
- I have rebooted a bunch of times
Below is the command I run:
opencv_createsamples.exe -img cropped01.png -num 10 -bg negatives2.txt -vec vector/sampledat.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 30 -h 24
Also, here is the first few lines of negatives2.txt file, this is about a 1000 lines long:
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0015.jpg
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0016.JPG
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0017.JPG
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0020.JPG
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0037.JPG
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0038.JPG
C:\Users\afoge\Documents\Opencv_projects\HaarTrain\neg_images2\IMG_0039.JPG
It means that you're writing to an area of memory that is not owned by you. Are you sure that all of your loops reference a valid pixel index/location, things like that?
But I'm not calling any loops. I'm simply trying to run the opencv_createsamples application which stops running each time.
btw, you never told us, what you're trying to detect, but in the real world, this method of "synthesizing" positives from a single image NEVER works. you need a ton of REAL positive images, not generated ones.
also, please look at the docs , not at blogposts ..
Thanks for taking time to respond. Yes, I understand this. I am trying to detect a hand. I have 600 positive images that are real. I'm simply trying to generate around 25~ images for each real one I have. That will be used for vectors to boost my training data. I have read through the documentation for making use of the opencv_createsamples program and from my commands above it seemed to me like I had followed the expected usage. I just don't undertsand why I seem to be having problems with this particular program.