haar createsamples error
Hello.
I'm trying to create positive samples with the opencv_createsamples tool but i'm having some problems:
I want to detect this images
As I found, I can create positive samples using the createsamples tool with other background images.
_Folder structure:_
Parent folder (wehere I'm running the instruction)
│
─── haar
│ └─── neg
│ │ bg.txt (with path of the bg images)
│ └─── train
│ └─── pos
│ └─── images
│
└─── images (images to detect)
│ image1.jpg
Instruction i'm running:
opencv_createsamples -img images/image1.jpg -bg haar/neg/bg.txt -info haar/pos/info.dat -bgthresh 0 -maxxangle 0.3 -maxyangle 0.3 -maxzangle 0.3 -num 50 -w 150 -h 15
The problems are:
1 - Sometimes i get an error during the execution:
OpenCV Error: Incorrect size of input array () in cvGetSubRect, file /home/jorge/dev/fingerP/opencv-3.2.0/modules/core/src/array.cpp, line 1275
terminate called after throwing an instance of 'cv::Exception'
what(): /home/jorge/dev/fingerP/opencv-3.2.0/modules/core/src/array.cpp:1275: error: (-201) in function cvGetSubRect
2 - in other ocasions the execution finishes but neither images nor data into the _info.dat_ file has been created
3- When images are created (in the case 1 of these problems) the image looks like this:
with the positive image on it but cropped.
Can anyone help me?
Thanks!
are there different numbers in the images, you want to detect later ?
it somehow seems, your whole approach won't work at all.
chances of detecting a string of numbers/letters with a haar cascade like this are utterly low, worse even, if you use a single image for training.
Yes, there are different numbers but the idea is not to catch the numbers (at least at this step) but detect the box which contains this numbers.
I know that if I train the haar cascade with only this image it will try to detect only this box with this string. The idea is to use so many cases (many boxes with other strings) to try to detect boxes with numbers (if the positives has many different numbers, when the haar algorithm extract characteristics this will be generic for the numbers)
This single image is because with only one image i can show you the problems with the procedure to create samples (error during the process and image crop in the created positive images)
Do you think other approach to detect the box? Do you have any idea why this errors?
no idea, why it's crashing, but again, synthesizing many positives from a single image won't get you anywhere here, you either need ~1000 REAL positive images, or change the plan, and look for an alternative technique (swt,mser,there's a text-detection module in opencv-contrib)
Thanks, I'll try another approach but I don't know how to solve the crashes neither the image crop. No ideas?