AI_DL_Assignment / 5. OpenCV Tutorial - Learn Classic Computer Vision & Face Detection (OPTIONAL) /16. Arithmetic Operations - Brightening and Darkening Images.srt
Prince-1's picture
Add files using upload-large-folder tool
17e2002 verified
1
00:00:00,730 --> 00:00:04,050
So let's get into some arithmetic operations using open.
2
00:00:04,210 --> 00:00:10,310
So what arithmetic operations are they basically adding matrices to imagery and by adding mistresses
3
00:00:10,430 --> 00:00:13,500
or subtracting matrices from or imagery.
4
00:00:13,670 --> 00:00:19,130
It has the effect of increasing brightness or decreasing brightness or intensity.
5
00:00:19,130 --> 00:00:24,080
So to do that we actually have to first create the matrix that we want to add subtract to our image
6
00:00:24,620 --> 00:00:29,000
and non-pay has actually has built in functions one called empty ones.
7
00:00:29,000 --> 00:00:35,470
This allows us to create an array which is of this dimension which is same dimensions as image here.
8
00:00:35,990 --> 00:00:42,790
And we ascended and type to unsane and to get it which is what open CBEST uses to store or image data
9
00:00:43,850 --> 00:00:46,020
and we multiply by Escuela 75.
10
00:00:46,020 --> 00:00:50,680
So if we wanted to see what this looks like let's just copy this line here.
11
00:00:51,500 --> 00:00:54,780
And run it separately in a different cell.
12
00:00:55,900 --> 00:01:00,530
And it's actually just printed here and there we go.
13
00:01:00,540 --> 00:01:08,340
So as we see these images of matrix of 75 and here of course the same dimensions as this image here.
14
00:01:08,860 --> 00:01:12,980
So using the CV to the add function it adds these two matrices here.
15
00:01:13,180 --> 00:01:20,560
Other uses function this and this image or I should say has to have to seem them actions which is why
16
00:01:20,560 --> 00:01:24,230
we follow and copied it into this one function here.
17
00:01:24,670 --> 00:01:26,950
And likewise we do it with the subtraction function here.
18
00:01:26,950 --> 00:01:29,740
So let's see how this looks when we actually run this function.
19
00:01:32,050 --> 00:01:32,590
There we go.
20
00:01:32,620 --> 00:01:35,750
This is a darkened image here substantially darker.
21
00:01:36,130 --> 00:01:38,380
And this is a and image here.
22
00:01:38,440 --> 00:01:43,330
What's important to know is that let's say we did a 175 here.
23
00:01:43,450 --> 00:01:46,540
What do you think would have happened with certainty.
24
00:01:46,930 --> 00:01:51,210
This one is even darker which means that volumes are less big.
25
00:01:51,230 --> 00:01:52,830
Bigger than 175.
26
00:01:52,960 --> 00:01:57,510
These are the only ones that show up not because everything else cost to zero which is why it's black.
27
00:01:58,030 --> 00:02:01,860
And similarly there's a lot of white points or very light coats here.
28
00:02:01,900 --> 00:02:08,590
What happens is that when you add 175 to these points it actually reaches 255 which is white as you
29
00:02:08,590 --> 00:02:12,340
can see sort of has the effect of clipping highlights in some areas here.
30
00:02:13,920 --> 00:02:17,780
Please know that we can't ever exceed 0 and 255.
31
00:02:17,960 --> 00:02:21,520
So whether we're adding when we're adding literacies to imagery.
32
00:02:21,620 --> 00:02:27,500
Keep that in mind that you will get some clipping which is what we saw in the black and white images
33
00:02:27,500 --> 00:02:32,500
here.
34
00:02:33,030 --> 00:02:38,680
So let's start doing some bitwise operations and icle and device operations and masking because that's
35
00:02:38,680 --> 00:02:42,320
essentially what you'll be using these bitwise operations for.
36
00:02:42,350 --> 00:02:46,180
They're quite handy when you have to mask images which you will see later on in this course.
37
00:02:46,420 --> 00:02:48,460
But for now we'll just enjoy this topic.
38
00:02:48,460 --> 00:02:51,880
So firstly let's create some cheaps here.
39
00:02:51,880 --> 00:02:55,580
So we're going to create a square and an ellipse here.
40
00:02:55,610 --> 00:03:00,730
Now you may be familiar with creating a rectangle or square I call it because it's seem that mentions.
41
00:03:00,740 --> 00:03:02,140
I for this one.
42
00:03:02,530 --> 00:03:04,600
However an ellipse is slightly different.
43
00:03:04,600 --> 00:03:07,750
It doesn't actually follow the same standard as a sicko.
44
00:03:07,780 --> 00:03:11,860
You can check the weapons in the documentation to get some details and one go into it in this chapter
45
00:03:11,860 --> 00:03:12,570
here.
46
00:03:12,640 --> 00:03:14,090
It's taken too much time.
47
00:03:14,520 --> 00:03:18,510
Let's just run this function and we see it here.
48
00:03:18,560 --> 00:03:24,640
So elipse are single efforts and has actually not a full of study parameters to create sort of a semi
49
00:03:24,640 --> 00:03:26,880
hemisphere type image here.
50
00:03:27,340 --> 00:03:31,780
So what we're going to do know we're going to overlay these images and using some bitwise operations
51
00:03:31,780 --> 00:03:35,050
to illustrate the different type of operations that we have.
52
00:03:35,530 --> 00:03:36,650
So let's get to it.