AI_DL_Assignment / 5. OpenCV Tutorial - Learn Classic Computer Vision & Face Detection (OPTIONAL) /15. Cropping - Cut Out The Image The Regions You Want or Don't Want.srt
Prince-1's picture
Add files using upload-large-folder tool
17e2002 verified
1
00:00:00,920 --> 00:00:06,390
So cropping images in something fairly straightforward I imagine most of you have done this in markets
2
00:00:06,390 --> 00:00:10,420
of wood or using your iPhone or any image editing software.
3
00:00:10,500 --> 00:00:14,580
It basically refers to extracting part of the image that you want.
4
00:00:14,580 --> 00:00:16,240
Hence you're moving the excess.
5
00:00:16,500 --> 00:00:20,120
So in this example here we just wanted to censor the rooftop of love.
6
00:00:20,520 --> 00:00:22,160
And that's what we get here.
7
00:00:22,710 --> 00:00:28,750
So let's take a look at how we do this and up NCB so you can see we actually doesn't have a direct cropping
8
00:00:28,750 --> 00:00:29,530
function.
9
00:00:29,580 --> 00:00:32,010
However it still easily done using them.
10
00:00:32,470 --> 00:00:34,900
And that's done in this line right here.
11
00:00:34,900 --> 00:00:42,190
So what number allows us to do is we can put our image right here and then using the indexing tools
12
00:00:42,520 --> 00:00:50,710
or Shin's in methods we finally started to enroll in a start and them and separated by a comma.
13
00:00:50,800 --> 00:00:58,080
And that basically extracts direct Hangal that we wanted in or well wanted to crop out initially.
14
00:00:58,270 --> 00:01:04,720
So the defined start row and start all we actually Lebow we lower the heights and it went for this and
15
00:01:04,720 --> 00:01:11,620
we actually take 25 percent of the height and 25 percent have to wait and then when 75 is 75 percent
16
00:01:11,620 --> 00:01:12,860
of the height and width.
17
00:01:13,360 --> 00:01:18,240
That gives us the exact center point of the move as you saw in the previous slide.
18
00:01:19,050 --> 00:01:19,660
Yeah.
19
00:01:20,690 --> 00:01:22,800
So as I just approximate it.
20
00:01:22,860 --> 00:01:28,880
What that do is I mentioned should be so basic starter a 25 percent here.
21
00:01:28,920 --> 00:01:34,890
Just sit at this distance from here to here is 25 percent and this distance from here to here is 75
22
00:01:34,890 --> 00:01:36,030
percent of the image.
23
00:01:36,360 --> 00:01:38,510
And similarly for columns here.
24
00:01:38,760 --> 00:01:42,740
So you can play with those values if you want to get into actual bodies.
25
00:01:42,750 --> 00:01:45,790
I just did this to make it easier to modify.
26
00:01:45,810 --> 00:01:48,230
So let's run this code and see how it works.
27
00:01:48,240 --> 00:01:51,260
So original image and this is a cropped image.
28
00:01:51,260 --> 00:01:53,120
It actually works fairly well.
29
00:01:53,460 --> 00:01:55,760
So let's show of strength overly this here.
30
00:01:55,800 --> 00:01:58,560
So you can actually understand a bit more what I did here.
31
00:01:58,950 --> 00:02:06,420
So by saying 75 25 percent rule with here I'm seeing start position of the rows you want to extract.
32
00:02:06,430 --> 00:02:07,400
Starts Here.
33
00:02:07,780 --> 00:02:12,710
That's 25 percent point and 75 percent point starts here.
34
00:02:13,050 --> 00:02:14,650
Actually these are homes or homes.
35
00:02:15,000 --> 00:02:18,270
And similarly with rows 25 percent starts here.
36
00:02:18,580 --> 00:02:24,890
As you can see is 25 percent from here to here and 75 percent value starts from here to here.
37
00:02:24,890 --> 00:02:28,710
So that's exactly how we get this cropped image here.
38
00:02:28,830 --> 00:02:33,760
And if you ever need to use this cropped image for anything else it actually stores it as corrupt.
39
00:02:33,780 --> 00:02:39,000
All these stories are cropped image here from a well known by indexing and that can be used for many
40
00:02:39,000 --> 00:02:40,930
other things going forward.
41
00:02:41,070 --> 00:02:42,110
So that's it for cropping.