This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

background subtraction

i am doing background subtraction .i have acheived that but there is one problem , background subtraction get overlapped with background model(stored initial frame).it is not only background subtraction.  i have done it in grayscale using cb=cr=0x80.i am using pal system

the function for storing background model(copyframe),the function for background subtraction(subtract) & the function for returning frame(writeframe) to vpbe driver  are as follows respectively 

1)

void copyframe(void *currentFrame)
{ int xx = 0;
for( xx = 0; xx < 829440; xx+=1 )
arr[xx]=*( ( (unsigned char*)currentFrame+xx ));

}

2)

void subtract(void *currentFrame)
{

int xx = 0;
for( xx = 1; xx < 829439; xx+=2 )
{
arr1[xx]=*( ( (unsigned char*)currentFrame+xx ))-arr[xx];
arr1[xx-1]=arr[xx-1];
}
}

3)

void writeframe(void *currentFrame)
{
int xx = 0;
for( xx = 0; xx < 829440; xx+=1 )
*( ( (unsigned char*)currentFrame+xx ))=arr1[xx];
}

arr[xx] is array for background model of size 829440 i.e,(720*576*2)

arr1xx] is array for background subtracted frame of size 829440 i.e,(720*576*2)