Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can not change width height (-w -h parameter) in opencv_trainingcascade.exe???

Hello all,

I try to use opencv_traincascade.exe to detect my object (rear of car). But i have a problem when i choose size -w -h. This is all af step i do. _ I have positive.txt which have absolute direction to all of image which ha object. _ I have negative.txt which have absolute direction to all of background image. _ Now i use opencv_createsamples.exe to create vector file with command.

D:\Project_Android\Classifier\bin\opencv_createsamples.exe -info positive.txt -vec vector.vec -num 1000 -w 72 -h 48

Which this command, it run and i have vector file which have 1000 positive sample, size 72x48. Now, i use opencv_traincascade.exe to train, i know that size of train image had to equal size of createsample. so my command is:

D:\Project_Android\Classifier\bin\opencv_traincascade.exe -data HaarTraining -vec vector.vec -bg negative.txt -numPos 250 -numNeg 1500 -numStages 10 -nonsym -minhitrate 0.999 -maxfalsealarm 0.5 -mode ALL -w 72 -h 48 -precalcValBufSize 2046 -precalcIdxBufSize 2046 PAUSE

It not run and say error "Assertion failed <_img.row*_img.col==vecSize> in CvCascadeImageReader::PosReader::get, file C:buildslave64\win64_amdoc1\2_4_PackSlave-win6411-shared\opencv\apps\traincascade\imagestorage.cpp, line 149". More error detail is shown in below picture.

image description

In this picture i see, size of image still config width 24 height 24. And one more thing -precalcValBufSize and -precalcIdxBufSize 2046 is stll config defaul value 1024. it seem to be no change with -w -h -precalcIdxBufSize -precalcValBufSize althought i configed it. So i don't know what problem with it. I was change version of opencv 2.4.11, 2.4.12, 3.1, lastest 2.4.13. But no thing happen, It still auto config defaul value for -w -h -precalcIdxBufSize -precalcValBufSize and i can set value for this parameter.

if i use size 24x24 for createsample and haartraining. It's training good, just can use 24x24 , other sizes are still say error like above. So what problem with it and how can i fix it to get new size, i would like to use size 72x48 (i use win 7 64 bit and i was copy bin folder of opencv C:\Users\BAOTRUONG\Desktop\opencv\build\x64\vc11\bin ).