Proj 3 - Camera Image Capture

Post Reply
glegrady
Posts: 203
Joined: Wed Sep 22, 2010 12:26 pm

Proj 3 - Camera Image Capture

Post by glegrady » Wed May 03, 2017 10:44 am

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
George Legrady
legrady@mat.ucsb.edu

annieyfong
Posts: 4
Joined: Wed Apr 12, 2017 5:07 pm

Re: Proj 3 - Camera Image Capture

Post by annieyfong » Wed May 03, 2017 10:54 am

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')
Attachments
test3.jpg
ayy lmao

fangfang
Posts: 4
Joined: Wed Apr 12, 2017 5:14 pm

Re: Proj 3 - Camera Image Capture

Post by fangfang » Wed May 03, 2017 11:45 am

#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')

taylormoon2014
Posts: 8
Joined: Wed Apr 12, 2017 5:47 pm

Re: Proj 3 - Camera Image Capture

Post by taylormoon2014 » Wed May 03, 2017 2:27 pm

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
Attachments
tiltPic.jpg
test10.jpg
this was one of the images taken by our robot - Group 3
test9.jpg
this was one of the images taken by our robot - Group 3
test7.jpg
this was one of the images taken by our robot - Group 3
test6.jpg
this was one of the images taken by our robot - Group 3
test5.jpg
this was one of the images taken by our robot - Group 3
test4.jpg
this was one of the images taken by our robot - Group 3
test3.jpg
this was one of the images taken by our robot - Group 3
test2.jpg
this was one of the images taken by our robot - Group 3
test1.jpg
this was one of the images taken by our robot - Group 3

zoe.m.rathbun
Posts: 5
Joined: Wed Apr 12, 2017 5:14 pm

Proj 3 ~~Group 5~~ rdm Camera Image Capture

Post by zoe.m.rathbun » Wed May 03, 2017 11:22 pm

We are group 5 <3 Much love friends


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"
imagien copy.jpg
This was the only picture I downloaded from the Server. More to come

cguijarro
Posts: 3
Joined: Mon Apr 17, 2017 10:56 am

Re: Proj 3 - Camera Image Capture

Post by cguijarro » Mon May 08, 2017 11:28 am

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')


Attachments
test.jpg

taylormoon2014
Posts: 8
Joined: Wed Apr 12, 2017 5:47 pm

Re: Proj 3 - Camera Image Capture

Post by taylormoon2014 » Wed May 10, 2017 10:39 am

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')

mfargas53
Posts: 6
Joined: Wed Apr 12, 2017 5:48 pm

Re: Proj 3 - Camera Image Capture

Post by mfargas53 » Mon May 15, 2017 11:28 am

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')
Attachments
test 2.jpg

Post Reply