/
Embedded Programming and Robotics Embedded Programming and Robotics

Embedded Programming and Robotics - PowerPoint Presentation

faustina-dinatale
faustina-dinatale . @faustina-dinatale
Follow
390 views
Uploaded On 2018-01-31

Embedded Programming and Robotics - PPT Presentation

Lesson 14 The Raspberry Pi Camera Raspberry Pi Camera 1 Raspberry Pi Camera The camera is a remarkably powerful device that can take still photos at up to 5 megapixels and video Link to video on setup ID: 626598

raspberry camera programming video camera raspberry video programming preview program mode picamera capturing image setup capture stop 0camera settings

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Embedded Programming and Robotics" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Embedded Programming and Robotics

Lesson 14The Raspberry Pi Camera

Raspberry Pi Camera

1Slide2

Raspberry Pi Camera

The camera is a remarkably powerful device that can take still photos at up to 5 megapixels, and videoLink to video on setup:

https://www.raspberrypi.org/help/camera-module-setup/

If you haven’t already done so, enable the camera using

raspi-config

from a command line prompt

Raspberry Pi Camera

2Slide3

Raspberry Pi Camera

My setup: Camera held on a piece of bent coathanger

Motion sensor also connected to the Pi, so the system takes photos when motion is detectedThere is a red LED on the camera that comes on when it is in preview mode or taking a photo

Raspberry Pi Camera

3Slide4

Using the Camera

raspistill Capturing still photographs with the camera module

raspivid Capturing video with the camera module

Time-lapse

Taking pictures at regular intervals and stitching them together in to a video

raspiyuv Capturing still photographs and generating raw unprocessed image files

Raspberry Pi Camera

4Slide5

Programming the Camera

Get the Python package:

sudo apt-get install

python3-picamera

In the program:

import

picamera

camera =

picamera.PiCamera

() # camera object

Raspberry Pi Camera

5Slide6

Programming the Camera

It is easy to mount the camera upside-down, especially if you want it to face away from the portsYou can flip the camera:

camera.hflip

=

True

camera.vflip

= True

Raspberry Pi Camera

6Slide7

Programming the Camera

You can start a preview, but this will overlay the entire display so you won’t be able to see your Python screenUse Ctrl-D to terminate the program

c

amera.start_preview

();

This can be useful for a “roving camera”

Or you can show the preview for a predetermined length of time, then stop it with

camera.stop_preview

();

Raspberry Pi Camera

7Slide8

Camera Settings

camera.sharpness = 0camera.contrast

= 0camera.brightness = 50camera.saturation

= 0

camera.ISO

= 0camera.video_stabilization

= False

Raspberry Pi Camera

8Slide9

Camera Settings

camera.exposure_compensation = 0

camera.exposure_mode = 'auto'camera.meter_mode

= 'average'

camera.awb_mode

= 'auto'

camera.image_effect = 'none'camera.color_effects = None

camera.rotation

=

0

Raspberry Pi Camera

9Slide10

Camera Settings

camera.hflip = Falsecamera.vflip

= Falsecamera.crop = (0.0, 0.0, 1.0, 1.0)camera.resolution

= (320, 240)

Raspberry Pi Camera

10Slide11

Camera Programming

Capture a still image:

camera.capture

('image1.jpg

')

Capture 5 seconds of video:

camera.start_recording

('video.h264')

sleep(5)

camera.stop_recording

()

Raspberry Pi Camera

11Slide12

Programming Exercise

Write a program that takes a photo every 10 seconds, saving each one with a different name

Set the resolution relatively low so your disk doesn’t fill upProvide a way to exit the program without pressing ctrl-C

Using Curses, show the name of each file as you save it

You can use the

str

function to convert a number to a string

Raspberry Pi Camera

12