1
00:00:01,590 --> 00:00:02,070
All right.

2
00:00:02,790 --> 00:00:08,640
So our plan of attack proposed using something known as background subtraction for localization of the

3
00:00:08,640 --> 00:00:09,090
robot.

4
00:00:09,810 --> 00:00:11,280
But what is it exactly?

5
00:00:12,000 --> 00:00:13,140
Let's look at a scenario.

6
00:00:15,920 --> 00:00:19,400
Suppose you have set up a very nice looking garden in your backyard.

7
00:00:20,030 --> 00:00:24,890
You have all sorts of plants of your liking and they all are being very well taken care of.

8
00:00:25,550 --> 00:00:27,740
You can't wait to see them all bloomed up.

9
00:00:28,220 --> 00:00:33,950
But viewed from some morning, you're noticing some very unsettling details about your garden.

10
00:00:34,760 --> 00:00:36,410
Some of the plants have been destroyed.

11
00:00:36,980 --> 00:00:39,170
Some leaves and fruits are on the floor.

12
00:00:39,890 --> 00:00:43,310
What monster could have been responsible for this heinous crime?

13
00:00:44,030 --> 00:00:47,470
You're all set and thinking what is causing all of this?

14
00:00:47,810 --> 00:00:49,880
And do you have an idea?

15
00:00:50,780 --> 00:00:57,110
You being a programmer, know some stuff and decide to set up a camera to record your garden while you're

16
00:00:57,110 --> 00:00:57,410
away.

17
00:00:58,360 --> 00:01:03,700
Whatever you did the next morning when you looked at the footage, it was clear as daylight that the

18
00:01:03,700 --> 00:01:05,980
pesky intruder was a squirrel.

19
00:01:07,200 --> 00:01:10,770
Now the question arises, what exactly was your solution?

20
00:01:11,610 --> 00:01:14,790
Did you just record the whole day and watch it at a fast speed?

21
00:01:15,360 --> 00:01:16,860
Surely that seems boring.

22
00:01:17,550 --> 00:01:17,880
No.

23
00:01:18,780 --> 00:01:22,170
You being a programmer knew about background subtraction.

24
00:01:22,980 --> 00:01:28,710
What this handy tool does is that if you have a particular background that you know about, then using

25
00:01:28,710 --> 00:01:31,140
that background you can detect any intruder.

26
00:01:31,440 --> 00:01:34,320
That is not part of that background, be it a scorer.

27
00:01:35,070 --> 00:01:40,590
So what you did was anything big enough that was not part of the background will cause the camera to

28
00:01:40,590 --> 00:01:41,490
stop recording.

29
00:01:41,910 --> 00:01:45,000
And once that object leaves, the recording stops.

30
00:01:46,040 --> 00:01:52,550
So instead of watching the whole this video, you only got to see the intruder if it was present at

31
00:01:52,550 --> 00:01:54,800
all behind the scenes.

32
00:01:54,830 --> 00:01:58,070
This was happening in the algorithm when it was recording.

33
00:01:58,790 --> 00:02:03,560
It knew to record the intruder as it was different from the background.

34
00:02:03,710 --> 00:02:07,100
And that meant you knew exactly who that intruder was.

35
00:02:07,910 --> 00:02:09,590
It was that -- score.

36
00:02:11,840 --> 00:02:17,750
So to perform and to the detection using the algorithm known as background subtraction, the algorithm

37
00:02:17,750 --> 00:02:24,290
was we use the image of the garden as the background as there would have been little change over time,

38
00:02:24,500 --> 00:02:25,400
if any at all.

39
00:02:26,090 --> 00:02:30,800
Then we subtracted this with the current frame to get the foreground.

40
00:02:32,730 --> 00:02:38,940
If in the foreground any control had an area larger than that considered to be noise we record that

41
00:02:38,940 --> 00:02:39,480
included.

42
00:02:40,740 --> 00:02:46,800
Now we know that this algorithm works splendidly well, but we use it for localization of the robot.

43
00:02:47,160 --> 00:02:49,410
Let's review the steps of background subtraction.

44
00:02:51,750 --> 00:02:54,690
The number one step was model initialization.

45
00:02:55,080 --> 00:02:56,820
Here we initialize the background model.

46
00:02:57,960 --> 00:03:00,150
The number two step is foreground extension.

