Haar Training: error (-215)_img.row * _img.cols == vecSize in function
The error does not seem to be a result of large number of positive or negative samples. People do train very large data sets!
From the parameters described above, it can be noticed that the dimension of the positive samples that form the samples.vec is 24x24, which is denoted by the statement:
sampleWidth: 24
sampleHeight: 24
But while calling the opencv_traincascade
function, you try to set the dimension as 80x40. Try changing this to -w 24 -h 24