A method of regenerating the background of a digital image of a video stream produced by a fixed camera and including a plurality of time-sequential frames, with each one including a respective unit image, the method comprising:
- setting an initial background image in a memory;
- cutting the unit images of the video stream into blocks b(i, j, t) of at least one pixel;
- cutting the background image into corresponding blocks Bo(i, j, t) having the same size and the same coordinates (i, j) as those of the unit images;
- selecting at least one block b(i, j, t), b(i, j, t−a), Bo(i, j, t−a), and Bo(i, j, t);
- and
- calculating the space correlation thereof, wherein the space correlation comprises calculating
- 1) the space correlation (Corr_spat_mes_b, Corr_spat_mes_b_Bo) between a given block b(i, j, t) of the frame image, at a time (t), and
- 1a) at least one block Bo(i±x*δi, j±y*δj, t) of the background image close to said block Bo(i, j, t), at a time (t), or
- 1b) at least one block Bo(i±x*δi, j±y*δj, t−a) of the background image close to said block Bo(i, j, t−a), at another time (t−a), or
- 2) the space correlation (Corr_spat_mes_Bo, Corr_spat_mes_Bo_b) between a given block Bo(i, j, t) of the background image, at a time (t), and
- 2a) at least one block Bo(i±x*δi, j±y*δj, t) of the background image close to said block Bo(i, j, t), at a time (t), or
- 2b) at least one block Bo(i±x*δi, j±y*δj, t−a) of the background image close to said block Bo(i, j, t−a), at another time (t−a), or
- 2c) at least one block b(i±x*δi, j±y*δj, t) of the frame image close to said block b(i, j, t), at a time (t),
- where (i±δi, j±δj) are the coordinates of a block adjacent to a block having the coordinates (i, j) and x and y are integers;
- and
- calculating the time correlation (Corr_temp_mes_b) between a given block b(i, j, t) of an image at a time (t) and the same block b(i, j, t−a) of an image or of several images at a preceding time (t−a);
- or
- calculating the time correlation (Corr_temp_mes_Bo) between a given block Bo(i, j, t) of an image at a time (t) and the same block Bo(i, j, t−a) of an image or of several images at a preceding time (t−a);
- and
- updating the background image according to the space correlation and the time correlation;
- wherein the space correlation coupled to a measure of the time correlation is measured (sum1) on at least two frames, where the weight of the space correlation is weighted by a parameter λ depending on time λ(t), so that
- Sum1=Corr_temp_mes—b(i,j,t)+λ(t)*Corr_spat_mes—b—Bo(i:i±x*δi,j:j±y*δj,t:t);
- wherein the space correlation coupled to a measure of the time correlation is measured (sum2) on at least two frames, where the weight of the space correlation is weighted by a parameter λ depending on time λ(t), so that
- Sum2=Corr_temp_mes—Bo(i,j,t)+λ(t)*Corr_spat_mes—Bo(i:i±x*δi,j:j±y*δj,t−a:t);
- and
- wherein the value of the block Bo(i, j, t) is updated by selecting the minimum value of both values (Sum1, Sum2);
- in which
- δ represents a change,
- Corr_spat_mes_b_Bo (i:i±x*δi, j:j±y*δj, t:t) is the sum of the space correlations between block b(i,j,t) at a time (t) and at least one block Bo(i±x*δi, j±δj,t) of the background image at the same time (t),
- Corr_spat_mes_Bo (i:i±x*δi, j:j±y*δj, t−a:t) is the sum of the space correlation between block Bo(i, j, t−a) of the background image at a time (t−a) and at least a block Bo(i±x*δi, j±δj, t) of the background image at a time (t), with {x,y}ε{1;
- 2;
- . . . ;
- Δ}2.