Proj 3 - Camera Image Capture
Proj 3 - Camera Image Capture
Each team to post their python camera image capture code as a reply to this message.
You can put the code directly in the message, see Annie Wong's post: viewtopic.php?f=74&t=298#p1965
You can put the code directly in the message, see Annie Wong's post: viewtopic.php?f=74&t=298#p1965
George Legrady
legrady@mat.ucsb.edu
legrady@mat.ucsb.edu
-
- Posts: 4
- Joined: Wed Apr 12, 2017 5:07 pm
Re: Proj 3 - Camera Image Capture
Group 4: Annie Fong, Haytham Alshawaf, Alex Alarcon
Code: Select all
#This code captures an image and send back to server
import time
import picamera
import os, sys
import pipan
from random import randint
# CENTER
print "Neutral the pan and tilt servos"
# create PiPan object
p = pipan.PiPan()
# neutral the pan servo
p.neutral_pan()
time.sleep (2)
# neutral the tilt servo
p.neutral_tilt()
time.sleep (1)
print "done"
#Pan (80, 220)
#Tilt (50, 250)
#RANDOM
pan_position = randint (120,180)
tilt_position = randint (75,125)
p.do_pan (pan_position)
p.do_tilt (tilt_position)
with picamera.PiCamera() as camera:
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('images/test.jpg')
Re: Proj 3 - Camera Image Capture
#GROUP 1
Code: Select all
#This code captures an image &send back to server
import time
import picamera
import os, sys
import pipan
from random import randint
p = pipan.PiPan()
p.neutral_pan()
p.neutral_tilt()
pan_position= randint (100,160)
tilt_position= randint (80,210)
pi.do_pan(pan_position)
pi.do_tilt(tilt_position)
with picamera.PiCamera() as camera:
#max 1920, 1080
camera.resolution =(1920,1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
time.sleep(2)
camera.capture('images/test.jpg')
-
- Posts: 8
- Joined: Wed Apr 12, 2017 5:47 pm
Re: Proj 3 - Camera Image Capture
Group 3
- We will add the code when we are connected to the server again; it will not allow us to access the code when we are outside of it; we combined the tilt function and the camera function to take more spontaneous pictures
- We will add the code when we are connected to the server again; it will not allow us to access the code when we are outside of it; we combined the tilt function and the camera function to take more spontaneous pictures
- Attachments
-
- Posts: 5
- Joined: Wed Apr 12, 2017 5:14 pm
Proj 3 ~~Group 5~~ rdm Camera Image Capture
We are group 5 <3 Much love friends
Code:
Code:
Code: Select all
import time
import picamera
import os, sys
import pipan
import random
p = pipan.PiPan()
#neutral tilt
p.neutral_tilt()
time.sleep (1)
#neutral pan
p.neutral_pan()
time.sleep (1)
#random position
#pan
from random import randint
pan_position = randint(100,160)
p.do_pan(pan_position)
time.sleep(0.5)
#tilt
from random import randint
tilt_position = randint(100, 180)
p.do_tilt(tilt_position)
time.sleep(0.5)
with picamera.PiCamera() as camera:
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('Images/imagienz.jpg')
print "done"
Re: Proj 3 - Camera Image Capture
Group 6
Code: Select all
import time
import picamera
import os, sys
import pipan
# center the camera
p = pipan.PiPan()
p.neutral_pan()
p.neutral_tilt()
time.sleep (1)
with picamera.PiCamera() as camera:
from random import randint
pan_position = randint(100,160)
tilt_position = randint(100,160)
p.do_pan(pan_position)
time.sleep(0.1)
p.do_tilt(tilt_position)
time.sleep(0.1)
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# camera warm-up time
time.sleep(2)
camera.capture('images/test.jpg')
-
- Posts: 8
- Joined: Wed Apr 12, 2017 5:47 pm
Re: Proj 3 - Camera Image Capture
I was unable to attach the code until this point due to the inability to open the server outside of the MAT department. The pictures were uploaded on the proper date as proof of the code's success in class.
# This code captures an image and send back to server
# Moon, Larsen, Chan
GROUP3
import time
import os, sys
import pipan
import picamera
print "Check that Tilt servo is moving (vertical movement)"
p = pipan.PiPan()
p.neutral_tilt()
x = 150
while 1:
# move head down
while x < 180:
p.do_tilt (int(x))
time.sleep(0.1)
x += 2
with picamera.PiCamera() as camera:
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('images/test9.jpg')
# move head up
while x > 90:
p.do_tilt (int(x))
time.sleep(0.1)
x -= 2
with picamera.PiCamera() as camera:
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('images/test10.jpg')
# This code captures an image and send back to server
# Moon, Larsen, Chan
GROUP3
import time
import os, sys
import pipan
import picamera
print "Check that Tilt servo is moving (vertical movement)"
p = pipan.PiPan()
p.neutral_tilt()
x = 150
while 1:
# move head down
while x < 180:
p.do_tilt (int(x))
time.sleep(0.1)
x += 2
with picamera.PiCamera() as camera:
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('images/test9.jpg')
# move head up
while x > 90:
p.do_tilt (int(x))
time.sleep(0.1)
x -= 2
with picamera.PiCamera() as camera:
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('images/test10.jpg')
Re: Proj 3 - Camera Image Capture
Code: Select all
#This code captures an image and send back to server
import time
import picamera
import os, sys
import pipan
from random import randint
# CENTER
print "Neutral the pan and tilt servos"
# create PiPan object
p = pipan.PiPan()
# neutral the pan servo
p.neutral_pan()
time.sleep (2)
# neutral the tilt servo
p.neutral_tilt()
time.sleep (1)
print "done"
#Pan (80, 220)
#Tilt (50, 250)
#RANDOM
pan_position = randint (120,180)
tilt_position = randint (75,125)
p.do_pan (pan_position)
p.do_tilt (tilt_position)
with picamera.PiCamera() as camera:
camera.resolution = (1920, 1080)
camera.hflip = True
camera.vflip = True
camera.start_preview()
# Camera warm-up time
time.sleep(2)
camera.capture('images/test.jpg')