AI_DL_Assignment / 5. OpenCV Tutorial - Learn Classic Computer Vision & Face Detection (OPTIONAL) /22. Edge Detection using Image Gradients & Canny Edge Detection.srt
Prince-1's picture
Add files using upload-large-folder tool
17e2002 verified
1
00:00:01,700 --> 00:00:04,700
So let's move on to edge detection and image brilliance.
2
00:00:04,740 --> 00:00:09,570
So before we continue into this section I want you to think about what exactly is an edge.
3
00:00:09,700 --> 00:00:15,420
You may find an edge as being the boundaries of images and that actually is sort of rates as you can
4
00:00:15,420 --> 00:00:20,950
see in a still picture of a dog here we can understand that this is a dog because the edges are drawn
5
00:00:20,950 --> 00:00:21,240
in.
6
00:00:21,270 --> 00:00:25,210
We have the edge of it till his body's face and his paws.
7
00:00:25,230 --> 00:00:27,010
So we know it's a dog.
8
00:00:27,030 --> 00:00:32,490
So as you can see edges do preserve a lot of an image even though a lot of the detail is missing here.
9
00:00:32,970 --> 00:00:37,780
So how do we formally define edges edges can be defined.
10
00:00:37,800 --> 00:00:44,570
A sudden changes or discontinuities is in an image and this picture I've drawn here actually highlights
11
00:00:44,570 --> 00:00:45,740
this example.
12
00:00:45,740 --> 00:00:52,580
So imagine you're moving cross this line here and this is the intensity as we move along this line here.
13
00:00:52,580 --> 00:00:54,700
So as you can see the intensity is high here.
14
00:00:54,920 --> 00:00:58,380
Then suddenly it gets low which is what this trough represents.
15
00:00:58,380 --> 00:01:00,200
And then it gets higher again.
16
00:01:00,230 --> 00:01:03,550
So this dip here represents an edge here.
17
00:01:05,180 --> 00:01:10,430
And vice versa if this was a white line and a black background here black background here we would have
18
00:01:10,430 --> 00:01:11,820
the opposite shape here.
19
00:01:12,080 --> 00:01:16,970
So that's how we actually define edges here by finding new image gradients of the intensity changes
20
00:01:17,060 --> 00:01:18,850
across these lines here.
21
00:01:19,700 --> 00:01:24,960
So fortunately open see if he provides us with some very good education algorithms we're actually going
22
00:01:24,960 --> 00:01:29,450
to discuss tree of Dmin once here at SoBo Plus the uncanny.
23
00:01:29,550 --> 00:01:35,380
Now can is actually an excellent education algorithm and is really good because it has a lot of it.
24
00:01:35,410 --> 00:01:39,200
It defines it as well and it's actually very good at picking up edges here.
25
00:01:39,510 --> 00:01:46,050
This is actually a very hard image here for protection algorithm to look at it's a dog a dark dog a
26
00:01:46,050 --> 00:01:47,320
Rottweiler actually.
27
00:01:47,500 --> 00:01:51,550
And as you can see you can actually make out that it's a dog quite easily.
28
00:01:53,830 --> 00:01:58,690
So it wouldn't go into details of all of these algorithms because they actually get quite mathematical.
29
00:01:58,690 --> 00:02:03,220
However it does give a high level explanation for canny edge detection.
30
00:02:03,250 --> 00:02:08,410
So what can he does it food supplies that go see him blurring effect to the image as you previously
31
00:02:08,410 --> 00:02:11,500
saw we did some gaffes in luring a few chapters behind.
32
00:02:12,040 --> 00:02:17,620
And then what it does it finds the intensity gradient across the image then it applies and none maximum
33
00:02:17,620 --> 00:02:23,620
suppression of which is actually removing the pixels aunt edges and the image and then apply some hysteresis
34
00:02:23,870 --> 00:02:29,980
Tressel's Zufall pixels within an upper or lower threshold then it's considered an edge and you can
35
00:02:29,980 --> 00:02:33,630
learn a bit more but canny edge addiction and different edge addiction techniques.
36
00:02:33,640 --> 00:02:36,360
These links here.
37
00:02:36,520 --> 00:02:40,150
So now let's look at implementing these edge addiction algorithms in our code.
38
00:02:43,260 --> 00:02:47,520
So let's look at implementing some of those additional algorithms we just discuss.
39
00:02:47,550 --> 00:02:52,200
So if this one we're going to discuss a Sabel edges and what's cool about Sobol edges is that we can
40
00:02:52,200 --> 00:02:57,060
extract vertical and horizontal viceversa edges from the image.
41
00:02:57,060 --> 00:03:01,380
I'm not going to go into the details of this function although this is this is going to just to get
42
00:03:01,380 --> 00:03:02,790
different strengths.
43
00:03:03,000 --> 00:03:04,640
And this is the input image here.
44
00:03:04,920 --> 00:03:10,560
And then we can actually combine both x and y edges and using the bitwise all and showed them together
45
00:03:10,560 --> 00:03:14,410
get to the Plassans run here with C-v to the.
46
00:03:14,850 --> 00:03:16,550
And it just is no trouble.
47
00:03:16,600 --> 00:03:21,960
As parameters are things the person is just a blanket function and then it is county and county is actually
48
00:03:21,960 --> 00:03:23,230
quite simple as well.
49
00:03:23,270 --> 00:03:25,710
It just sticks to attritional values here.
50
00:03:25,710 --> 00:03:29,200
So let's run these education algorithms and compare them.
51
00:03:29,210 --> 00:03:33,120
So this is our input image remember it.
52
00:03:33,360 --> 00:03:36,300
These are the horizontal edges in Sobell.
53
00:03:36,300 --> 00:03:38,810
Does it have vertical edges and Sobell.
54
00:03:39,260 --> 00:03:41,100
These are the board combined.
55
00:03:41,760 --> 00:03:46,290
This is the Plassy And then as you can see the plastic actually and then face a lot of edges but also
56
00:03:46,290 --> 00:03:48,590
a lot of false positives in the sky.
57
00:03:49,130 --> 00:03:55,020
What we did was we can to end these thresholds to give us nicely some nice edges.
58
00:03:55,200 --> 00:03:56,810
Maybe that's what county is good for.
59
00:03:57,150 --> 00:04:02,920
As you can see Connie actually disregarded the sky and a lot of excess noise but actually preserved
60
00:04:02,920 --> 00:04:05,560
the edges of we wanted to see which is in the structures.
61
00:04:05,790 --> 00:04:13,900
So what we can look at his uncanny is that we can adjust these two attritional promises you everton
62
00:04:13,900 --> 00:04:15,830
up something quickly here.
63
00:04:16,070 --> 00:04:20,380
However just note that these prompter's here are greedy and prompters.
64
00:04:20,380 --> 00:04:24,290
So let's set degree and parameters that we want to look at look at to some tighter value.
65
00:04:24,290 --> 00:04:26,590
So let's see 50 and 120.
66
00:04:26,920 --> 00:04:35,080
Let's go over with Sobell horizontal edges quite nice vertical edges combined Tousey in there we go.
67
00:04:35,080 --> 00:04:38,680
So as you can see the image is that it looks a little different so vastly different.
68
00:04:38,680 --> 00:04:43,250
However you can play with your thresholds in county and see if you get the best.
69
00:04:43,260 --> 00:04:47,620
Whatever whatever you want as a best is to represent you image.
70
00:04:48,050 --> 00:04:48,390
OK.
71
00:04:48,400 --> 00:04:50,400
So that's it for edge detection.
72
00:04:50,410 --> 00:04:52,020
We'll move on to some of the stuff now.