No.
We are sure that the camera is correctly enabled and that we can use it.
So let's open funny by an E so we can write some python code.
And let's start with this line.
So we give the interpreter spike in three and then, well, there is a module, there is a Python module
that is already installed on a Raspberry Pi voice.
Then you're going to do from by camera.
So this is the bite camera module and you're going to do so from by camera.
All lowercase input by camera like this will be uppercase C uppercase.
And then what we are going to do is we are going to create a camera from right camera like this with
parentheses.
And from that camera object here we will be able to take some photos and we can add some settings.
For example, camera dot resolutions and it is a great input on setting and let's give, for example,
1008 by 720.
Okay.
So this is an HD photo for the resolution.
Make sure you give a tuple like this.
Okay, parentheses.
And then we need to choose where we want to save the photos actually.
So in let's open phi manager here then.
When we are in our own directory here, maybe we could create a camera folder.
So instead of just creating the camera folder here, it's from the python call.
So we are going to do import OS and then let's provide image folder name is equal to slash home slash
by.
Okay, this is where we are here and then slash camera.
Then we're going to check if this folder doesn't exist, then we are going to create it.
So if not voice.
But baths don't exist.
This is how to check that something exists.
If it doesn't exist.
We do voice notes and keep the I like in the terminal with the image folder.
So if we run that, this is going to create a camera folder here the first time and then the second
time is going to skip it because it already exists and then let's do it time that slick too.
Okay.
So why is that?
Let's do first import time because we use time here.
So why is that?
Simply because the camera needs a bit of time to adjust to the luminosity.
Okay.
So if you want to have a correct picture, when you take a picture, make sure you wait at least, let's
say two segments.
Okay?
So you create the camera, you set the settings, you create a folder, and you wait for 2 seconds and
then you can take a photo.
So in order to take your photo, we need to provide a file name.
Okay.
So let's do image file name is equal to.
So let's use the image folder name and let's arg.
So let's name each new image.
Okay.
We are going to use this extension and then you can do camera.
So the camera we have created here, that capture image file name.
Let's now run that code.
So we see it as it's a test.
Cameron Presenter And you can see now the program has grown.
We have not printed anything.
We could have printed some load here to say that we have actually taken a photo.
And you can see here on this monument, we have a new fold of camera.
I go on the camera folder and we have a new image and well, that's the current image.
Not actually.
It's quite dark in here.
I'm going to turn on the light and let's take the photo again.
Okay.
So let's wait just 2 seconds.
Maybe we can out of print here.
Print.
Take photo.
Okay.
So we can see.
Okay.
But take four so we know when we have the photo, let's just check the photo again.
So you can see that's actually when you take a photo with the finding it's going to replace any other
photo was taken before we the same thing here okay.
And you can see whether that's a photo.
And we have one problem here is that the photo is upside down.
So what I'm going to do is I'm going to add a new sitting here, which is camera.
That rotation is equal to 180 degrees.
So this depends actually on the photo.
You see that if you see the photo is upside down, then you can use this setting.
And then if you change the position of the camera, you can just adjust this to make sure that you have
a correct image.
So let's do photo again.
Take photo, and now the photo is correctly.
Orientated.
One thing I'm going to do also now is to test a difference of resolution because, well, when you take
a photo with a big resolution like this, so this is not the biggest, but it's quite big.
Then let's say here you see the file is 562 kilobytes.
Okay, so 500 kilobytes.
Now, let's take a photo with 640 and 480.
So this is a lower resolution.
Let's name it a new image, too.
Okay.
So we're going to have the image on the side and it's run again, the same photo.
Okay.
And let's check this image.
Okay.
The resolution is smaller, as you can see, but we still see clearing.
And now the photo is just 200 kilobytes.
So we have 500.
And we went from 500 to 200 kilometres.
And it is quite important because then when we take photo and we send photos to the Internet, it's
better actually to try to have a size that is quite small so it goes faster and it doesn't take too
much space.
All right.
And that's pretty much it from now for the camera.
We are going to come back to it in the following practice activities and not so in the final project
of the course.