Пример #1
0
import sensor, pyb, time

# Reset sensor
sensor.reset()

# Set sensor settings
sensor.set_brightness(0)
sensor.set_saturation(0)
sensor.set_gainceiling(16)
sensor.set_contrast(1)
sensor.set_framesize(sensor.QVGA)

# Enable JPEG and set quality
sensor.set_pixformat(sensor.JPEG)
sensor.set_quality(98)

# Red LED
led = pyb.LED(1)

# Skip a few frames to allow the sensor settle down
# Note: This takes more time when exec from the IDE.
for i in range(0, 30):
    sensor.snapshot()

# Turn on red LED and wait for a second
led.on()
time.sleep(1000)

# Write JPEG image to file
with open("/test.jpeg", "w") as f:
    f.write(sensor.snapshot())
Пример #2
0
import sensor, time
sensor.reset()
# Set sensor parameters
sensor.set_contrast(1)
sensor.set_gainceiling(8)

# Set sensor pixel format
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.JPEG)
sensor.set_quality(95)

clock = time.clock()

while (True):
    clock.tick()
    image = sensor.snapshot()
    time.sleep(1)
    print(clock.fps())
Пример #3
0
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False)         # must be turned off for color tracking
sensor.set_auto_whitebal(False)     # must be turned off for color tracking
sensor.set_auto_exposure(False, 10000)
#sensor.set_backlight(1)
#sensor.set_brightness(+2)
#sensor.set_windowing(roi)
clock = time.clock()'''

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_contrast(+0)
sensor.set_saturation(+3)
sensor.set_brightness(+0)
sensor.set_quality(0)
sensor.set_auto_exposure(False, 8000)
sensor.set_auto_gain(True)
sensor.skip_frames(time=300)

clock = time.clock()
##############################################################################

# [] list
# () tupla

while (True):
    clock.tick()

    blue_led.off()
Пример #4
0
 import sensor, time, pyb
 #from avi import AVI 
 
 # Recording length in seconds
 REC_LENGTH = 10
 
 # Reset sensor
 sensor.reset()
 
 # Set sensor settings
 sensor.set_contrast(2)
 sensor.set_framesize(sensor.VGA)
 
 # Enable JPEG and set quality
 sensor.set_pixformat(sensor.JPEG)
 sensor.set_quality(95)
 
 # Skip a few frames to allow the sensor settle down
 # Note: This takes more time when exec from the IDE.
 for i in range(0, 30):
     sensor.snapshot()
 
 # Create red LED object
 led = pyb.LED(1)
 # Create video file
 video = AVI("%d.mjpeg"%pyb.rng(), 640, 480)
 
 # Recording clocks
 led.on()
 clock = time.clock()
 start = time.ticks()