47
00:03:00,390 --> 00:03:04,260
Here we separate the bedroom model with the current frame to get the foreground.

48
00:03:05,010 --> 00:03:09,930
And finally, the more loved it in the case where we have a dynamic background.

49
00:03:12,150 --> 00:03:12,360
Here.

50
00:03:12,360 --> 00:03:18,140
An important consideration to make is to not confuse background subtraction with frame differences.

51
00:03:18,900 --> 00:03:24,780
The reason is that in frame differences just simply difference in frames in different intervals of time.

52
00:03:25,710 --> 00:03:33,660
This can be problematic in areas of similar intensity as they would be highlighted as areas of no change,

53
00:03:33,960 --> 00:03:35,520
even if there was a change.

54
00:03:36,440 --> 00:03:43,370
In contrast to this for background subtraction explicitly only take regions that are not part of the

55
00:03:43,370 --> 00:03:43,970
foreground.

56
00:03:45,770 --> 00:03:52,360
This means that anything that does come up that is part of the foreground will be highlighted as such.

57
00:03:53,820 --> 00:03:58,410
So one question that might come to mind how do we get our background more?

58
00:03:59,630 --> 00:04:04,460
One solution that is present is known as temporal average filtering.

59
00:04:05,860 --> 00:04:11,890
Simple average filtering simply examines a sequence of images in a given time period.

60
00:04:12,220 --> 00:04:14,260
This is known as the training period.

61
00:04:15,840 --> 00:04:16,110
Here.

62
00:04:16,110 --> 00:04:25,530
It evaluates the median of each pixel location in each of these images to create the final background

63
00:04:25,530 --> 00:04:25,920
model.

64
00:04:27,180 --> 00:04:29,940
So that was one method of modeling this transition.

65
00:04:30,150 --> 00:04:34,290
But how are we going to address this issue before proposing an algorithm?

66
00:04:34,560 --> 00:04:36,000
Let's make a few assumptions.

67
00:04:36,390 --> 00:04:38,370
Starting with the scene is static.

68
00:04:38,580 --> 00:04:41,250
So the model of this step is no longer required.

69
00:04:42,000 --> 00:04:47,370
Second, the guard is the smallest object in the region, so this feature can be exploited to remove

70
00:04:47,370 --> 00:04:48,510
it from the bedroom.

71
00:04:48,960 --> 00:04:50,910
And finally, the temple.

72
00:04:50,910 --> 00:04:52,470
Every square inch can be used.

73
00:04:52,650 --> 00:04:56,790
If we manually move the guard and only take the static scene as the backdrop.

74
00:04:57,370 --> 00:05:01,830
Now, with these assumptions, let's look at the algorithm that we'll be implementing.

75
00:05:03,820 --> 00:05:05,250
So the algorithm starts sort.

76
00:05:07,120 --> 00:05:11,500
So the algorithm starts off by checking if the bedroom model has been extracted or not.

77
00:05:11,890 --> 00:05:17,260
If it has not been extracted, then we extract the bedroom model by simply removing the foreground.

78
00:05:17,680 --> 00:05:18,520
That is the car.

79
00:05:19,410 --> 00:05:22,230
And filling that region with a ground replica.

80
00:05:23,070 --> 00:05:29,460
Then once we have the background, we extract the foreground using the background in the next few frames.

81
00:05:30,300 --> 00:05:37,380
Now here, interestingly, we instead of using simple difference, we use absolute difference.

82
00:05:37,920 --> 00:05:44,490
The reason is that here the foreground can have high intensity or low intensity in the background.

83
00:05:45,330 --> 00:05:46,380
Then once we have.

84
00:05:47,480 --> 00:05:54,340
And then once we have the foreground, we now get rid of all the noise by keeping only the largest control

85
00:05:54,530 --> 00:05:58,190
and also checking if it is above a certain size.

86
00:05:59,980 --> 00:06:07,870
Then once we have the robot location identified, then we get this precise location by simply computing

87
00:06:07,870 --> 00:06:10,210
the movements of the cars going to it.

88
00:06:10,450 --> 00:06:13,060
And this gives us the robot position.

89
00:06:14,180 --> 00:06:15,470
To all this war fury.

90
00:06:16,080 --> 00:06:18,650
Let us perform the calling of the location.

91
00:06:18,700 --> 00:06:19,040
Want you.
