Capturing images using a camera
In this recipe, you will learn to capture a picture on your device camera. You will learn to access the Camera app on your Android device and click the pictures.
How to do it...
In this recipe, we will be making use of the following method cameraInteractiveCapturePicture()
, which activates the picture capturing app on an Android device and the clicked picture is saved to the SD card with the specified name.
Let's take a look at the following steps:
- Type the following code in the Python script
demoCamera.py
in the current folder of your computer:
import android app = android.Android()app.cameraInteractiveCapturePicture("/sdcard/cameraPic.jpg")
- Copy or push this Python script into the Android device by using the following command line:
C:\Users\Bintu\QPythonScripts>adb push demoCamera.py /sdcard/qpython/bintuscripts
How it works...
This recipe starts the picture capturing app on your Android device. That is, the Camera app on your device will be invoked enabling you...