Object detection using background Subtraction
Okay I have ezperimented with lot of haar cascades, HOG and all but none of them was very efficient to meet my purpose. I am working on a video processing project which include tracking of humans (mainly). I have a static background in hand (always). So I thought detecting the foreground objects would be very easy. I used subtracting method like this :
cv::Mat temp;
cv::subtract(camFrame,backImage,temp);
cv::threshold(temp,temp,25,255,cv::THRESH_BINARY);
But this doesnt seem to work well in getting only the foreground objects.I thk the varying lighting effects is also given as foreground from this. Is there anything I am missing in this process??. Everybody said its very easy if theres a static background. I am very new to image processing in opencv. I will be glad if somebody can help me out and appreciate some code as well