Change sensor to grayscale for Portenta

This commit is contained in:
Sebastian Romero 2021-03-17 17:53:48 +01:00
parent d11908c62b
commit 34fd67be98
105 changed files with 133 additions and 133 deletions

View File

@ -5,7 +5,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.

View File

@ -59,7 +59,7 @@ write_command(0x3A, 0x05)
write_command(0x29) write_command(0x29)
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # must be this sensor.set_pixformat(sensor.GRAYSCALE) # must be this
sensor.set_framesize(sensor.QQVGA2) # must be this sensor.set_framesize(sensor.QQVGA2) # must be this
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -25,7 +25,7 @@ from pyb import USB_VCP
usb = USB_VCP() usb = USB_VCP()
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.

View File

@ -6,7 +6,7 @@ import sensor, image, time
from pyb import Pin from pyb import Pin
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
# This pin will be toggled on/off on VSYNC rising and falling edges. # This pin will be toggled on/off on VSYNC rising and falling edges.

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -8,12 +8,12 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
hint = image.BICUBIC # image.BILINEAR image.BICUBIC hint = image.BICUBIC # image.BILINEAR image.BICUBIC
small_img = image.Image(4, 4, sensor.RGB565) small_img = image.Image(4, 4, sensor.GRAYSCALE)
small_img.set_pixel(0, 0, (0, 0, 127)) small_img.set_pixel(0, 0, (0, 0, 127))
small_img.set_pixel(1, 0, (47, 255, 199)) small_img.set_pixel(1, 0, (47, 255, 199))
small_img.set_pixel(2, 0, (0, 188, 255)) small_img.set_pixel(2, 0, (0, 188, 255))
@ -33,7 +33,7 @@ small_img.set_pixel(3, 3, (50, 255, 195))
#small_img.to_grayscale() #small_img.to_grayscale()
#small_img.to_bitmap() #small_img.to_bitmap()
big_img = image.Image(128, 128, sensor.RGB565) big_img = image.Image(128, 128, sensor.GRAYSCALE)
big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint) big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint)
#big_img.to_grayscale() #big_img.to_grayscale()
#big_img.to_bitmap() #big_img.to_bitmap()

View File

@ -8,7 +8,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
hint = image.BICUBIC # image.BILINEAR image.BICUBIC hint = image.BICUBIC # image.BILINEAR image.BICUBIC
@ -23,7 +23,7 @@ hint |= 0 # image.EXTRACT_RGB_CHANNEL_FIRST
# #
hint |= 0 # image.APPLY_COLOR_PALETTE_FIRST hint |= 0 # image.APPLY_COLOR_PALETTE_FIRST
small_img = image.Image(4, 4, sensor.RGB565) small_img = image.Image(4, 4, sensor.GRAYSCALE)
small_img.set_pixel(0, 0, (0, 0, 127)) small_img.set_pixel(0, 0, (0, 0, 127))
small_img.set_pixel(1, 0, (47, 255, 199)) small_img.set_pixel(1, 0, (47, 255, 199))
small_img.set_pixel(2, 0, (0, 188, 255)) small_img.set_pixel(2, 0, (0, 188, 255))
@ -43,7 +43,7 @@ small_img.set_pixel(3, 3, (50, 255, 195))
#small_img.to_grayscale() #small_img.to_grayscale()
#small_img.to_bitmap() #small_img.to_bitmap()
big_img = image.Image(128, 128, sensor.RGB565) big_img = image.Image(128, 128, sensor.GRAYSCALE)
big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint) big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint)
#big_img.to_grayscale() #big_img.to_grayscale()
#big_img.to_bitmap() #big_img.to_bitmap()

View File

