Complete the code to capture an image using the Raspberry Pi camera.
import picamera with picamera.PiCamera() as camera: camera.[1]('image.jpg')
The capture() method takes a picture with the camera.
Complete the code to set the resolution of the camera before capturing an image.
import picamera with picamera.PiCamera() as camera: camera.[1] = (640, 480) camera.capture('image.jpg')
The resolution property sets the width and height of the image.
Fix the error in the code to correctly initialize the camera and capture an image.
import picamera camera = picamera.PiCamera() camera.[1]('photo.jpg')
You must create an instance by calling PiCamera() with parentheses, and then call capture() method with the filename.
Fill both blanks to create a dictionary of image filenames with their resolutions, filtering only images with width greater than 800.
images = {'img1.jpg': (1024, 768), 'img2.jpg': (640, 480), 'img3.jpg': (1280, 720)}
filtered = {filename: res for filename, res in images.items() if res[0] [1] [2]The code filters images where the width (res[0]) is greater than 800 pixels.
Fill all three blanks to create a dictionary of images with width greater than 700 and height less than 800.
images = {'a.jpg': (800, 600), 'b.jpg': (640, 480), 'c.jpg': (1024, 900)}
filtered = {filename: res for filename, res in images.items() if res[0] [1] [2] and res[1] [3] 800}The dictionary comprehension filters images where width is greater than 700 and height is less than 800.
