Creation repo sue RPi3
This commit is contained in:
19
Camera/camera.py
Normal file
19
Camera/camera.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from picamera import PiCamera
|
||||
from time import sleep
|
||||
|
||||
camera = PiCamera()
|
||||
|
||||
#camera.rotation = 180
|
||||
camera.start_preview()
|
||||
#camera.start_preview(alpha=200)
|
||||
# 2s mini pour le capteur
|
||||
sleep(3)
|
||||
camera.capture('/home/pi/Desktop/image.jpg')
|
||||
camera.stop_preview()
|
||||
|
||||
# mode rafale
|
||||
camera.start_preview()
|
||||
for i in range(5):
|
||||
sleep(2)
|
||||
camera.capture('/home/pi/Desktop/image%s.jpg' % i)
|
||||
camera.stop_preview()
|
||||
9
Camera/camera_2.py
Normal file
9
Camera/camera_2.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import time
|
||||
import picamera
|
||||
|
||||
with picamera.PiCamera() as camera:
|
||||
camera.resolution = (1024, 768)
|
||||
camera.start_preview()
|
||||
# Camera warm-up time
|
||||
time.sleep(2)
|
||||
camera.capture('/home/pi/Desktop/foo.jpg', resize=(320, 240))
|
||||
21
Camera/camera_low_light.py
Normal file
21
Camera/camera_low_light.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# https://picamera.readthedocs.io/en/release-1.10/recipes1.html#capturing-in-low-light
|
||||
|
||||
import picamera
|
||||
from time import sleep
|
||||
from fractions import Fraction
|
||||
|
||||
with picamera.PiCamera() as camera:
|
||||
camera.resolution = (1280, 720)
|
||||
# Set a framerate of 1/6fps, then set shutter
|
||||
# speed to 6s and ISO to 800
|
||||
camera.framerate = Fraction(1, 6)
|
||||
camera.shutter_speed = 6000000
|
||||
camera.exposure_mode = 'off'
|
||||
camera.iso = 800
|
||||
# Give the camera a good long time to measure AWB
|
||||
# (you may wish to use fixed AWB instead)
|
||||
sleep(10)
|
||||
# Finally, capture an image with a 6s exposure. Due
|
||||
# to mode switching on the still port, this will take
|
||||
# longer than 6 seconds
|
||||
camera.capture('/home/pi/Desktop/dark.jpg')
|
||||
14
Camera/camera_overlay_text.py
Normal file
14
Camera/camera_overlay_text.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import picamera
|
||||
import time
|
||||
import itertools
|
||||
|
||||
s = "This message would be far too long to display normally..."
|
||||
|
||||
with picamera.PiCamera() as camera:
|
||||
camera.resolution = (640, 480)
|
||||
camera.framerate = 24
|
||||
camera.start_preview()
|
||||
camera.annotate_text = ' ' * 31
|
||||
for c in itertools.cycle(s):
|
||||
camera.annotate_text = camera.annotate_text[1:31] + c
|
||||
time.sleep(0.1)
|
||||
18
Camera/camera_sequence.py
Normal file
18
Camera/camera_sequence.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# https://picamera.readthedocs.io/en/release-1.10/recipes1.html#capturing-consistent-images
|
||||
|
||||
import time
|
||||
import picamera
|
||||
|
||||
with picamera.PiCamera() as camera:
|
||||
camera.resolution = (1280, 720)
|
||||
camera.framerate = 30
|
||||
# Wait for the automatic gain control to settle
|
||||
time.sleep(2)
|
||||
# Now fix the values
|
||||
camera.shutter_speed = camera.exposure_speed
|
||||
camera.exposure_mode = 'off'
|
||||
g = camera.awb_gains
|
||||
camera.awb_mode = 'off'
|
||||
camera.awb_gains = g
|
||||
# Finally, take several photos with the fixed settings
|
||||
camera.capture_sequence(['/home/pi/Desktop/image%02d.jpg' % i for i in range(10)])
|
||||
11
Camera/camera_timelapse.py
Normal file
11
Camera/camera_timelapse.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# https://picamera.readthedocs.io/en/release-1.10/recipes1.html#capturing-timelapse-sequences
|
||||
|
||||
import time
|
||||
import picamera
|
||||
|
||||
with picamera.PiCamera() as camera:
|
||||
camera.start_preview()
|
||||
time.sleep(2)
|
||||
for filename in camera.capture_continuous('img{counter:03d}.jpg'):
|
||||
print('Captured %s' % filename)
|
||||
time.sleep(300) # wait 5 minutes
|
||||
19
Camera/video.py
Normal file
19
Camera/video.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from picamera import PiCamera
|
||||
from time import sleep
|
||||
|
||||
camera = PiCamera()
|
||||
|
||||
|
||||
camera.resolution = (640, 480)
|
||||
|
||||
#camera.start_preview()
|
||||
|
||||
print()
|
||||
camera.start_recording('/home/pi/Desktop/video.h264')
|
||||
|
||||
camera.wait_recording(5)
|
||||
|
||||
camera.stop_recording()
|
||||
camera.close()
|
||||
|
||||
print("video recording stopped")
|
||||
9
Camera/video_2.py
Normal file
9
Camera/video_2.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# https://picamera.readthedocs.io/en/release-1.10/recipes1.html#recording-video-to-a-file
|
||||
|
||||
import picamera
|
||||
|
||||
with picamera.PiCamera() as camera:
|
||||
camera.resolution = (640, 480)
|
||||
camera.start_recording('/home/pi/Desktop/my_video.h264')
|
||||
camera.wait_recording(10)
|
||||
camera.stop_recording()
|
||||
Reference in New Issue
Block a user