@ -8,12 +8,12 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
hint = image.BICUBIC # image.BILINEAR image.BICUBIC hint = image.BICUBIC # image.BILINEAR image.BICUBIC
small_img = image.Image(4, 4, sensor.RGB565) small_img = image.Image(4, 4, sensor.GRAYSCALE)
small_img.set_pixel(0, 0, (0, 0, 127)) small_img.set_pixel(0, 0, (0, 0, 127))
small_img.set_pixel(1, 0, (47, 255, 199)) small_img.set_pixel(1, 0, (47, 255, 199))
small_img.set_pixel(2, 0, (0, 188, 255)) small_img.set_pixel(2, 0, (0, 188, 255))
@ -33,7 +33,7 @@ small_img.set_pixel(3, 3, (50, 255, 195))
#small_img.to_grayscale() #small_img.to_grayscale()
#small_img.to_bitmap() #small_img.to_bitmap()
big_img = image.Image(128, 128, sensor.RGB565) big_img = image.Image(128, 128, sensor.GRAYSCALE)
big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint) big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint)
#big_img.to_grayscale() #big_img.to_grayscale()
#big_img.to_bitmap() #big_img.to_bitmap()

View File

@ -8,7 +8,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
hint = image.BICUBIC # image.BILINEAR image.BICUBIC hint = image.BICUBIC # image.BILINEAR image.BICUBIC
@ -23,7 +23,7 @@ hint |= 0 # image.EXTRACT_RGB_CHANNEL_FIRST
# #
hint |= 0 # image.APPLY_COLOR_PALETTE_FIRST hint |= 0 # image.APPLY_COLOR_PALETTE_FIRST
small_img = image.Image(4, 4, sensor.RGB565) small_img = image.Image(4, 4, sensor.GRAYSCALE)
small_img.set_pixel(0, 0, (0, 0, 127)) small_img.set_pixel(0, 0, (0, 0, 127))
small_img.set_pixel(1, 0, (47, 255, 199)) small_img.set_pixel(1, 0, (47, 255, 199))
small_img.set_pixel(2, 0, (0, 188, 255)) small_img.set_pixel(2, 0, (0, 188, 255))
@ -43,7 +43,7 @@ small_img.set_pixel(3, 3, (50, 255, 195))
#small_img.to_grayscale() #small_img.to_grayscale()
#small_img.to_bitmap() #small_img.to_bitmap()
big_img = image.Image(128, 128, sensor.RGB565) big_img = image.Image(128, 128, sensor.GRAYSCALE)
big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint) big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=hint)
#big_img.to_grayscale() #big_img.to_grayscale()
#big_img.to_bitmap() #big_img.to_bitmap()

View File

@ -18,7 +18,7 @@ medium_img = image.Image(32, 32, sensor.RGB565, copy_to_fb=True)
#medium_img.to_grayscale() #medium_img.to_grayscale()
#medium_img.to_bitmap() #medium_img.to_bitmap()
small_img = image.Image(4, 4, sensor.RGB565) small_img = image.Image(4, 4, sensor.GRAYSCALE)
small_img.set_pixel(0, 0, (0, 0, 127)) small_img.set_pixel(0, 0, (0, 0, 127))
small_img.set_pixel(1, 0, (47, 255, 199)) small_img.set_pixel(1, 0, (47, 255, 199))
small_img.set_pixel(2, 0, (0, 188, 255)) small_img.set_pixel(2, 0, (0, 188, 255))
@ -38,7 +38,7 @@ small_img.set_pixel(3, 3, (50, 255, 195))
#small_img.to_grayscale() #small_img.to_grayscale()
#small_img.to_bitmap() #small_img.to_bitmap()
big_img = image.Image(128, 128, sensor.RGB565) big_img = image.Image(128, 128, sensor.GRAYSCALE)
big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=up_hint) big_img.draw_image(small_img, 0, 0, x_scale=32, y_scale=32, hint=up_hint)
#big_img.to_grayscale() #big_img.to_grayscale()
#big_img.to_bitmap() #big_img.to_bitmap()

View File

@ -17,7 +17,7 @@ big_img = image.Image(128, 128, sensor.RGB565, copy_to_fb=True)
#big_img.to_grayscale() #big_img.to_grayscale()
#big_img.to_bitmap() #big_img.to_bitmap()
small_img = image.Image(4, 4, sensor.RGB565) small_img = image.Image(4, 4, sensor.GRAYSCALE)
small_img.set_pixel(0, 0, (0, 0, 127)) small_img.set_pixel(0, 0, (0, 0, 127))
small_img.set_pixel(1, 0, (47, 255, 199)) small_img.set_pixel(1, 0, (47, 255, 199))
small_img.set_pixel(2, 0, (0, 188, 255)) small_img.set_pixel(2, 0, (0, 188, 255))

