Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think he uses thresholding, but not on the image itself, but on the difference of two images.

Probably this application uses a fixed camera and he grabbed a reference frame that contains only the background. The application would work like this (pseudocode):

capture(referenceframe)  //get a frame which doesn't contain any foreground
do
    capture(newframe)  //capture a new frame
    read(backgroundframe)  //read (generate or capture) frame that will be the replaced background
    diff=abs(newframe-referenceframe) //calculate the difference between the two frames
    thresholdedDiff=threshold(diff,thresholdvalue);  //threshold
    denoisedDiff=open(thresholdDiff)  //some denoising
    result=denoisedDiff*newframe+(1-denoisedDiff)*backgroundframe; 
   // or: foreach pixel in denoisedDiff : if pixel==1 : resultpixel=newframepixel, else : resultpixel=backgroundpixel
    imshow(newframe,backgroundframe,result);
while(!keypressed)

I hope you get the idea, it isn't difficult at all. However it has some limitations, it won't work if the camera moves or the illumination changes (you have to update the reference frame).