AI_DL_Assignment / 5. OpenCV Tutorial - Learn Classic Computer Vision & Face Detection (OPTIONAL) /13. Scaling, Re-sizing and Interpolations - Understand How Re-Sizing Affects Quality.srt
| 1 | |
| 00:00:01,060 --> 00:00:08,920 | |
| So moving on to a simple fine transmission is resizing also called scaling and resizing you mating is | |
| 2 | |
| 00:00:08,950 --> 00:00:09,820 | |
| actually quite simple. | |
| 3 | |
| 00:00:09,820 --> 00:00:15,670 | |
| However it involves something called intercalation and interpellation is basically when we resize an | |
| 4 | |
| 00:00:15,670 --> 00:00:15,970 | |
| image. | |
| 5 | |
| 00:00:15,970 --> 00:00:19,690 | |
| Imagine your expanding points or pixels. | |
| 6 | |
| 00:00:19,930 --> 00:00:23,960 | |
| So when you resize an image from big from small to big. | |
| 7 | |
| 00:00:24,160 --> 00:00:27,740 | |
| How do we find the gaps in between the pixels. | |
| 8 | |
| 00:00:28,060 --> 00:00:33,490 | |
| So that's what interpellation I have just drawn this simple little diagram here to show you what Gippi | |
| 9 | |
| 00:00:33,560 --> 00:00:37,510 | |
| a square and it's because when you're doing G-B obstructing you actually interplay at points quite a | |
| 10 | |
| 00:00:37,510 --> 00:00:38,330 | |
| bit. | |
| 11 | |
| 00:00:38,350 --> 00:00:41,340 | |
| So imagine the red points of pixels. | |
| 12 | |
| 00:00:41,590 --> 00:00:43,540 | |
| And these are the actual pixels here. | |
| 13 | |
| 00:00:43,580 --> 00:00:49,750 | |
| Now imagine previously for these pixels we're closer together or red pixels ignore yellow pixels and | |
| 14 | |
| 00:00:49,750 --> 00:00:50,970 | |
| every pixel for now. | |
| 15 | |
| 00:00:51,370 --> 00:00:53,780 | |
| So we just haven't read pixels that are closer together. | |
| 16 | |
| 00:00:53,980 --> 00:00:59,560 | |
| But no we've stretched them out and we need to approximate the pixels in-between that's when into position | |
| 17 | |
| 00:00:59,560 --> 00:01:05,380 | |
| as in depletion as the methods we use to actually put generate these pixels here. | |
| 18 | |
| 00:01:05,530 --> 00:01:13,160 | |
| So as kids can see the CBS step example going up in the straight line not putting a pixel here a fairly | |
| 19 | |
| 00:01:13,160 --> 00:01:13,700 | |
| good idea. | |
| 20 | |
| 00:01:13,710 --> 00:01:15,050 | |
| Fairly good idea. | |
| 21 | |
| 00:01:15,060 --> 00:01:19,630 | |
| However doing this linear linear meaning straight line joining between pixels. | |
| 22 | |
| 00:01:19,880 --> 00:01:25,860 | |
| We actually don't reflect that maybe the vehicle took a corner here instead of equal to maybe some stretches | |
| 23 | |
| 00:01:25,890 --> 00:01:28,740 | |
| of buildings here in this dome example. | |
| 24 | |
| 00:01:29,390 --> 00:01:35,640 | |
| And that's a form of interpellation which which we call linear interpolation. | |
| 25 | |
| 00:01:35,850 --> 00:01:42,870 | |
| So let's talk a bit about the types of into positions here is interior nearest linear Kubik and Lanzas | |
| 26 | |
| 00:01:43,840 --> 00:01:45,240 | |
| for apparently. | |
| 27 | |
| 00:01:45,660 --> 00:01:49,910 | |
| So these are all methods and I won't go into details here it is actually a very good comparison on this | |
| 28 | |
| 00:01:49,920 --> 00:01:50,790 | |
| link here. | |
| 29 | |
| 00:01:51,120 --> 00:01:57,270 | |
| But generally into the area into here it is good for shrinking or sampling images. | |
| 30 | |
| 00:01:57,270 --> 00:02:03,390 | |
| That's actually another form of into position as well probably just what it does is images the pixels | |
| 31 | |
| 00:02:03,390 --> 00:02:04,240 | |
| was in the area. | |
| 32 | |
| 00:02:04,380 --> 00:02:10,790 | |
| That's why it's good for downsampling into Nereus as fast as up or down according to this comparison | |
| 33 | |
| 00:02:10,800 --> 00:02:18,150 | |
| here is good as in this case is a linear interpolation or simply good and scientific method use zooming | |
| 34 | |
| 00:02:18,430 --> 00:02:23,430 | |
| all of it into Kubic which is probably what's going to generate this green point here is definitely | |
| 35 | |
| 00:02:23,430 --> 00:02:26,450 | |
| better and Lanzas or luck. | |
| 36 | |
| 00:02:26,500 --> 00:02:28,610 | |
| This is actually the best. | |
| 37 | |
| 00:02:28,710 --> 00:02:29,900 | |
| So you can check them out here. | |
| 38 | |
| 00:02:30,080 --> 00:02:32,200 | |
| So let's actually implement this in some code now. | |
| 39 | |
| 00:02:34,900 --> 00:02:41,260 | |
| So let's now implement some simple scaling or resizing of NCB so you can see the uses a CV to resize | |
| 40 | |
| 00:02:41,260 --> 00:02:43,540 | |
| function when the arguments listed up here. | |
| 41 | |
| 00:02:43,810 --> 00:02:48,820 | |
| But as actually use this function to get a feel of it sufficiently the LoDo image and then using the | |
| 42 | |
| 00:02:48,820 --> 00:02:52,010 | |
| resize function it takes all input image none. | |
| 43 | |
| 00:02:52,060 --> 00:02:58,280 | |
| Which all this gustily to one shortly f x and f y These are the factors we want to scale. | |
| 44 | |
| 00:02:58,390 --> 00:03:04,570 | |
| And what we're telling it is if we want to Scioto image by trick What is so true to the originals original | |
| 45 | |
| 00:03:04,570 --> 00:03:05,530 | |
| size. | |
| 46 | |
| 00:03:05,680 --> 00:03:12,120 | |
| And the reason we said it at some point 75 percent favor here is that we want to Munteanu image issues. | |
| 47 | |
| 00:03:12,190 --> 00:03:19,810 | |
| So by default they said it uses it into linear as its assets into politian matter. | |
| 48 | |
| 00:03:19,850 --> 00:03:25,470 | |
| We're actually going to try into Kubic into area and we're actually going to change the dimensions here. | |
| 49 | |
| 00:03:25,490 --> 00:03:26,210 | |
| We were size 2. | |
| 50 | |
| 00:03:26,240 --> 00:03:29,870 | |
| So this actually allows us to resize exactly the dimensions we want. | |
| 51 | |
| 00:03:29,970 --> 00:03:32,840 | |
| So you understand that shortly when we actually implement this code. | |
| 52 | |
| 00:03:32,870 --> 00:03:39,610 | |
| So let's run this Corneau as you can see this is a picture of the loop they took and it's actually smaller | |
| 53 | |
| 00:03:39,700 --> 00:03:42,760 | |
| than the virtual images by truck with its eyes. | |
| 54 | |
| 00:03:43,300 --> 00:03:47,710 | |
| This one is much bigger This is twice the size and this is using the entire cubic which is actually | |
| 55 | |
| 00:03:47,710 --> 00:03:49,420 | |
| a slower method of interpellation. | |
| 56 | |
| 00:03:49,660 --> 00:03:52,910 | |
| However the resizing looks decent quality as well. | |
| 57 | |
| 00:03:53,440 --> 00:03:54,970 | |
| And this is the one that's skewed. | |
| 58 | |
| 00:03:55,030 --> 00:04:00,260 | |
| So we actually set the dimensions here and let's bring this into this view here. | |
| 59 | |
| 00:04:00,610 --> 00:04:03,670 | |
| So we actually said the width to be 900 and the height to be 400. | |
| 60 | |
| 00:04:03,730 --> 00:04:12,550 | |
| As I previously showed in the code here we similarly we can actually skew in one dimension or see resizing | |
| 61 | |
| 00:04:12,820 --> 00:04:14,190 | |
| differently in one dimension. | |
| 62 | |
| 00:04:14,470 --> 00:04:19,520 | |
| So if we implement something that looks like this year which is sort of compressed horizontally here. | |
| 63 | |
| 00:04:20,200 --> 00:04:20,610 | |
| OK. | |
| 64 | |
| 00:04:20,650 --> 00:04:22,180 | |
| So that's it for resizing. | |
| 65 | |
| 00:04:22,180 --> 00:04:24,100 | |
| It's actually a pretty basic function. | |
| 66 | |
| 00:04:24,370 --> 00:04:26,050 | |
| So why not move on to some other topics. | |
| 67 | |
| 00:04:26,230 --> 00:04:26,700 | |
| Inoffensively. | |