AI_DL_Assignment / 5. OpenCV Tutorial - Learn Classic Computer Vision & Face Detection (OPTIONAL) /17. Bitwise Operations - How Image Masking Works.srt
| 1 | |
| 00:00:01,500 --> 00:00:06,900 | |
| So let's start doing some bitwise operations and include in the device operations and masking because | |
| 2 | |
| 00:00:06,960 --> 00:00:10,540 | |
| that's essentially what you will be using these bitwise operations for. | |
| 3 | |
| 00:00:10,800 --> 00:00:15,460 | |
| They're quite handy when you have to mask images which you all seem to want to discuss but for now we'll | |
| 4 | |
| 00:00:15,480 --> 00:00:17,640 | |
| just introduce the topic selflessly. | |
| 5 | |
| 00:00:17,640 --> 00:00:20,200 | |
| Let's create some chips here. | |
| 6 | |
| 00:00:20,400 --> 00:00:24,160 | |
| So we're going to create a square and an ellipse here. | |
| 7 | |
| 00:00:24,160 --> 00:00:29,140 | |
| Now you may be familiar with creating a rectangle or square I call it because it's same dimensions. | |
| 8 | |
| 00:00:29,140 --> 00:00:33,080 | |
| I decide for this one above that an ellipse is slightly different. | |
| 9 | |
| 00:00:33,090 --> 00:00:35,870 | |
| It doesn't actually follow the same standard as a circle. | |
| 10 | |
| 00:00:36,270 --> 00:00:40,440 | |
| You can check the open see the documentation to get some details I won't go into it in this chapter. | |
| 11 | |
| 00:00:40,440 --> 00:00:42,660 | |
| Here to take up too much time. | |
| 12 | |
| 00:00:43,030 --> 00:00:46,620 | |
| This run this function and we see it's here. | |
| 13 | |
| 00:00:46,980 --> 00:00:51,780 | |
| So this ellipse a single left creates and has actually not a full ellipse of the parameters to create | |
| 14 | |
| 00:00:51,780 --> 00:00:55,830 | |
| sort of a semi hemisphere type image here. | |
| 15 | |
| 00:00:55,830 --> 00:01:00,270 | |
| So what we're going to do now we're going to overlay these images and using some bitwise operations | |
| 16 | |
| 00:01:00,270 --> 00:01:03,370 | |
| to illustrate the different type of operations that we have. | |
| 17 | |
| 00:01:04,050 --> 00:01:05,530 | |
| So let's get to it. | |
| 18 | |
| 00:01:06,970 --> 00:01:11,050 | |
| So that's actually run some bitwise operations on the images we just created. | |
| 19 | |
| 00:01:11,440 --> 00:01:19,190 | |
| So by doing that we use these open C-v functions bitwise and bitwise OR bitwise Exel and bitwise NOT. | |
| 20 | |
| 00:01:19,450 --> 00:01:24,880 | |
| If you're familiar with logic gates or just on gerneral programming you'd understand that what these | |
| 21 | |
| 00:01:24,880 --> 00:01:25,430 | |
| things mean. | |
| 22 | |
| 00:01:25,450 --> 00:01:28,810 | |
| However it's always good to illustrate that you know images itself. | |
| 23 | |
| 00:01:28,810 --> 00:01:33,820 | |
| Keep in mind that Squire and Lipps has to be of the same dimensions here which is why we created the | |
| 24 | |
| 00:01:33,820 --> 00:01:37,480 | |
| canvas initially a tree rendered between two pixels. | |
| 25 | |
| 00:01:37,480 --> 00:01:38,650 | |
| So that's around us. | |
| 26 | |
| 00:01:38,650 --> 00:01:43,750 | |
| So before we run this I just get a refresher of what all images look like. | |
| 27 | |
| 00:01:44,140 --> 00:01:48,130 | |
| So let's run it and come on what are you doing it's going to happen. | |
| 28 | |
| 00:01:48,760 --> 00:01:49,750 | |
| Exactly. | |
| 29 | |
| 00:01:49,840 --> 00:01:52,190 | |
| Why would you assume this would have happened. | |
| 30 | |
| 00:01:52,540 --> 00:01:57,700 | |
| This is the intersection of only those two images here and by intersection I mean is that it only white | |
| 31 | |
| 00:01:57,700 --> 00:01:58,220 | |
| areas. | |
| 32 | |
| 00:01:58,240 --> 00:02:02,890 | |
| And keep in mind these statements here they would when you have a binary type image either black or | |
| 33 | |
| 00:02:02,890 --> 00:02:05,130 | |
| white always a grayscale image. | |
| 34 | |
| 00:02:05,140 --> 00:02:07,220 | |
| It's not exactly going to look like you imagine. | |
| 35 | |
| 00:02:07,240 --> 00:02:09,060 | |
| You can try it on your own. | |
| 36 | |
| 00:02:09,070 --> 00:02:09,720 | |
| I love it. | |
| 37 | |
| 00:02:09,850 --> 00:02:12,180 | |
| I'm eliciting the concepts of these bitwise operations. | |
| 38 | |
| 00:02:12,180 --> 00:02:17,770 | |
| You see this white area here and see only parts of those two images that intersected so let's look at | |
| 39 | |
| 00:02:17,770 --> 00:02:20,460 | |
| it or that wise operation. | |
| 40 | |
| 00:02:21,280 --> 00:02:25,880 | |
| Exactly as we anticipated both images shown here. | |
| 41 | |
| 00:02:26,200 --> 00:02:31,040 | |
| Since this sort of takes the signal and the software and we do come together here. | |
| 42 | |
| 00:02:31,440 --> 00:02:33,930 | |
| So what do you think exo of to do. | |
| 43 | |
| 00:02:34,550 --> 00:02:35,600 | |
| Let's see. | |
| 44 | |
| 00:02:35,620 --> 00:02:37,230 | |
| EXO is sort of a weird one. | |
| 45 | |
| 00:02:37,240 --> 00:02:38,800 | |
| Sort of looks like a reverse. | |
| 46 | |
| 00:02:38,900 --> 00:02:40,910 | |
| So the intersection between these. | |
| 47 | |
| 00:02:40,960 --> 00:02:48,640 | |
| So what this means is that anything that's an axle goes back to 0 0 0 black and red remains with the | |
| 48 | |
| 00:02:49,060 --> 00:02:50,650 | |
| images exist like a wall statement. | |
| 49 | |
| 00:02:50,650 --> 00:02:51,990 | |
| It shows up here. | |
| 50 | |
| 00:02:52,390 --> 00:02:56,830 | |
| So it can be useful some some things you can get maybe a little and figure out what you may need it | |
| 51 | |
| 00:02:56,830 --> 00:02:57,450 | |
| for. | |
| 52 | |
| 00:02:57,820 --> 00:02:59,070 | |
| And others are not. | |
| 53 | |
| 00:02:59,070 --> 00:03:01,270 | |
| Now keep in mind not is different. | |
| 54 | |
| 00:03:01,270 --> 00:03:05,970 | |
| Not just ticks into one takes from one image into consideration. | |
| 55 | |
| 00:03:06,070 --> 00:03:11,920 | |
| So it's not is actually equivalent to inverse of an image and you'll see that shortly. | |
| 56 | |
| 00:03:11,920 --> 00:03:14,000 | |
| So let's look at what that is. | |
| 57 | |
| 00:03:14,200 --> 00:03:15,680 | |
| So let's bring it in here. | |
| 58 | |
| 00:03:16,080 --> 00:03:18,500 | |
| Memorize this one. | |
| 59 | |
| 00:03:18,500 --> 00:03:25,240 | |
| So this is a square run in a bitwise NOT operation as you can see it basically includes ticklers which | |
| 60 | |
| 00:03:25,240 --> 00:03:31,470 | |
| is actually quite useful in many open any functions which you will come in to come across later on. | |
| 61 | |
| 00:03:31,480 --> 00:03:33,760 | |
| So that's an introduction to bitwise operations. | |
| 62 | |
| 00:03:33,760 --> 00:03:35,820 | |
| Hope you found it useful. | |