opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
78.43k stars 55.75k forks source link

Error using -baseFormatSave #6630

Open Dsk128 opened 8 years ago

Dsk128 commented 8 years ago

Hi, I'm working with OpenCV 2.4.9 on Ubuntu 16.04. I tried to create my own cascade file with opencv_traincascade but for my application I need that the .xml is saved on the old format (opencv_haartraining). I tried to use the -baseFormatSave argument for this but when it finishes the training this error appears:

OpenCV Error: Unknown error code -6 (old file format is used for Haar-like features only) in save, file /home/mnl/opencv-2.4.9/apps/traincascade/cascadeclassifier.cpp, line 437
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/mnl/opencv-2.4.9/apps/traincascade/cascadeclassifier.cpp:437: error: (-6) old file format is used for Haar-like features only in function save

On terminal I'm writing:

opencv_traincascade -data data -vec cars.vec -bg bg.txt -numPos 500 -numNeg 500 -numStages 17 -w 48 -h 24 -featureType LBP -minHitRate 0.999 -baseFormatSave

Any ideas?

kevinhughes27 commented 7 years ago

old file format is used for Haar-like features only but you have set -featureType LBP. You'll need to set the feature type to HAAR if you need the old file type. If you want to use LBP features you'll need to update your program to load the new file. OpenCV does this for you though so it should work.

I would recommend to close this issue.