Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Reference Image for Background Subtraction Method over specified time interval

I am facing an issue with tracking based on background subtraction method,

the issue is the noise created in the image after a while from capturing the reference image due to illumination change. I know to deal with non-uniform or changing lighting conditions, adaptive thresholding should be used, but seems its not effective in my case.

 

Picture 1: Perfect Background Subtraction without noise (reference image taken at t)

Image 1.png

 

Picture 2: Noise is created due to (t+delta which causes illuminationn change) (same reference image used taken at t)

Image 2.png

 

Picture 3: Adaptive Thresholding

Image 3.png

 

How to update the reference image over specified time interval t+delta ?

 

 

0 Kudos
Message 1 of 7
(3,775 Views)

If the object of interest is moving regularly, you can store a background image every few seconds or minutes.  Use the last three (or five or eight, etc.) images to generate a composite background image without the object.  You could average the images together (works best with large number of images).  You could also look at each pixel and take the median value, but that would require converting all the images to arrays, analyzing the arrays, then converting the resulting array back to an image.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 2 of 7
(3,767 Views)

Since you have light blobs you want to remove from a dark background, I would try an 'open'. This is an erosion followed by a diliation. If you're working on the Block Diagram, these operations fall under IMAQ Morphology. If you're working in the Vision Assistant, they're under Greyscale Morphology.

 

The erode decreases the size of a blob by a small amount (I think 1 px). You'll want to do this a few times - but keep track of it. Once all the small blobs you don't want are gone, call dilate n times to grow the remaining bright area (which is normally the subject you want to remain in the picture) by a corresponding amount.

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
Message 3 of 7
(3,750 Views)
first use remove small object in your subtract image try increase other of object size until your main object remain but smaller one remove
then use histogram analyse for your subtract image for time that you do not have any motion of your object
and then repeat it this time with your object motion
after analyse some image of your background with this method you will be found out your noise order in histogram and also your object motion order in histogram
so after that you can use shareholding method on histogram to found out that if you have object motion of it is just noise
Message 4 of 7
(3,745 Views)

If the object of interest is moving regularly, you can store a background image every few seconds or minutes. "

 

I did that with a flat sequence structure (true,false boolean and a delay) and a case structure to snap background images over time. But im facing issues with the delay values: (wait function)

 

- when delay is set to small values (seconds): 6000 ms - the background image is snapped perfectly and the vi works fine

- when delay is set to larger values (minutes): 360000 ms [6mins] - the background image is not snapped and the vi doesn't work properly [which is the case i want to implement]

 

tried also time delay express vi and got the same results,

any clue how can i fix that ?

0 Kudos
Message 5 of 7
(3,697 Views)
that is weird you should not have such problem maybe you have some wrong algorithm in your code
could you send your vi ?
may be i could fix that problem
Message 6 of 7
(3,676 Views)

Thank you for your help, I've managed to solve the problem

0 Kudos
Message 7 of 7
(3,653 Views)