View File

@ -15,12 +15,12 @@ clock = time.clock()
# Initialise palette source colors into an image # Initialise palette source colors into an image
palette_source_colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 0, 255)] palette_source_colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 0, 255)]
palette_source_color_image = image.Image(len(palette_source_colors), 1, sensor.RGB565) palette_source_color_image = image.Image(len(palette_source_colors), 1, sensor.GRAYSCALE)
for i, color in enumerate(palette_source_colors): for i, color in enumerate(palette_source_colors):
palette_source_color_image[i] = color palette_source_color_image[i] = color
# Scale the image to palette width and smooth them # Scale the image to palette width and smooth them
palette = image.Image(256,1, sensor.RGB565) palette = image.Image(256,1, sensor.GRAYSCALE)
palette.draw_image(palette_source_color_image, 0, 0, x_scale=palette.width() / palette_source_color_image.width()) palette.draw_image(palette_source_color_image, 0, 0, x_scale=palette.width() / palette_source_color_image.width())
palette.mean(int(palette.width() / palette_source_color_image.width()/2)) palette.mean(int(palette.width() / palette_source_color_image.width()/2))

View File

@ -6,7 +6,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -9,7 +9,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -7,7 +7,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE... sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA... sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -5,7 +5,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.RGB565 sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -7,7 +7,7 @@ import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -10,7 +10,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -24,7 +24,7 @@ while(True):
img.binary([grayscale_thres]) img.binary([grayscale_thres])
img.dilate(2) img.dilate(2)
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
for i in range(20): for i in range(20):
img = sensor.snapshot() img = sensor.snapshot()
img.binary([rgb565_thres]) img.binary([rgb565_thres])

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -8,7 +8,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -8,7 +8,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -8,7 +8,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -7,7 +7,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -7,7 +7,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -7,7 +7,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -7,7 +7,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -7,7 +7,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -7,7 +7,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -22,7 +22,7 @@ FOV_WINDOW = 60 # Between 0 and 180. Represents the field-of-view of the scene
# the image in 3D intersecting the scene window. # the image in 3D intersecting the scene window.
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -11,7 +11,7 @@
import sensor, image, time, pyb import sensor, image, time, pyb
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -10,7 +10,7 @@ RED_LED_PIN = 1
BLUE_LED_PIN = 3 BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.

View File

@ -10,7 +10,7 @@ RED_LED_PIN = 1
BLUE_LED_PIN = 3 BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.

View File

@ -11,7 +11,7 @@ RED_LED_PIN = 1
BLUE_LED_PIN = 3 BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.

View File

@ -12,7 +12,7 @@ RED_LED_PIN = 1
BLUE_LED_PIN = 3 BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -15,7 +15,7 @@ RED_LED_PIN = 1
BLUE_LED_PIN = 3 BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.

View File

@ -8,7 +8,7 @@ import sensor, image, time
N_FRAMES = 500 N_FRAMES = 500
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
# This frame size must match the image size passed to ImageIO # This frame size must match the image size passed to ImageIO

View File

@ -13,7 +13,7 @@ import sensor, image, time
snapshot_source = False # Set to true once finished to pull data from sensor. snapshot_source = False # Set to true once finished to pull data from sensor.
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -11,7 +11,7 @@ import sensor, image, pyb, time
record_time = 10000 # 10 seconds in milliseconds record_time = 10000 # 10 seconds in milliseconds
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -13,7 +13,7 @@ RED_LED_PIN = 1
BLUE_LED_PIN = 3 BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -16,7 +16,7 @@ RED_LED_PIN = 1
BLUE_LED_PIN = 3 BLUE_LED_PIN = 3
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.

View File

