Ask Your Question
0

Creating Haar Cascade OpenCV 3.2

asked 2017-03-03 04:00:30 -0600

Mohamed Slama gravatar image

Hello, I'm using this command to create info file but no info created

opencv_createsamples -img Left.jpg -bg neg.txt -info info/info.lst -pngoutput info -maxxangle 0.5 -maxyangle 0.5 -maxzangle 0.5 -num 1000

neg.txt file sample is :

./openLeftEyes/Takenori_Kanzaki_0001_L.jpg
./openLeftEyes/Ciro_Gomes_0001_L.jpg
./openLeftEyes/Georgi_Parvanov_0001_L.jpg
./openLeftEyes/Richard_Tubb_0001_L.jpg
./openLeftEyes/Jennifer_Tilly_0001_L.jpg

command not showing any errors but info.lst is empty.

so any suggestion plz, Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-03-03 04:19:09 -0600

berak gravatar image

first, please have a look at the tutorial

-info is actually an input argument, you're expected to give a file with image names and annotated positive rects there, it will not produce any output file.

also, you're lacking the mandatory -vec some_file argument where the desired positive vector should go, and values for -wand -h (the desired training window size).

then, trying to "synthesize" multiple positive samples from a single positive image usually does not produce any good results, so instead:

  • collect many positive images (as many as you can)
  • use the opencv_annotation tool (from apps folder) to generate a pos.txt with imagenames and annotations
  • use that file with the -info argument with create_samples
  • proceed with train_cascade

good luck !

edit flag offensive delete link more

Comments

1

ps, since your negative samples are like "xx_openeye", i'll infer, that you're trying to make an "closed eye detector" ?

chances, that this can be done using haar cascades are very low.

imho, first detecting the eye position using some landmark library, and then applying a 2-class svm trained on open/close eye samples , would work much better.

berak gravatar imageberak ( 2017-03-03 04:42:10 -0600 )edit

Hello, Thanks sir for advise i'll try this solution and write you a comment when i finish i think the answer is correct so i will mark as solved. i'm following form this tutorial: https://pythonprogramming.net/haar-ca... so, i only copied and pasted the command any suggestion for another tutorial ?? i'm working on a project to detect drowsy drivers Thanks.

Mohamed Slama gravatar imageMohamed Slama ( 2017-03-03 08:45:44 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-03-03 04:00:30 -0600

Seen: 259 times

Last updated: Mar 03 '17