Presentation is loading. Please wait.

Presentation is loading. Please wait.

Camera Copyright (c) 2017 by Dr. E. Horvath.

Similar presentations


Presentation on theme: "Camera Copyright (c) 2017 by Dr. E. Horvath."— Presentation transcript:

1 Camera Copyright (c) 2017 by Dr. E. Horvath

2 Installing the Camera Update and upgrade the Raspian operating system
sudo apt-get update sudo apt-get upgrade Copyright (c) 2017 by Dr. E. Horvath

3 Installing the Camera Camera port location
Copyright (c) 2017 by Dr. E. Horvath

4 Installing the Camera Turn off the Pi.
Carefully lift up the latch and tilt back for the camera port. Insert the ribbon with the metal connections facing the HMDI connector and micro USB power supply connector. Carefully replace the latch on the camera port ribbon. Do not allow the camera module to touch the Pi! Menu -> Preferences -> Raspberry Pi Configuration Interfaces -> Camera -> Enabled Reboot Copyright (c) 2017 by Dr. E. Horvath

5 Camera from picamera import PiCamera from time import sleep
camera = PiCamera() camera.resolution = (2592, 1944) camera.framerate = 15 camera.image_effect = “pastel" #oilpaint,cartoon,solarize,emboss camera.annotate_text = "Dr. Horvath" camera.start_preview() # start a preview Copyright (c) 2017 by Dr. E. Horvath

6 Camera sleep(2) # sleep at least two seconds to get the right light levels camera.capture('/home/pi/Desktop/image.jpg') # Tage one picture for i in range(5): camera.capture("/home/pi/Desktop/image"+ str(i) + ".jpg") camera.stop_preview() # stop the preview Copyright (c) 2017 by Dr. E. Horvath

7 Take Video camera.resolution = (1920,1080)
camera.start_recording('/home/pi/Desktop/classvi deo.h264') sleep(10) camera.stop_recording() finally: camera.close() # Close the camera object once you have completed the code Copyright (c) 2017 by Dr. E. Horvath

8 Closing the Preview Hold down Ctrl+Alt+T which will open up a terminal. It will be hidden behind the preview. Type: pkill python3 or sudo xkill and click the window

9 Video Playback View Video omxplayer filename
# You may need this option -o hdmi omxplayer /home/pi/Desktop/classvideo.h264 Copyright (c) 2017 by Dr. E. Horvath

10 Email an Image import smtplib from email.mime.image import MIMEImage
from .mime.multipart import MIMEMultipart msg = MIMEMultipart() msg['Subject'] = 'Intruder Detected' username = 'username' password = 'password' msg['From'] = 'username' msg['To'] = 'username' msg.preamble = 'Intruder Image' Copyright (c) 2017 by Dr. E. Horvath

11 Email an Image file = 'LED.JPG' fp = open(file, 'rb')
img = MIMEImage(fp.read()) fp.close() msg.attach(img) server = smtplib.SMTP('smtp.gmail.com:587') server.ehlo() server.starttls() server.login(username,password) server.send_message(msg) server.quit() Copyright (c) 2017 by Dr. E. Horvath


Download ppt "Camera Copyright (c) 2017 by Dr. E. Horvath."

Similar presentations


Ads by Google