@ -9,7 +9,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster sensor.set_pixformat(sensor.GRAYSCALE) # grayscale is faster
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -11,7 +11,7 @@ enable_lens_corr = False # turn on for straighter lines...
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster sensor.set_pixformat(sensor.GRAYSCALE) # grayscale is faster
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -14,7 +14,7 @@ enable_lens_corr = False # turn on for straighter lines...
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster sensor.set_pixformat(sensor.GRAYSCALE) # grayscale is faster
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -10,7 +10,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster (160x120 max on OpenMV-M7) sensor.set_pixformat(sensor.GRAYSCALE) # grayscale is faster (160x120 max on OpenMV-M7)
sensor.set_framesize(sensor.QQVGA) sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
clock = time.clock() clock = time.clock()

View File

@ -4,7 +4,7 @@ import sensor, image, time
from random import randint from random import randint
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
sensor.set_auto_gain(False) sensor.set_auto_gain(False)

View File

@ -6,7 +6,7 @@ import sensor, image, time
print("Letting auto algorithms run. Don't put anything in front of the camera!") print("Letting auto algorithms run. Don't put anything in front of the camera!")
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_gain(False) # must be turned off for color tracking

View File

@ -7,7 +7,7 @@ import sensor, image, time
thresholds = (100, 100, 0, 0, 0, 0) # thresholds for bright white light from IR. thresholds = (100, 100, 0, 0, 0, 0) # thresholds for bright white light from IR.
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) sensor.set_framesize(sensor.VGA)
sensor.set_windowing((240, 240)) # 240x240 center pixels of VGA sensor.set_windowing((240, 240)) # 240x240 center pixels of VGA
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)

View File

@ -13,7 +13,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds
# scene with 16 thresholds before color thresholds start to overlap heavily. # scene with 16 thresholds before color thresholds start to overlap heavily.
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_gain(False) # must be turned off for color tracking

View File

@ -15,7 +15,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds -> index is
# Codes are or'ed together when "merge=True" for "find_blobs". # Codes are or'ed together when "merge=True" for "find_blobs".
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_gain(False) # must be turned off for color tracking

View File

@ -14,7 +14,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds -> index is
# Codes are or'ed together when "merge=True" for "find_blobs". # Codes are or'ed together when "merge=True" for "find_blobs".
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_gain(False) # must be turned off for color tracking

View File

@ -13,7 +13,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds
(0, 30, 0, 64, -128, 0)] # generic_blue_thresholds (0, 30, 0, 64, -128, 0)] # generic_blue_thresholds
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_gain(False) # must be turned off for color tracking

View File

@ -6,7 +6,7 @@
import sensor, image, time, math import sensor, image, time, math
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_gain(False) # must turn this off to prevent image washout...

View File

@ -6,7 +6,7 @@
import sensor, image, time, math import sensor, image, time, math
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) sensor.set_framesize(sensor.VGA)
sensor.set_windowing((320, 240)) # 2x Zoom sensor.set_windowing((320, 240)) # 2x Zoom
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_gain(False) # must turn this off to prevent image washout...

View File

@ -65,7 +65,7 @@ import image, math, pyb, sensor, struct, time
# Camera Setup # Camera Setup
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) sensor.set_auto_gain(False)

View File

@ -71,7 +71,7 @@ import image, math, pyb, sensor, struct, time
# Camera Setup # Camera Setup
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) sensor.set_auto_gain(False)

View File

@ -65,7 +65,7 @@ import image, math, pyb, sensor, struct, time
# Camera Setup # Camera Setup
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) sensor.set_auto_gain(False)

View File

@ -82,7 +82,7 @@ def send_optical_flow_packet(x, y, c):
update_led() update_led()
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.B64X32) # Set frame size to 64x32... (or 64x64)... sensor.set_framesize(sensor.B64X32) # Set frame size to 64x32... (or 64x64)...
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.
@ -91,7 +91,7 @@ clock = time.clock() # Create a clock object to track the FPS.
# There's a lot more RAM in the frame buffer than in the MicroPython heap. # There's a lot more RAM in the frame buffer than in the MicroPython heap.
# However, after doing this you have a lot less RAM for some algorithms... # However, after doing this you have a lot less RAM for some algorithms...
# So, be aware that it's a lot easier to get out of RAM issues now. # So, be aware that it's a lot easier to get out of RAM issues now.
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
extra_fb.replace(sensor.snapshot()) extra_fb.replace(sensor.snapshot())
while(True): while(True):

