Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
Considered these greyscale image. Now this image is made of pixels.
2
This particular one has three by five so it has 15 pixels so it's quite a small image.
3
Now each pixel has a value and that's what defines the intensity of the gray color for each pixel.
4
So in reality these are numbers but our computer display shows them in a color format which is easy
5
readable by us humans.
6
Where I'm trying to get is that programs use numbers to store images then the computer display or so
7
the screen converts these numbers to colors.
8
Python can also do image processing just like Photoshop does.
9
Probably it cannot do all the cool stuff that you can do with Photoshop but you can make use of Python
10
to automate things for instance we'll be using the image processing capabilities of Python to detect faces
11
from photos, from images and also detect moving objects in videos as well.
12
So videos are made of images.
13
So it's the same thing basically.
14
And Python stores and reads images using arrays of numbers.
15
For instance this image could be represented as you know a list of three other lists.
16
So three lists because we have 3 rows in there with pixels and than in each of these you would have like
17
five numbers and so on and so one and the fifth and the same for the other two lists.
18
We've got five numbers because we have five columns so five pixels for each row.
19
That's an image for Python.
20
And here is where Numpy comes in handy.
21
So while you can represent images with lists as we did here this is not very efficient because
22
for big images
23
lists occupy a lot of memory and therefore they slow down operations on them.
24
So this is solved by Numpy which is a library, a Python library that provides a multi dimensional
25
array object.
26
So let me go ahead and create this array object.
27
First of all you what you need to do is you need to import Numpy.
28
And if you have installed Pandas, Numpy should have been installed with Pandas because Pandas is based
29
on Numpy.
30
If you haven't installed Numpy just yet just yet, just go had and pip install Numpy.
31
Ad if for some reason you have some problems on Windows then just go
32
ahead as I've showed you
33
and find the precompiled Python libraries.
34
Go to this site and search for Numpy and then figure out if you are on a 3.5 version of Python then
35
just get that version and you pointed to this file with pip install and the name of the file.
36
Great. Now I have Numpy installed so I'll create this multi dimensional object and store it in the N variable.
37
38
Let it be numpy.arange and let's say 27.
39
Execute that.
40
And print out N.
41
So this is a Numpy array. That's how it is called.
42
This particular one is not exactly a multi dimensional array because it only has one dimension so it's
43
a plane�
44
It's like a plane list.
45
A Python list.
46
But still it's not exactly a list.
47
Type. Sorry.
48
So it's a Numpy N dimensional array.
49
It can have one dimensional two or three.
50
So we have one, two, three and I'll show all these scenarios. So that was the one dimensional array.
51
And if you want to print it in a nice form that'd be the array.
52
Now I'm just creating
53
a Numpy array using numbers on the fly here but normally you'd have to create arrays from images.
54
I will do that in just a bit so for now
55
let's create some arrays manually.
56
Now let's see what two dimensional arrays� Reshape three by nine.
57
So we already have this one dimensional array and we want to convert it to a two dimensional array.
58
If you execute that you get a two dimensional array.
59
So that's a two dimensional array because it has two dimensions.
60
So think of it as this image file.
61
We have two dimensions vertical and horizontal.
62
Now what is a three dimensional array? Even though a three dimensional arrays are less frequently used
63
64
is still good to know them.
65
And yeah, let me create a three dimensional array.
66
I could say three by three by three because you know you have 27 elements so three by three by three
67
gives you twenty seven and yup.
68
That's a three dimensional rate.
69
Think of that as a cube that has three dimensions.
70
So three by three with me and practically you'll see that in just a bit
71
in this lecture where do we deal with three dimensional array.
72
So bear with me and you are you able to see the similarities between a Numpy array and a plain Python list
73
of lists.
74
So this here would be like a two dimensional array if you like to call it like that. The structure
75
in the lower level is different between Python lists and Numpy arrays and also Numpy arrays allow you to make
76
some more efficient operations such as iteration between the array items and so on.
77
And you can also create a Numpy array out of Python lists. For instance I'll get this list here and I'll create
78
a new object and then point to Numpy and to covert a list to a Numpy array
79
you'd want to use Asarray method and then between the brackets goes the object that you want to convert.
80
81
And that's an array which is almost exactly like this on in here.
82
And if you print that you wouldn't be able to see the difference.
83
You know they look exactly the same but they are not.
84
Because this is the least of this is a Numpy array.
85
Great.
86
Let's move on.
87
So that's Numpy.
88
And as I mentioned earlier Numpy is a base library for all the libraries.
89
Such as Pandas and also OpenCV which is an image processing library.
90
So Pandas data frames are based on Numpy arrays and OpenCV objects are based on Numpy arrays.
91
92
So Pandas, what Pandas does it just adds some cool features in there such as it adds,
93
it gets capabilities for having table headers and indexes which you can't have in Numpy because Numpy
94
is meant to be more simple and in a more low level of storing objects and doing operations.
95
So Numpy is a requirement for many libraries.
96
And yeah, let's stop this lecture in here and in the next lecture we'll go straight ahead and create
97
a Numpy array out of our image should be in here.
98
So this image. Ok, see with there.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.