AI_DL_Assignment / 5. OpenCV Tutorial - Learn Classic Computer Vision & Face Detection (OPTIONAL) /11. Image Translations - Moving Images Up, Down. Left And Right.srt
Prince-1's picture
Add files using upload-large-folder tool
17e2002 verified
1
00:00:00,780 --> 00:00:02,500
So let's talk a bit about transitions.
2
00:00:02,550 --> 00:00:07,080
Transitions are actually very simple and it's basically moving an image in one direction can be left
3
00:00:07,080 --> 00:00:09,400
right up down or even diagonally.
4
00:00:09,400 --> 00:00:13,020
If you implement an x and y traslation at the same time.
5
00:00:13,380 --> 00:00:19,950
So to perform a translation we actually use Open see these C-v to walk a fine function but that function
6
00:00:19,950 --> 00:00:23,250
requires what we call the translation matrix.
7
00:00:23,250 --> 00:00:29,280
So we are getting into too much high school geometry a translation matrix basically is is in this form
8
00:00:29,780 --> 00:00:33,020
and takes an x and y value as these elements here.
9
00:00:33,450 --> 00:00:39,570
Now what misrepresents here is a shift along the x axis horizontally and Y is shift along the y axis
10
00:00:39,570 --> 00:00:40,370
vertically.
11
00:00:40,590 --> 00:00:43,180
And these are the directions each shift takes place.
12
00:00:43,360 --> 00:00:50,130
So images all the start of being at the top left corner and retranslated in any direction using the
13
00:00:50,130 --> 00:00:51,680
transition matrix here.
14
00:00:51,750 --> 00:00:53,660
So let's implement this and quite quickly.
15
00:00:55,760 --> 00:00:58,750
So let's implement transitions using open C-v now.
16
00:00:58,760 --> 00:01:00,230
So we're going through line by line.
17
00:01:00,290 --> 00:01:02,580
I'll quickly show you what's being done here.
18
00:01:02,600 --> 00:01:06,940
The important thing to note is that are using to see V2 warp and function.
19
00:01:07,020 --> 00:01:12,920
And that's been implemented down here so quickly going through the image as we've done before we extract
20
00:01:12,920 --> 00:01:17,390
the height and the width of the image using non-pay see function taking only the first two elements
21
00:01:17,540 --> 00:01:21,050
of the ship three that it retains.
22
00:01:21,290 --> 00:01:25,340
Next I have a line here where we extract quarter of the height and width of do it.
23
00:01:25,340 --> 00:01:29,660
That's going to be a T x and y value in our translation Matrix.
24
00:01:29,710 --> 00:01:35,400
That's the direction or sorry the amount of pixels we're going to shift to image.
25
00:01:35,990 --> 00:01:42,140
And we actually use not by fluke to the two that actually defines the read data type for where translations
26
00:01:42,290 --> 00:01:43,680
matrix.
27
00:01:44,060 --> 00:01:48,660
And by using some square brackets here we actually created a T matrix here.
28
00:01:48,770 --> 00:01:53,600
It may or may not be important for you understand this but just take note of the form of this t matrix
29
00:01:53,600 --> 00:01:54,260
here.
30
00:01:54,770 --> 00:01:57,270
So the warp find function takes away image.
31
00:01:57,270 --> 00:02:04,370
So if we look at it in the matrix that we created and all within a height as a table and it actually
32
00:02:04,820 --> 00:02:06,590
returns the translated image.
33
00:02:06,650 --> 00:02:09,230
So let's actually run this and see what it looks like.
34
00:02:11,040 --> 00:02:20,650
Tulla this is a translated image here as you can see it's shifted image of an extraction a quarter of
35
00:02:20,650 --> 00:02:22,840
the initial dimensions.
36
00:02:23,050 --> 00:02:27,740
And similarly for the White image and we're just done with.
37
00:02:27,760 --> 00:02:32,110
So it's important to know that we should just take a look at a T matrix to give give you an understanding
38
00:02:32,110 --> 00:02:33,620
of what we have done here.
39
00:02:34,150 --> 00:02:36,870
So this is exactly what we wanted in 0 2 metrics.
40
00:02:36,890 --> 00:02:44,800
It's 1 0 in disorder anti-X and the way this being a quarter of the height and a quarter of the weight
41
00:02:45,100 --> 00:02:45,720
respectively.