View File

@ -5,7 +5,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 3000) # Capture frames for 3000ms. sensor.skip_frames(time = 3000) # Capture frames for 3000ms.
sensor.sleep(True) # Enable sensor sleep mode (saves about 40mA). sensor.sleep(True) # Enable sensor sleep mode (saves about 40mA).

View File

@ -12,7 +12,7 @@ BG_UPDATE_FRAMES = 50 # How many frames before blending.
BG_UPDATE_BLEND = 128 # How much to blend by... ([0-256]==[0.0-1.0]). BG_UPDATE_BLEND = 128 # How much to blend by... ([0-256]==[0.0-1.0]).
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.RGB565 sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.
@ -23,7 +23,7 @@ clock = time.clock() # Tracks FPS.
# So, be aware that it's a lot easier to get out of RAM issues now. However, # So, be aware that it's a lot easier to get out of RAM issues now. However,
# frame differencing doesn't use a lot of the extra space in the frame buffer. # frame differencing doesn't use a lot of the extra space in the frame buffer.
# But, things like AprilTags do and won't work if you do this... # But, things like AprilTags do and won't work if you do this...
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
print("About to save background image...") print("About to save background image...")
sensor.skip_frames(time = 2000) # Give the user time to get ready. sensor.skip_frames(time = 2000) # Give the user time to get ready.

View File

@ -9,7 +9,7 @@ import sensor, image, pyb, os, time
TRIGGER_THRESHOLD = 5 TRIGGER_THRESHOLD = 5
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.
@ -20,7 +20,7 @@ clock = time.clock() # Tracks FPS.
# So, be aware that it's a lot easier to get out of RAM issues now. However, # So, be aware that it's a lot easier to get out of RAM issues now. However,
# frame differencing doesn't use a lot of the extra space in the frame buffer. # frame differencing doesn't use a lot of the extra space in the frame buffer.
# But, things like AprilTags do and won't work if you do this... # But, things like AprilTags do and won't work if you do this...
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
print("About to save background image...") print("About to save background image...")
sensor.skip_frames(time = 2000) # Give the user time to get ready. sensor.skip_frames(time = 2000) # Give the user time to get ready.

View File

@ -8,7 +8,7 @@ import sensor, image, pyb, os, time
TRIGGER_THRESHOLD = 5 TRIGGER_THRESHOLD = 5
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
if sensor.get_id() == sensor.OV7725: # Reduce sensor PLL from 6x to 4x. if sensor.get_id() == sensor.OV7725: # Reduce sensor PLL from 6x to 4x.
sensor.__write_reg(0x0D, (sensor.__read_reg(0x0D) & 0x3F) | 0x40) sensor.__write_reg(0x0D, (sensor.__read_reg(0x0D) & 0x3F) | 0x40)
@ -22,7 +22,7 @@ clock = time.clock() # Tracks FPS.
# So, be aware that it's a lot easier to get out of RAM issues now. However, # So, be aware that it's a lot easier to get out of RAM issues now. However,
# frame differencing doesn't use a lot of the extra space in the frame buffer. # frame differencing doesn't use a lot of the extra space in the frame buffer.
# But, things like AprilTags do and won't work if you do this... # But, things like AprilTags do and won't work if you do this...
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
print("About to save background image...") print("About to save background image...")
sensor.skip_frames(time = 2000) # Give the user time to get ready. sensor.skip_frames(time = 2000) # Give the user time to get ready.

View File

@ -11,7 +11,7 @@ import sensor, image, pyb, os, time
MIN_TRIGGER_THRESHOLD = -0.4 MIN_TRIGGER_THRESHOLD = -0.4
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.
@ -22,7 +22,7 @@ clock = time.clock() # Tracks FPS.
# So, be aware that it's a lot easier to get out of RAM issues now. However, # So, be aware that it's a lot easier to get out of RAM issues now. However,
# frame differencing doesn't use a lot of the extra space in the frame buffer. # frame differencing doesn't use a lot of the extra space in the frame buffer.
# But, things like AprilTags do and won't work if you do this... # But, things like AprilTags do and won't work if you do this...
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
print("About to save background image...") print("About to save background image...")
sensor.skip_frames(time = 2000) # Give the user time to get ready. sensor.skip_frames(time = 2000) # Give the user time to get ready.

