All right.
So our plan of attack proposed using something known as background subtraction for localization of the
robot.
But what is it exactly?
Let's look at a scenario.
Suppose you have set up a very nice looking garden in your backyard.
You have all sorts of plants of your liking and they all are being very well taken care of.
You can't wait to see them all bloomed up.
But viewed from some morning, you're noticing some very unsettling details about your garden.
Some of the plants have been destroyed.
Some leaves and fruits are on the floor.
What monster could have been responsible for this heinous crime?
You're all set and thinking what is causing all of this?
And do you have an idea?
You being a programmer, know some stuff and decide to set up a camera to record your garden while you're
away.
Whatever you did the next morning when you looked at the footage, it was clear as daylight that the
pesky intruder was a squirrel.
Now the question arises, what exactly was your solution?
Did you just record the whole day and watch it at a fast speed?
Surely that seems boring.
No.
You being a programmer knew about background subtraction.
What this handy tool does is that if you have a particular background that you know about, then using
that background you can detect any intruder.
That is not part of that background, be it a scorer.
So what you did was anything big enough that was not part of the background will cause the camera to
stop recording.
And once that object leaves, the recording stops.
So instead of watching the whole this video, you only got to see the intruder if it was present at
all behind the scenes.
This was happening in the algorithm when it was recording.
It knew to record the intruder as it was different from the background.
And that meant you knew exactly who that intruder was.
It was that -- score.
So to perform and to the detection using the algorithm known as background subtraction, the algorithm
was we use the image of the garden as the background as there would have been little change over time,
if any at all.
Then we subtracted this with the current frame to get the foreground.
If in the foreground any control had an area larger than that considered to be noise we record that
included.
Now we know that this algorithm works splendidly well, but we use it for localization of the robot.
Let's review the steps of background subtraction.
The number one step was model initialization.
Here we initialize the background model.
The number two step is foreground extension.
Here we separate the bedroom model with the current frame to get the foreground.
And finally, the more loved it in the case where we have a dynamic background.
Here.
An important consideration to make is to not confuse background subtraction with frame differences.
The reason is that in frame differences just simply difference in frames in different intervals of time.
This can be problematic in areas of similar intensity as they would be highlighted as areas of no change,
even if there was a change.
In contrast to this for background subtraction explicitly only take regions that are not part of the
foreground.
This means that anything that does come up that is part of the foreground will be highlighted as such.
So one question that might come to mind how do we get our background more?
One solution that is present is known as temporal average filtering.
Simple average filtering simply examines a sequence of images in a given time period.
This is known as the training period.
Here.
It evaluates the median of each pixel location in each of these images to create the final background
model.
So that was one method of modeling this transition.
But how are we going to address this issue before proposing an algorithm?
Let's make a few assumptions.
Starting with the scene is static.
So the model of this step is no longer required.
Second, the guard is the smallest object in the region, so this feature can be exploited to remove
it from the bedroom.
And finally, the temple.
Every square inch can be used.
If we manually move the guard and only take the static scene as the backdrop.
Now, with these assumptions, let's look at the algorithm that we'll be implementing.
So the algorithm starts sort.
So the algorithm starts off by checking if the bedroom model has been extracted or not.
If it has not been extracted, then we extract the bedroom model by simply removing the foreground.
That is the car.
And filling that region with a ground replica.
Then once we have the background, we extract the foreground using the background in the next few frames.
Now here, interestingly, we instead of using simple difference, we use absolute difference.
The reason is that here the foreground can have high intensity or low intensity in the background.
Then once we have.
And then once we have the foreground, we now get rid of all the noise by keeping only the largest control
and also checking if it is above a certain size.
Then once we have the robot location identified, then we get this precise location by simply computing
the movements of the cars going to it.
And this gives us the robot position.
To all this war fury.
Let us perform the calling of the location.
Want you.