Page 1 of 1

Proj 3 - Camera Image Capture

Posted: Wed May 03, 2017 10:44 am
by glegrady
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

Re: Proj 3 - Camera Image Capture

Posted: Wed May 03, 2017 10:54 am
by annieyfong
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

Posted: Wed May 03, 2017 11:45 am
by fangfang
#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')

Re: Proj 3 - Camera Image Capture

Posted: Wed May 03, 2017 2:27 pm
by taylormoon2014
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

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

Posted: Wed May 03, 2017 11:22 pm
by zoe.m.rathbun
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

Re: Proj 3 - Camera Image Capture

Posted: Mon May 08, 2017 11:28 am
by cguijarro
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')



Re: Proj 3 - Camera Image Capture

Posted: Wed May 10, 2017 10:39 am
by taylormoon2014
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')

Re: Proj 3 - Camera Image Capture

Posted: Mon May 15, 2017 11:28 am
by mfargas53

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