AI_DL_Assignment / 5. OpenCV Tutorial - Learn Classic Computer Vision & Face Detection (OPTIONAL) /18. Blurring - The Many Ways We Can Blur Images & Why It's Important.srt
| 1 | |
| 00:00:01,430 --> 00:00:06,440 | |
| So moving on to conclusions and bring that the first thing to notice that the convolution isn't and | |
| 2 | |
| 00:00:06,490 --> 00:00:12,620 | |
| we can see the function Pizzi it's an actual mathematical operation once that's performed between two | |
| 3 | |
| 00:00:12,620 --> 00:00:19,560 | |
| functions and it produces a function which is obviously an output coming out of the original operation. | |
| 4 | |
| 00:00:19,580 --> 00:00:21,230 | |
| So this is sort of illustrated here. | |
| 5 | |
| 00:00:21,380 --> 00:00:22,760 | |
| We have an image here. | |
| 6 | |
| 00:00:23,070 --> 00:00:29,250 | |
| Then we run it by a function of convolution and our function has offices in kernel size. | |
| 7 | |
| 00:00:29,540 --> 00:00:31,260 | |
| And what do we mean by kernel size. | |
| 8 | |
| 00:00:31,310 --> 00:00:36,840 | |
| Well this really here represents a 10 by 10 image or pixel image here. | |
| 9 | |
| 00:00:37,460 --> 00:00:39,340 | |
| And this is a 5 by 5 you know. | |
| 10 | |
| 00:00:39,780 --> 00:00:44,560 | |
| So what this does here the convolution basically operates on one pixel at a time. | |
| 11 | |
| 00:00:44,600 --> 00:00:53,690 | |
| So operating on this here of a pixel to do so deconvolution basically operates on this pixel but it | |
| 12 | |
| 00:00:53,690 --> 00:00:59,230 | |
| takes into consideration all the pixels around it and its calculation you'll see why that's important. | |
| 13 | |
| 00:00:59,240 --> 00:01:06,380 | |
| When we get introduced to blurring which is what we're about to do now so there is an operation which | |
| 14 | |
| 00:01:06,380 --> 00:01:11,320 | |
| you obviously figured out that is an image so you can clearly see here. | |
| 15 | |
| 00:01:11,360 --> 00:01:13,060 | |
| This is a shopping shift an elephant. | |
| 16 | |
| 00:01:13,140 --> 00:01:19,570 | |
| I took a call just to do the zoo and this is the blurred image of the elephant. | |
| 17 | |
| 00:01:19,970 --> 00:01:22,250 | |
| No actually she's not quite blurry. | |
| 18 | |
| 00:01:22,610 --> 00:01:27,200 | |
| So this is an example of a matrix The Matrix is 25. | |
| 19 | |
| 00:01:27,260 --> 00:01:29,090 | |
| Sorry five by five. | |
| 20 | |
| 00:01:29,310 --> 00:01:35,190 | |
| Now we multiply meet the new matrix by one of the twenty five. | |
| 21 | |
| 00:01:35,400 --> 00:01:40,740 | |
| And that's what we normalize that's called normalization of okeydoke Matrix because we want all the | |
| 22 | |
| 00:01:40,740 --> 00:01:45,450 | |
| elements in this matrix to sum to one which I mentioned here. | |
| 23 | |
| 00:01:45,480 --> 00:01:53,010 | |
| Now the first method I'm going to introduce you to is open see these filter Tuti takes an image and | |
| 24 | |
| 00:01:53,010 --> 00:01:54,910 | |
| runs it past the kernel here. | |
| 25 | |
| 00:01:54,930 --> 00:01:57,360 | |
| So we're about to introduce Saturno code. | |
| 26 | |
| 00:01:57,360 --> 00:01:59,610 | |
| So let's go Tokuda and do so now. | |
| 27 | |
| 00:02:00,840 --> 00:02:03,410 | |
| So let's look at this blurring of code here. | |
| 28 | |
| 00:02:03,420 --> 00:02:08,460 | |
| We're going to use the open see the filter to see which is the most basic form of Pluton we can you | |
| 29 | |
| 00:02:08,460 --> 00:02:10,080 | |
| do in if NCB. | |
| 30 | |
| 00:02:10,220 --> 00:02:12,830 | |
| I'm going to do it by using a tree by treacle. | |
| 31 | |
| 00:02:12,970 --> 00:02:18,060 | |
| Once you normalize by dividing by 9 so we're going to see the effects of blurring an image with a tree | |
| 32 | |
| 00:02:18,060 --> 00:02:22,110 | |
| bettery you know and then beggaring it with a larger seven by seven canal. | |
| 33 | |
| 00:02:22,200 --> 00:02:25,220 | |
| But you will also know all of these before dividing by 49. | |
| 34 | |
| 00:02:26,190 --> 00:02:28,100 | |
| So let's run this one and take a look at it. | |
| 35 | |
| 00:02:28,170 --> 00:02:29,060 | |
| In. | |
| 36 | |
| 00:02:29,370 --> 00:02:30,970 | |
| This is our original image. | |
| 37 | |
| 00:02:31,050 --> 00:02:33,550 | |
| You can see that elephant creases quite clear. | |
| 38 | |
| 00:02:33,550 --> 00:02:37,750 | |
| So it's has a lot of detail in this image so that's run it by the tree by tree. | |
| 39 | |
| 00:02:39,100 --> 00:02:40,580 | |
| And you can see it's definitely blue. | |
| 40 | |
| 00:02:40,600 --> 00:02:46,690 | |
| It's not a substantial amount of Larry but it's definitely noticeable when you compare it to the original | |
| 41 | |
| 00:02:46,690 --> 00:02:47,530 | |
| image. | |
| 42 | |
| 00:02:47,980 --> 00:02:49,750 | |
| So let's take a look at the seven by seven. | |
| 43 | |
| 00:02:49,750 --> 00:02:53,510 | |
| We expect a lot more heavy blurring and that's exactly what we see. | |
| 44 | |
| 00:02:53,820 --> 00:02:58,160 | |
| This is probably what a person who needs high prescription glasses might see. | |
| 45 | |
| 00:02:58,690 --> 00:03:01,800 | |
| So that's a fast learning algorithm. | |
| 46 | |
| 00:03:01,840 --> 00:03:03,360 | |
| We're going to take a look at a couple of now | |
| 47 | |
| 00:03:06,190 --> 00:03:12,260 | |
| writes If you scroll down over here you'll actually see some more blurring functions that are available | |
| 48 | |
| 00:03:12,320 --> 00:03:13,810 | |
| in open C.v. | |
| 49 | |
| 00:03:13,850 --> 00:03:16,840 | |
| So the first one we're going to use is actually a box filter. | |
| 50 | |
| 00:03:16,890 --> 00:03:20,390 | |
| So it's called the CB2 to Blair function and it's an averaging filter. | |
| 51 | |
| 00:03:20,390 --> 00:03:26,660 | |
| What it does it averages the pixels in a box that runs between each pixel. | |
| 52 | |
| 00:03:26,780 --> 00:03:28,470 | |
| So it puts the input image here. | |
| 53 | |
| 00:03:28,640 --> 00:03:30,240 | |
| Then it takes to really find here. | |
| 54 | |
| 00:03:30,260 --> 00:03:33,730 | |
| This is a box size and averages on all the pixels here. | |
| 55 | |
| 00:03:33,740 --> 00:03:36,770 | |
| So it sort of introduces a heavy blurring effect. | |
| 56 | |
| 00:03:36,770 --> 00:03:44,630 | |
| It's actually quite quite a drastic learning effect which you will see shortly and that's why there's | |
| 57 | |
| 00:03:44,660 --> 00:03:46,220 | |
| also the Gaussian blurring here. | |
| 58 | |
| 00:03:46,460 --> 00:03:51,920 | |
| So what this does instead of having a uniform boxful to actually uses a Gaussian boxful to I'll show | |
| 59 | |
| 00:03:51,920 --> 00:03:54,620 | |
| you what a Gaussian box is in a sleights. | |
| 60 | |
| 00:03:54,650 --> 00:03:59,110 | |
| But for now just imagine it's not going to have such a harsh effect as this blue function. | |
| 61 | |
| 00:03:59,360 --> 00:04:06,640 | |
| Now median blue medium blue also uses a box filter type I mentioned here. | |
| 62 | |
| 00:04:06,640 --> 00:04:09,250 | |
| However it doesn't actually average out everything in the box. | |
| 63 | |
| 00:04:09,250 --> 00:04:15,190 | |
| What it does it finds a median value of all that image all the pixels in that box and then it actually | |
| 64 | |
| 00:04:15,690 --> 00:04:17,800 | |
| puts median value as a pixel. | |
| 65 | |
| 00:04:17,800 --> 00:04:21,450 | |
| So it's sort of a nice balance between this and averaging. | |
| 66 | |
| 00:04:21,450 --> 00:04:23,240 | |
| Sorry Dessen Gaussian. | |
| 67 | |
| 00:04:24,010 --> 00:04:29,160 | |
| And lastly we have bilateral blurring bilateral blurring is actually quite useful. | |
| 68 | |
| 00:04:29,410 --> 00:04:34,210 | |
| And what it does it actually preserves all strength it removes noise quite well and strengthens the | |
| 69 | |
| 00:04:34,210 --> 00:04:35,830 | |
| edges in the image. | |
| 70 | |
| 00:04:35,830 --> 00:04:39,510 | |
| So let's take a look at Rhonda squid and you'll see what I'm talking about. | |
| 71 | |
| 00:04:39,550 --> 00:04:46,540 | |
| So this is an averaging box filter here you can see it has pretty much a uniform type effect. | |
| 72 | |
| 00:04:46,540 --> 00:04:52,210 | |
| This is a Gaussian during here not to go blurring but actually the seams would actually be less blurry. | |
| 73 | |
| 00:04:52,500 --> 00:04:55,250 | |
| But ever is a seven by seven in this example here. | |
| 74 | |
| 00:04:58,220 --> 00:05:00,110 | |
| And this is a medium bearing here. | |
| 75 | |
| 00:05:00,110 --> 00:05:04,300 | |
| Now if you notice medium bearing sort of has a kind of pinata type effect to it. | |
| 76 | |
| 00:05:04,550 --> 00:05:10,400 | |
| And that's because it's finding the median value in those segments of the image. | |
| 77 | |
| 00:05:10,420 --> 00:05:15,430 | |
| So if you wanted to ever introduce sort of a carpenter type effect maybe a medium medium blue would | |
| 78 | |
| 00:05:15,430 --> 00:05:17,210 | |
| be quite useful. | |
| 79 | |
| 00:05:17,270 --> 00:05:22,600 | |
| And let's take a look at our bilateral hearing here. | |
| 80 | |
| 00:05:22,600 --> 00:05:29,600 | |
| Now as you can see an bilateral blurring it's actually sort of a anti losing type effect on this image. | |
| 81 | |
| 00:05:29,770 --> 00:05:34,720 | |
| But what you can tell is that it definitely does preserve vertical and horizontal lines strongly here. | |
| 82 | |
| 00:05:35,100 --> 00:05:40,150 | |
| But images of areas of the ears and different areas and the elephant is actually quite blue. | |
| 83 | |
| 00:05:40,210 --> 00:05:45,690 | |
| However you can see vertical lines here are actually quite strong. | |
| 84 | |
| 00:05:46,110 --> 00:05:49,840 | |
| So here's a slide summarizing to just those different types of blurring we just saw. | |
| 85 | |
| 00:05:50,160 --> 00:05:52,300 | |
| So these are the same notes they just discussed here. | |
| 86 | |
| 00:05:52,500 --> 00:05:58,920 | |
| On each of the four methods however I told you I'd show you what a gaussian kernel looks like and this | |
| 87 | |
| 00:05:58,920 --> 00:06:00,870 | |
| is exactly what a Garcia-Pichel is here. | |
| 88 | |
| 00:06:00,870 --> 00:06:05,520 | |
| So you remember previously before and other criminals everything was the same value here. | |
| 89 | |
| 00:06:05,580 --> 00:06:11,170 | |
| However goshi and kernel's have a peak toward the center and is slowly peter off to the edges here. | |
| 90 | |
| 00:06:12,040 --> 00:06:16,080 | |
| This is sort of a treaty representation of what a Gaussian looks like. | |
| 91 | |
| 00:06:16,330 --> 00:06:18,170 | |
| And this is a matrix form here. | |
| 92 | |
| 00:06:18,280 --> 00:06:23,980 | |
| And again we normalize by some of all the elements here which in this case is 273. | |
| 93 | |
| 00:06:24,100 --> 00:06:29,360 | |
| So heading back to bite in the books is one last image Geering method to just wish to discuss. | |
| 94 | |
| 00:06:29,530 --> 00:06:31,590 | |
| And that's one called imaged invoicing. | |
| 95 | |
| 00:06:31,840 --> 00:06:36,630 | |
| This is open Zeevi function here first and one means the noise in code. | |
| 96 | |
| 00:06:36,640 --> 00:06:38,480 | |
| It's quite a mouthful here. | |
| 97 | |
| 00:06:38,560 --> 00:06:42,630 | |
| And what this does this actually originates from computational photography methods. | |
| 98 | |
| 00:06:42,910 --> 00:06:48,820 | |
| And as you know using cell phone cameras and digital cameras there's no way those tiny camera sensors | |
| 99 | |
| 00:06:48,820 --> 00:06:53,120 | |
| can match the noise levels of complex big DSL or cameras. | |
| 100 | |
| 00:06:53,140 --> 00:06:58,810 | |
| So what they use to compensate is these complicated algorithms that sort of try to get the best optimized | |
| 101 | |
| 00:06:58,810 --> 00:07:02,090 | |
| noise levels so you don't see all that green in the image. | |
| 102 | |
| 00:07:02,110 --> 00:07:06,220 | |
| So when we run this function it actually takes some time of research on it in the background. | |
| 103 | |
| 00:07:06,220 --> 00:07:09,070 | |
| You get this nice very clean looking image here. | |
| 104 | |
| 00:07:10,120 --> 00:07:13,300 | |
| So that the effects of running this algorithm. | |
| 105 | |
| 00:07:13,560 --> 00:07:15,090 | |
| Now there's quite a few variations here. | |
| 106 | |
| 00:07:15,100 --> 00:07:20,240 | |
| I wouldn't get into the details exactly right now these are some notes on the premises here. | |
| 107 | |
| 00:07:20,260 --> 00:07:21,410 | |
| This is filled the strings. | |
| 108 | |
| 00:07:21,430 --> 00:07:23,750 | |
| And these are some of the components you can play with. | |
| 109 | |
| 00:07:24,310 --> 00:07:26,070 | |
| And that's it for blurring. | |
| 110 | |
| 00:07:26,160 --> 00:07:28,480 | |
| Let's move on to shopping which is the opposite of Barry. | |