
BeagleBone By Example
By :

In this chapter we will be writing a code to capture an image from a camera and saving it in .jpg
format using Python.
Let's first create a directory named ImageCapture
inside which we can save the Python file in which we write the code, and where we can also save the image file that we capture:
mkdir ImageCapture
cd ImageCapture
It will look like the following screenshot:
sudo nano TakePhoto.py
Refer to the following image:
Now we can go ahead and start writing the code to capture an image from the camera and save it on the BeagleBone Black:
The simplest code possible to do this is given in the following screenshot:
Save it and run it to capture an image from the camera and save it.
The output you will see when you run the code sudo python TakePhoto.py
is as shown in the following screenshot:
If you don't get any errors and the program ends printing the Saving Image text, everything should have happened properly. To check this let...