Or just artificialworlds.net/blog

Slides:



Advertisements
Similar presentations
Games in Python – the easy way
Advertisements

What we will cover today… Where is the camera on my phone? Taking a photo Zoom in and out Deleting a photo Where do my photos go to? Viewing my photos.
DREAMWEAVER Welcome to our website!
HOW TO MAKE A PIKE THEMED NEWSLETTER THROUGH MAILCHIMP IN THIS TUTORIAL YOU WILL LEARN HOW TO UPLOAD AND CUSTOMIZE A NEWSLETTER TEMPLATE THROUGH.
BCS Schoolwires by Brenda Luther. User Name and Employee Password.
Photo Editing Basics with Photoshop. Upload your pictures Connect the camera to an available USB port Connect the camera to an available USB port Turn.
2 What is pyGame? A set of Python modules to make it easier to write games. –home page: –documentation:
Pygame Dick Steflik.
Guide to Programming with Python
Adding Websites to a Folder  Putting sites into an already existing folder Putting sites into an already existing folder  Adding an image on the icon.
Microsoft Word Review Lesson
Using Dreamweaver. Slide 1 Dreamweaver has 2 screens that do different things The Document window where you create your WebPages The Site window where.
Open Dreamweaver Start All programs Adobe design and web premium Adobe Dreamweaver.
Meet Pygame Noah Kantrowitz June 8, The Basics Cross-platform Based on SDL (don’t quote me on that) Handle input (keyboard, mouse) and output (graphics,
Mappler Mobile – iPhone Prepared by VERTICES
V 1.0Slide 1 Staff – Basic Info. V 1.0Slide 2 Staff – Basic Info Input the search criteria. Click search to start searching.
Foxbright – Smarter Education Websiteswww.foxbright.com Foxbright Training Foxbright Teacher Pages
A STUDENT’S GUIDE TO ADDING IMAGES TO NEW OR EXISTING BLOG POSTS Adding Images to Your Blog Post Presented by Michelle Krummel.
By Sam Trott and Jamie Taylor. Directional buttons. Power button. Lift it up to turn it on. The four directional buttons they are: Square, X, Triangle,
Reference: The Game Loop Animation / Game loop 1. Update variables 2. [Get input from the user] (GameLoop only) 3. Draw (using variables)
Create Your Own Class Website Mary Foster Technology Coordinator, University Park Elementary
A POWERPOINT PRESENTATION HOW TO CREATE…. WHY YOU USE POWERPOINT Well PowerPoint is a vary useful tool when you need to create a presentation. By using.
Start with loading the picture Locate your camera’s USB cable –it looks something like this:
Instructions To create a new slide, or to add more text or more photos: -‘Right mouse click’ on the slide you want and choose ‘Duplicate a Slide’ OR -
PyGame - Unit 1 PyGame Unit – – Introduction to PyGame.
How to Use Google Earth By: Emma Lucken. How do you record a Google Earth Tour? When you go on to Google Earth you go to the top bar and there is an selection.
Graphics in Python On entry: Run Python 2.78 from N: drive/computing and ICT VLE: Computing home page - check your feedback Success criteria: ●Understands.
Intro to Pygame Lecture 05. What is Pygame? It is a set of Python modules designed for writing games. It makes writing games possible for beginners. import.
11. Skier Let’s Learn Saengthong School, June – August 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
Instructions You can easily edit the text and images on these Pinterest viral quotes by selecting either the text box or picture and working with that.
3. Drawing Let’s Learn Saengthong School, June – August 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
9. Media (sound effects, music, video) Let’s Learn Saengthong School, June – August 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
5. Animation Let’s Learn Saengthong School, June – August 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
13. Sprites. Outline 1.Game Things in Pygame (again) 2.The Pygame sprite Module 3.The Sprite Class 4.Groups of Sprites 5.Types of Collision Detection.
How to Add Pictures to SOF Gallery. Select and Click onto [PHOTO GALLERY] STEP 1.
4. Search button should work only if there is a key word.
INTRO to PIXLR.com.
MOM! Phineas and Ferb are … Aims:
15. Media (sound effects, music, video)
TEMPLATE INSTRUCTIONS Please use these instructions to complete your TV Ad Find YOUR Department / Program template or use the general College of Arts &
Catapult 2016.
Part II Reference:
PYGAME.
Let’s Learn 2. Installing Pygame
8. Installing Pygame
Installation Process Check the GUI and VA firmware version before installation Upload VA video Import License Note 1: The software version of GUI must.
9. Drawing.
Edit/Activate your vCard
User guide for Direct Observations equipment use
10. User Input.
11. Animation Let's Learn Python and Pygame
ICT & Statistics Center

Structuring Your Game's Code
9. Drawing Let's Learn Python and Pygame
Inputs and Outputs.
13. Sprites Let's Learn Python and Pygame
8. Starting Pygame Let's Learn Python and Pygame
10. User Input Let's Learn Python and Pygame
14. Pong.
Let’s Learn 7. Sprites Saengthong School, June – August 2016
TEMPLATE INSTRUCTIONS Please use these instructions to complete your TV Ad Find YOUR Department / Program template or use the general College of Arts &
14. Pong Let's Learn Python and Pygame
11. Animation.
Instructions You can easily edit the text and images on these Pinterest viral quotes by selecting either the text box or picture and working with that.
3D Effect Red/Cyan 3D Glasses!!!.
CoE Software Lab II , Semester 2, Pong.
CoE Software Lab II 1. Pygame Intro , Semester 2,
STEP 1: GO TO BELIEVEINSPIREGROW
CoE Software Lab II , Semester 2, Sprites.
Presentation transcript:

Or just artificialworlds.net/blog More info: http://www.artificialworlds.net/blog/2016/01/16/raspberry-pi-funniest-photo-game/ Or just artificialworlds.net/blog Funniest Photo Game Take the funniest photo Take a photo using our photo booth, and we will choose the funniest one at the end of the Jam! Instructions Choose a costume by pressing ←and → Take a photo by pressing SPACE or clicking the mouse Press G to see the gallery Click the Camera icon at the top to start again Making new costumes Make a new costume in The Gimp. The images MUST be 1280x720 pixels in size, and saved as .png format. Note: you MUST choose “Image” → “Mode” → “Indexed Color” or it won't work. Keeping photos If you want to keep your photos, ask us – we can upload them to our blog, or put them on a USB disk if you have one. We will update our blog at artificialworlds.net/blog after the Jam. Program See the other sheet for our code!

Funniest Photo Game – the Program import io import picamera from PIL import Image import time import pygame import subprocess import os class PhotoBooth: def __init__( self, camera ): self.camera = camera self.costumes = os.listdir( 'costumes' ) self.current_overlay = None self.cos_num= 0 self.current_costume = None self.set_up_camera() self.change_costume(0) def set_up_camera(self): self.camera.resolution = ( 1280, 720 ) self.camera.framerate = 24 self.camera.start_preview() def change_costume(self, change): self.cos_num += change self.cos_num = self.cos_num%len(self.costumes) self.current_costume = Image.open( 'costumes/'+self.costumes[self.cos_num]) self.overlay(self.current_costume, 128) def overlay(self, image, alpha): pad = Image.new('RGB', (((image.size[0] + 31) // 32) * 32, ((image.size[1] + 15) // 16) * 16)) pad.paste(image, (0, 0)) if self.current_overlay is not None: self.camera.remove_overlay(self.current_overlay) self.current_overlay = camera.add_overlay(pad.tostring(), size=image.size) self.current_overlay.alpha = alpha self.current_overlay.layer = 3 def take_photo(self): stream = io.BytesIO() camera.capture( stream, format='jpeg' ) stream.seek( 0 ) captimg = Image.open( stream ) imgrgba = self.current_costume.convert("RGBA") captimg.paste( imgrgba, ( 0, -100 ), imgrgba ) self.overlay(captimg, 255) captimg.save( 'gallery/photo%d.png' % time.time().real ) def run(self): while True: for event in pygame.event.get(): if event.type == pygame.QUIT: return if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: self.change_costume(1) if event.key == pygame.K_RIGHT: self.change_costume(-1) if event.key == pygame.K_SPACE: self.take_photo() if event.key == pygame.K_ESCAPE: return if event.key == pygame.K_g: subprocess.call('ls gallery/*.png | head -1 | xargs xdg-open', shell = True) if event.type == pygame.MOUSEBUTTONDOWN: self.take_photo() pygame.init() pygame.display.set_mode() with picamera.PiCamera() as camera: booth = PhotoBooth( camera ) booth.run()