Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

long story short .... as other similar thread on argument .... the file path was wrong ....

the path valid in every situation right path, TESTED ONLY ON UBUNTU (using gedit "classic" scheme colour+characters):

  1. /home/yourFolder/pos
  2. /home/yourFolder/neg
  3. /home/yourFolder/positives.txt
  4. /home/yourFolder/cars.info
  5. /home/yourFolder/cars.vec
  6. /home/yourFolder/bg.txt
  7. /home/yourFolder/data/........
  8. in my case: yourFolder = b/Scrivania

the erroneus PATH:

  1. inside positives.txt = pos/yourimage.png <--- these is right
  2. inside cars.info = pos/yourimage.png 1 0 0 100 40 <--- these is right
  3. inside bg.txt = neg/yourimage.png THESE IS ABSOLUTELY WRONG
  4. OTHER IS ALL RIGHT

THE RIGHT PATH INSIDE FILE:

  1. inside positives.txt = pos/yourimage.png <--- OK
    1. inside cars.info = pos/yourimage.png 1 0 0 100 40 <--- OK
    2. inside bg.txt = /home/yourFolder/neg/yourimage.png THESE RIGHT
    3. OTHER IS ALL RIGHT

so is possible to use the command as explain into tutorial and make the cascade ....

THE COMMAND:

  1. for make cars.info file: find /home/yourFolder/pos -name '*.pgm' -exec echo {} 1 0 0 100 40 \; > /home/yourFolder/cars.info
  2. for make bg.txt file find /home/yourFolder/neg -name '*.pgm' -exec echo {} \; > /home/yourFolder/bg.txt
  3. for make cars.vec opencv_createsamples -info /home/yourFolder/pos/cars.info -numPos 550 -w 48 -h 24 -vec /home/yourFolder/cars.vec
  4. for traincascade opencv_traincascade -data /home/yourFolder/data -vec /home/yourFolder/cars.vec -bg ~/home/yourFolder/bg.txt -numPos 500 -numNeg 500 -numStages 2 -w 48 -h 24 -featureType LBP

Problem Solved!

long story short .... as other similar thread on argument .... the file path was wrong ....

the path valid in every situation right path, situation, TESTED ONLY ON UBUNTU (using gedit "classic" scheme colour+characters):

  1. /home/yourFolder/pos
  2. /home/yourFolder/neg/home/yourFolder/pos (folder of positives images)
  3. /home/yourFolder/neg (folder of negatives images)
  4. /home/yourFolder/positives.txt
  5. /home/yourFolder/cars.info
  6. /home/yourFolder/cars.vec
  7. /home/yourFolder/bg.txt
  8. /home/yourFolder/data/......../home/yourFolder/data (folder of result "xml" file)
  9. in my case: yourFolder = b/Scrivania

the erroneus PATH:

  1. inside positives.txt = pos/yourimage.png <--- these is right
  2. inside cars.info = pos/yourimage.png 1 0 0 100 40 <--- these is right
  3. inside bg.txt = neg/yourimage.png THESE IS ABSOLUTELY WRONG
  4. OTHER IS ALL RIGHT

THE RIGHT PATH INSIDE FILE:

  1. inside positives.txt = pos/yourimage.png <--- OK
    1. inside cars.info = pos/yourimage.png 1 0 0 100 40 <--- OK
    2. inside bg.txt = /home/yourFolder/neg/yourimage.png THESE RIGHT
    3. OTHER IS ALL RIGHT

so is possible to use the command as explain into tutorial and make the cascade ....

THE COMMAND:

  1. for make cars.info file: file:
    find /home/yourFolder/pos -name '*.pgm' -exec echo {} 1 0 0 100 40 \; > /home/yourFolder/cars.info
  2. for make bg.txt file file:
    find /home/yourFolder/neg -name -iname '*.pgm' -exec echo {} \; > /home/yourFolder/bg.txt
  3. for make cars.vec cars.vec:
    opencv_createsamples -info /home/yourFolder/pos/cars.info -numPos 550 -w 48 -h 24 -vec /home/yourFolder/cars.vec
  4. for traincascade traincascade:
    opencv_traincascade -data /home/yourFolder/data -vec /home/yourFolder/cars.vec -bg ~/home/yourFolder/bg.txt -numPos 500 -numNeg 500 -numStages 2 -w 48 -h 24 -featureType LBP

Problem Solved!