View File

@ -14,7 +14,7 @@ BG_UPDATE_FRAMES = 50 # How many frames before blending.
BG_UPDATE_BLEND = 128 # How much to blend by... ([0-256]==[0.0-1.0]). BG_UPDATE_BLEND = 128 # How much to blend by... ([0-256]==[0.0-1.0]).
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.RGB565 sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -11,7 +11,7 @@ import sensor, image, pyb, os, time
TRIGGER_THRESHOLD = 5 TRIGGER_THRESHOLD = 5
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -10,7 +10,7 @@ import sensor, image, pyb, os, time
TRIGGER_THRESHOLD = 5 TRIGGER_THRESHOLD = 5
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
if sensor.get_id() == sensor.OV7725: # Reduce sensor PLL from 6x to 4x. if sensor.get_id() == sensor.OV7725: # Reduce sensor PLL from 6x to 4x.
sensor.__write_reg(0x0D, (sensor.__read_reg(0x0D) & 0x3F) | 0x40) sensor.__write_reg(0x0D, (sensor.__read_reg(0x0D) & 0x3F) | 0x40)

View File

@ -13,7 +13,7 @@ import sensor, image, pyb, os, time
MIN_TRIGGER_THRESHOLD = -0.4 MIN_TRIGGER_THRESHOLD = -0.4
sensor.reset() # Initialize the camera sensor. sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS. clock = time.clock() # Tracks FPS.

View File

@ -25,7 +25,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
# The gain db ceiling maxes out at about 24 db for the OV7725 sensor. # The gain db ceiling maxes out at about 24 db for the OV7725 sensor.

View File

@ -21,7 +21,7 @@ import sensor, image, time
EXPOSURE_TIME_SCALE = 1.0 EXPOSURE_TIME_SCALE = 1.0
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
# Print out the initial exposure time for comparison. # Print out the initial exposure time for comparison.

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.

View File

@ -16,7 +16,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.

View File

@ -21,7 +21,7 @@ import sensor, image, time
GAIN_SCALE = 1.0 GAIN_SCALE = 1.0
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
# Print out the initial gain for comparison. # Print out the initial gain for comparison.

View File

@ -24,7 +24,7 @@ import sensor, image, time, math
# it by doing "img.pool(2, 2)" on a 64x64 image. # it by doing "img.pool(2, 2)" on a 64x64 image.
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)... sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)...
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.
@ -33,7 +33,7 @@ clock = time.clock() # Create a clock object to track the FPS.
# There's a lot more RAM in the frame buffer than in the MicroPython heap. # There's a lot more RAM in the frame buffer than in the MicroPython heap.
# However, after doing this you have a lot less RAM for some algorithms... # However, after doing this you have a lot less RAM for some algorithms...
# So, be aware that it's a lot easier to get out of RAM issues now. # So, be aware that it's a lot easier to get out of RAM issues now.
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
extra_fb.replace(sensor.snapshot()) extra_fb.replace(sensor.snapshot())
while(True): while(True):

View File

@ -24,7 +24,7 @@ import sensor, image, time
# it by doing "img.pool(2, 2)" on a 64x64 image. # it by doing "img.pool(2, 2)" on a 64x64 image.
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)... sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)...
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.
@ -33,7 +33,7 @@ clock = time.clock() # Create a clock object to track the FPS.
# There's a lot more RAM in the frame buffer than in the MicroPython heap. # There's a lot more RAM in the frame buffer than in the MicroPython heap.
# However, after doing this you have a lot less RAM for some algorithms... # However, after doing this you have a lot less RAM for some algorithms...
# So, be aware that it's a lot easier to get out of RAM issues now. # So, be aware that it's a lot easier to get out of RAM issues now.
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
extra_fb.replace(sensor.snapshot()) extra_fb.replace(sensor.snapshot())
while(True): while(True):

View File

