Reputation: 3582
Up to here, my code is as follows:
IplImage* firstImg ;
IplImage* secondImg;
cv::Mat firstMat ( firstImg );
cv::Mat secondMat ( secondImg );
cv::Mat subMat = firstMat - secondMat;
cv::Mat medianMat;
int d = 5;
cv::medianBlur ( subMat, medianMat, d );
cv::Mat BGModel;
BGModel = firstMat - medianMat ;
CvSize size;
size.width = BGModel.cols;
size.height = BGModel.rows;
IplImage* BGImg;
cvSetData ( BGImg, BGModel.data, size.width * 3 );
Then I couldn't figure out any way to proceed on my next step, in which I need to update the mean value of each pixel in the background model with respect to the median filtered difference image from two images. Is there anyone can help in this? Example codes would be much appreciated. Many thanks in advance!
Upvotes: 0
Views: 471
Reputation: 1456
I did not actually get your question but if you are looking for moving object detection and background modeling here are the links to help you
The Gaussian Background Modelingis far superior than the median background modelling. The link also has some example code....
Upvotes: 1