System and method for identifying an object in an image
A method for processing image data includes identifying a background scene in a background frame of an image. Each of a plurality of pixel locations in the background frame is set as a respective background pixel. For each of the pixel locations, a respective running mean and a respective running variance are determined based on a brightness component of the background frame at the pixel location. A subsequent frame is identified as a current frame. For each of the pixel locations in the current frame identified as a background pixel, the running mean is updated based on one of a plurality of mean weights and the running variance is updated based one of a plurality of variance weights. For each of the pixel locations in the current frame, an identification is made if the current pixel location is one of a background pixel and a foreground pixel based on a brightness component of the current pixel location in the current frame, the running mean of the current pixel location, and the running variance of the current pixel location.
1. A method for processing image data, the method comprising:
identifying a background scene in a background frame of an image;
setting each of a plurality of pixel locations in the background frame as a respective background pixel;
for each of the pixel locations, determining a respective running mean and a respective running variance based on a brightness component of the background frame at the pixel location;
identifying a subsequent frame as a current frame;
determining a mean weight associated with the current frame based on exposure settings of an image capturing device significantly changing;
for each of the pixel locations in the current frame identified as a background pixel:
determining a pixel mean weight based on whether one of the current pixel location changed in the current frame from a foreground pixel to a background pixel and the current pixel location did not change in the current frame from a foreground pixel to a background pixel;
updating the running mean based on one of the mean weight and the pixel mean weight;
updating the running variance based on one of a plurality of variance weights;
for each of the pixel locations in the current frame:
identifying if the current pixel location is one of a background pixel and a foreground pixel based on a brightness component of the current pixel location in the current frame, a current running mean of the current pixel location, and a current running variance of the current pixel location; and
updating the running mean for the current pixel locations identified as a foreground pixel.
2. The method for processing image data as set forth in claim 1 , further including:
repeating the step of identifying a subsequent frame as a current frame along with the steps of updating the running mean, and updating the running variance for each of the pixel locations in the current frame.
3. A method for processing image data, the method comprising:
identifying a background scene in a background frame of an image;
setting each of a plurality of pixel locations in the background frame as a respective background pixel;
for each of the pixel locations, determining a respective running mean and a respective running variance based on a brightness component of the background frame at the pixel location;
identifying a subsequent frame as a current frame;
determining a variance weight associated with the current frame based on exposure settings of an image capturing device significantly changing;
for each of the pixel locations in the current frame identified as a background pixel:
determining a pixel variance weight based on an exposure associated with the current frame;
updating the running mean based on one of a plurality of mean weights;
updating the running variance based on one of the variance weight and the pixel variance weight;
for each of the pixel locations in the current frame:
identifying if the current pixel location is one of a background pixel and a foreground pixel based on a brightness component of the current pixel location in the current frame, a current running mean of the current pixel location, and a current running variance of the current pixel location.
4. The method for processing image data as set forth in claim 3 , wherein the step of updating the running mean includes updating the running mean according to:
RM Pixel=((1−Weight M )*Prev RM Pixel)+(Weight M *Pixel BC ),
where: RMPixel is the updated running mean for the current pixel location in the current frame;
WeightM is a current mean weight for the current pixel location in the current frame;
PrevRMPixel is the running mean of the current pixel location from a previous frame; and
PixelBC is the brightness component of the current pixel location in the current frame.
5. The method for processing image data as set forth in claim 3 , wherein updating the running variance based on the variance weight includes updating an instantaneous variance according to:
PixelVar=(Pixel BC−RM Pixel) 2
where: PixelBC is the brightness component of the current pixel location; and
RMPixel is the current running mean value at the current pixel location.
6. The method for processing image data as set forth in claim 5 , wherein the step of updating the running variance based on a current pixel variance weight includes updating the running variance according to:
RV Pixel=((1−Weight V )*Prev RV Pixel)+(Weight V *PixelVar),
where: RVPixel is the updated running variance for the current pixel location in the current frame;
WeightV is the running variance for the current pixel location in the current frame;
PrevRVPixel is the running variance of the current pixel location from a previous frame; and
PixelVar is an instantaneous variance of the brightness component of the current pixel location with respect to a background value.
7. The method for processing image data as set forth in claim 3 , wherein the step of identifying if the current pixel location is one of a background pixel and a foreground pixel includes identifying if the current pixel location is one of a background pixel and a foreground pixel according to:
diff 2 =(Pixel BC−RM Pixel) 2 ,
where: PixelBC is the brightness component of the current pixel location in the current frame; and
RMPixel is the updated running mean for the current pixel location in the current frame; and
identifying if the current pixel location is one of a background pixel and a foreground pixel based on diff 2 .
8. The method for processing image data as set forth in claim 7 , wherein the step of identifying if the current pixel location is one of a background pixel and a foreground pixel includes identifying if the current pixel location is the foreground pixel if:
diff 2 >a predetermined threshold; and
diff 2 >(k*RVPixel),
where: RVPixel is the updated running variance for the current pixel location in the current frame; and
k is a constant.
9. The method for processing image data as set forth in claim 3 , further including:
identifying a bounding box surrounding a group of the foreground pixel locations;
identifying each of the pixel locations within the bounding box as a foreground pixel for updating the running variance.
10. The method for processing image data as set forth in claim 9 , further including:
defining the bounding box as any geometric shape.