@ -24,7 +24,7 @@ import sensor, image, time, math
# it by doing "img.pool(2, 2)" on a 64x64 image. # it by doing "img.pool(2, 2)" on a 64x64 image.
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)... sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)...
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.
@ -33,7 +33,7 @@ clock = time.clock() # Create a clock object to track the FPS.
# There's a lot more RAM in the frame buffer than in the MicroPython heap. # There's a lot more RAM in the frame buffer than in the MicroPython heap.
# However, after doing this you have a lot less RAM for some algorithms... # However, after doing this you have a lot less RAM for some algorithms...
# So, be aware that it's a lot easier to get out of RAM issues now. # So, be aware that it's a lot easier to get out of RAM issues now.
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
extra_fb.replace(sensor.snapshot()) extra_fb.replace(sensor.snapshot())
while(True): while(True):

View File

@ -24,7 +24,7 @@ import sensor, image, time
# it by doing "img.pool(2, 2)" on a 64x64 image. # it by doing "img.pool(2, 2)" on a 64x64 image.
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)... sensor.set_framesize(sensor.B64X64) # Set frame size to 64x64... (or 64x32)...
sensor.skip_frames(time = 2000) # Wait for settings take effect. sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS. clock = time.clock() # Create a clock object to track the FPS.
@ -33,7 +33,7 @@ clock = time.clock() # Create a clock object to track the FPS.
# There's a lot more RAM in the frame buffer than in the MicroPython heap. # There's a lot more RAM in the frame buffer than in the MicroPython heap.
# However, after doing this you have a lot less RAM for some algorithms... # However, after doing this you have a lot less RAM for some algorithms...
# So, be aware that it's a lot easier to get out of RAM issues now. # So, be aware that it's a lot easier to get out of RAM issues now.
extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565) extra_fb = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.GRAYSCALE)
extra_fb.replace(sensor.snapshot()) extra_fb.replace(sensor.snapshot())
while(True): while(True):

View File

@ -6,7 +6,7 @@
import sensor, image, time import sensor, image, time
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)

View File

@ -6,7 +6,7 @@
import sensor, image, time, tf import sensor, image, time, tf
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)

View File

@ -21,7 +21,7 @@
import sensor, image, time, os, tf import sensor, image, time, os, tf
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.set_windowing((240, 240)) # Set 240x240 window. sensor.set_windowing((240, 240)) # Set 240x240 window.
sensor.skip_frames(time=2000) # Let the camera adjust. sensor.skip_frames(time=2000) # Let the camera adjust.

View File

@ -21,7 +21,7 @@
import sensor, image, time, os, tf import sensor, image, time, os, tf
sensor.reset() # Reset and initialize the sensor. sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.set_windowing((240, 240)) # Set 240x240 window. sensor.set_windowing((240, 240)) # Set 240x240 window.
sensor.skip_frames(time=2000) # Let the camera adjust. sensor.skip_frames(time=2000) # Let the camera adjust.

View File

@ -6,7 +6,7 @@
import sensor, image, time, math import sensor, image, time, math
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger... sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_gain(False) # must turn this off to prevent image washout...

View File

@ -6,7 +6,7 @@
import sensor, image, time, math import sensor, image, time, math
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger... sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_gain(False) # must turn this off to prevent image washout...

View File

@ -6,7 +6,7 @@
import sensor, image, time, math import sensor, image, time, math
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) # we run out of memory if the resolution is much bigger... sensor.set_framesize(sensor.VGA) # we run out of memory if the resolution is much bigger...
sensor.set_windowing((160, 120)) # Look at center 160x120 pixels of the VGA resolution. sensor.set_windowing((160, 120)) # Look at center 160x120 pixels of the VGA resolution.
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)

View File

@ -7,7 +7,7 @@
import image, network, omv, rpc, sensor, struct import image, network, omv, rpc, sensor, struct
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)

View File

@ -7,7 +7,7 @@
import network, omv, rpc, sensor import network, omv, rpc, sensor
sensor.reset() sensor.reset()
sensor.set_pixformat(sensor.RGB565) sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA) sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000) sensor.skip_frames(time = 2000)

Some files were not shown because too many files have changed in this diff Show More