diff --git a/src/omv/py/py_sensor.c b/src/omv/py/py_sensor.c index 80a02c6a7..19514c6a3 100644 --- a/src/omv/py/py_sensor.c +++ b/src/omv/py/py_sensor.c @@ -18,6 +18,7 @@ #include "omv_boardconfig.h" #include "py_helper.h" #include "framebuffer.h" +#include "systick.h" extern sensor_t sensor; @@ -74,13 +75,35 @@ static mp_obj_t py_sensor_snapshot(uint n_args, const mp_obj_t *args, mp_map_t * return image; } -static mp_obj_t py_sensor_skip_frames(uint n_args, const mp_obj_t *args) { - int frames = (n_args == 1) ? mp_obj_get_int(args[0]) : 10; // OV Recommended. - for (int i = 0; i < frames; i++) { - if (sensor_snapshot(NULL, NULL, NULL) == -1) { - nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "Sensor Timeout!!")); +static mp_obj_t py_sensor_skip_frames(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) +{ + mp_map_elem_t *kw_arg = mp_map_lookup(kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_time), MP_MAP_LOOKUP); + mp_int_t time = 300; // OV Recommended. + + if (kw_arg != NULL) { + time = mp_obj_get_int(kw_arg->value); + } + + uint32_t millis = systick_current_millis(); + + if (!n_args) { + while ((systick_current_millis() - millis) < time) { // 32-bit math handles wrap arrounds... + if (sensor_snapshot(NULL, NULL, NULL) == -1) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "Sensor Timeout!!")); + } + } + } else { + for (int i = 0, j = mp_obj_get_int(args[0]); i < j; i++) { + if ((kw_arg != NULL) && ((systick_current_millis() - millis) >= time)) { + break; + } + + if (sensor_snapshot(NULL, NULL, NULL) == -1) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "Sensor Timeout!!")); + } } } + return mp_const_none; } @@ -329,7 +352,7 @@ static mp_obj_t py_sensor_read_reg(mp_obj_t addr) { STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_reset_obj, py_sensor_reset); STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_snapshot_obj, 0, py_sensor_snapshot); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_skip_frames_obj, 0, 1, py_sensor_skip_frames); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_skip_frames_obj, 0, py_sensor_skip_frames); STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_fb_obj, py_sensor_get_fb); STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_id_obj, py_sensor_get_id); STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_pixformat_obj, py_sensor_set_pixformat); diff --git a/usr/examples/01-Basics/helloworld.py b/usr/examples/01-Basics/helloworld.py index ac51c2228..a3f390747 100644 --- a/usr/examples/01-Basics/helloworld.py +++ b/usr/examples/01-Basics/helloworld.py @@ -7,7 +7,7 @@ import sensor, image, time sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) -sensor.skip_frames(10) # 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. while(True): diff --git a/usr/examples/02-Board-Control/spi_control.py b/usr/examples/02-Board-Control/spi_control.py index 6a2bc65ed..c2e2dcf1e 100644 --- a/usr/examples/02-Board-Control/spi_control.py +++ b/usr/examples/02-Board-Control/spi_control.py @@ -57,7 +57,7 @@ write_command(0x29) sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # must be this sensor.set_framesize(sensor.QQVGA2) # must be this -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. while(True): diff --git a/usr/examples/04-Image-Filters/advanced_frame_differencing.py b/usr/examples/04-Image-Filters/advanced_frame_differencing.py index cd2af5c73..5c478b177 100644 --- a/usr/examples/04-Image-Filters/advanced_frame_differencing.py +++ b/usr/examples/04-Image-Filters/advanced_frame_differencing.py @@ -14,14 +14,14 @@ BG_UPDATE_BLEND = 128 # How much to blend by... ([0-256]==[0.0-1.0]). sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565 sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.set_auto_whitebal(False) # Turn off white balance. clock = time.clock() # Tracks FPS. if not "temp" in os.listdir(): os.mkdir("temp") # Make a temp directory print("About to save background image...") -sensor.skip_frames(60) # Give the user time to get ready. +sensor.skip_frames(time = 2000) # Give the user time to get ready. sensor.snapshot().save("temp/bg.bmp") print("Saved background image - Now frame differencing!") diff --git a/usr/examples/04-Image-Filters/basic_frame_differencing.py b/usr/examples/04-Image-Filters/basic_frame_differencing.py index 4fcd893d9..2cefc8aaf 100644 --- a/usr/examples/04-Image-Filters/basic_frame_differencing.py +++ b/usr/examples/04-Image-Filters/basic_frame_differencing.py @@ -11,14 +11,14 @@ import sensor, image, pyb, os, time sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.set_auto_whitebal(False) # Turn off white balance. clock = time.clock() # Tracks FPS. if not "temp" in os.listdir(): os.mkdir("temp") # Make a temp directory print("About to save background image...") -sensor.skip_frames(60) # Give the user time to get ready. +sensor.skip_frames(time = 2000) # Give the user time to get ready. sensor.snapshot().save("temp/bg.bmp") print("Saved background image - Now frame differencing!") diff --git a/usr/examples/04-Image-Filters/edge_detection.py b/usr/examples/04-Image-Filters/edge_detection.py index d2cc8040c..102d3cc3a 100644 --- a/usr/examples/04-Image-Filters/edge_detection.py +++ b/usr/examples/04-Image-Filters/edge_detection.py @@ -16,7 +16,7 @@ thresholds = [(100, 255)] # grayscale thresholds sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565 sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. # On the OV7725 sensor, edge detection can be enhanced diff --git a/usr/examples/04-Image-Filters/grayscale_filter.py b/usr/examples/04-Image-Filters/grayscale_filter.py index 8f4ee7493..891081aee 100644 --- a/usr/examples/04-Image-Filters/grayscale_filter.py +++ b/usr/examples/04-Image-Filters/grayscale_filter.py @@ -11,7 +11,7 @@ import sensor, image, time sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. # Segment the image by following thresholds. This segmentation is done while diff --git a/usr/examples/04-Image-Filters/mean_filter.py b/usr/examples/04-Image-Filters/mean_filter.py index 559949d1d..c6de0c81b 100644 --- a/usr/examples/04-Image-Filters/mean_filter.py +++ b/usr/examples/04-Image-Filters/mean_filter.py @@ -9,7 +9,7 @@ import sensor, image, time sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. while(True): diff --git a/usr/examples/04-Image-Filters/median_filter.py b/usr/examples/04-Image-Filters/median_filter.py index b15511c10..441464a36 100644 --- a/usr/examples/04-Image-Filters/median_filter.py +++ b/usr/examples/04-Image-Filters/median_filter.py @@ -9,7 +9,7 @@ import sensor, image, time sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. while(True): diff --git a/usr/examples/04-Image-Filters/midpoint_filter.py b/usr/examples/04-Image-Filters/midpoint_filter.py index 54c19410a..ee9ab5d94 100644 --- a/usr/examples/04-Image-Filters/midpoint_filter.py +++ b/usr/examples/04-Image-Filters/midpoint_filter.py @@ -8,7 +8,7 @@ import sensor, image, time sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. while(True): diff --git a/usr/examples/04-Image-Filters/mode_filter.py b/usr/examples/04-Image-Filters/mode_filter.py index 0fa7b0ebb..170937c58 100644 --- a/usr/examples/04-Image-Filters/mode_filter.py +++ b/usr/examples/04-Image-Filters/mode_filter.py @@ -10,7 +10,7 @@ import sensor, image, time sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565 sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. while(True): diff --git a/usr/examples/04-Image-Filters/sharpen_filter.py b/usr/examples/04-Image-Filters/sharpen_filter.py index 44a686b55..bfe386e80 100644 --- a/usr/examples/04-Image-Filters/sharpen_filter.py +++ b/usr/examples/04-Image-Filters/sharpen_filter.py @@ -13,7 +13,7 @@ kernel = [-1, -1, -1,\ sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565 sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. while(True): diff --git a/usr/examples/05-Snapshot/emboss_snapshot.py b/usr/examples/05-Snapshot/emboss_snapshot.py index e0eacd88a..69bc105c6 100644 --- a/usr/examples/05-Snapshot/emboss_snapshot.py +++ b/usr/examples/05-Snapshot/emboss_snapshot.py @@ -12,10 +12,10 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. pyb.LED(RED_LED_PIN).on() -sensor.skip_frames(30) # Give the user time to get ready. +sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() pyb.LED(BLUE_LED_PIN).on() diff --git a/usr/examples/05-Snapshot/snapshot.py b/usr/examples/05-Snapshot/snapshot.py index 37156d70b..8eb621e6d 100644 --- a/usr/examples/05-Snapshot/snapshot.py +++ b/usr/examples/05-Snapshot/snapshot.py @@ -12,10 +12,10 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. pyb.LED(RED_LED_PIN).on() -sensor.skip_frames(30) # Give the user time to get ready. +sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() pyb.LED(BLUE_LED_PIN).on() diff --git a/usr/examples/05-Snapshot/snapshot_on_face_detection.py b/usr/examples/05-Snapshot/snapshot_on_face_detection.py index e1fefdb11..a716df263 100644 --- a/usr/examples/05-Snapshot/snapshot_on_face_detection.py +++ b/usr/examples/05-Snapshot/snapshot_on_face_detection.py @@ -13,7 +13,7 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.HQVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. # Load up a face detection HaarCascade. This is object that your OpenMV Cam # can use to detect faces using the find_features() method below. Your OpenMV @@ -27,7 +27,7 @@ while(True): pyb.LED(RED_LED_PIN).on() print("About to start detecting faces...") - sensor.skip_frames(60) # Give the user time to get ready. + sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() print("Now detecting faces!") diff --git a/usr/examples/05-Snapshot/snapshot_on_movement.py b/usr/examples/05-Snapshot/snapshot_on_movement.py index 8ba7837f8..4b0a625e1 100644 --- a/usr/examples/05-Snapshot/snapshot_on_movement.py +++ b/usr/examples/05-Snapshot/snapshot_on_movement.py @@ -13,7 +13,7 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.set_auto_whitebal(False) # Turn off white balance. if not "temp" in os.listdir(): os.mkdir("temp") # Make a temp directory @@ -22,7 +22,7 @@ while(True): pyb.LED(RED_LED_PIN).on() print("About to save background image...") - sensor.skip_frames(60) # Give the user time to get ready. + sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() sensor.snapshot().save("temp/bg.bmp") diff --git a/usr/examples/06-Video-Recording/gif.py b/usr/examples/06-Video-Recording/gif.py index a268f6a00..35f0933d7 100644 --- a/usr/examples/06-Video-Recording/gif.py +++ b/usr/examples/06-Video-Recording/gif.py @@ -14,11 +14,11 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. pyb.LED(RED_LED_PIN).on() -sensor.skip_frames(30) # Give the user time to get ready. +sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() pyb.LED(BLUE_LED_PIN).on() diff --git a/usr/examples/06-Video-Recording/gif_on_face_detection.py b/usr/examples/06-Video-Recording/gif_on_face_detection.py index 5c4ed5b27..0732ca1c8 100644 --- a/usr/examples/06-Video-Recording/gif_on_face_detection.py +++ b/usr/examples/06-Video-Recording/gif_on_face_detection.py @@ -17,7 +17,7 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor. sensor.set_framesize(sensor.QQVGA) # or sensor.HQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. # Load up a face detection HaarCascade. This is object that your OpenMV Cam # can use to detect faces using the find_features() method below. Your OpenMV @@ -31,7 +31,7 @@ while(True): pyb.LED(RED_LED_PIN).on() print("About to start detecting faces...") - sensor.skip_frames(60) # Give the user time to get ready. + sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() print("Now detecting faces!") diff --git a/usr/examples/06-Video-Recording/gif_on_movement.py b/usr/examples/06-Video-Recording/gif_on_movement.py index e73022953..4cf3fbae6 100644 --- a/usr/examples/06-Video-Recording/gif_on_movement.py +++ b/usr/examples/06-Video-Recording/gif_on_movement.py @@ -17,7 +17,7 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.set_auto_whitebal(False) # Turn off white balance. if not "temp" in os.listdir(): os.mkdir("temp") # Make a temp directory @@ -26,7 +26,7 @@ while(True): pyb.LED(RED_LED_PIN).on() print("About to save background image...") - sensor.skip_frames(60) # Give the user time to get ready. + sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() sensor.snapshot().save("temp/bg.bmp") diff --git a/usr/examples/06-Video-Recording/mjpeg.py b/usr/examples/06-Video-Recording/mjpeg.py index f3623d756..1e3f732e4 100644 --- a/usr/examples/06-Video-Recording/mjpeg.py +++ b/usr/examples/06-Video-Recording/mjpeg.py @@ -15,11 +15,11 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. clock = time.clock() # Tracks FPS. pyb.LED(RED_LED_PIN).on() -sensor.skip_frames(30) # Give the user time to get ready. +sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() pyb.LED(BLUE_LED_PIN).on() diff --git a/usr/examples/06-Video-Recording/mjpeg_on_face_detection.py b/usr/examples/06-Video-Recording/mjpeg_on_face_detection.py index db2ec2480..fd567a4f6 100644 --- a/usr/examples/06-Video-Recording/mjpeg_on_face_detection.py +++ b/usr/examples/06-Video-Recording/mjpeg_on_face_detection.py @@ -18,7 +18,7 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor. sensor.set_framesize(sensor.QQVGA) # or sensor.HQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. # Load up a face detection HaarCascade. This is object that your OpenMV Cam # can use to detect faces using the find_features() method below. Your OpenMV @@ -32,7 +32,7 @@ while(True): pyb.LED(RED_LED_PIN).on() print("About to start detecting faces...") - sensor.skip_frames(60) # Give the user time to get ready. + sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() print("Now detecting faces!") diff --git a/usr/examples/06-Video-Recording/mjpeg_on_movement.py b/usr/examples/06-Video-Recording/mjpeg_on_movement.py index 8986c53f8..5f13363f2 100644 --- a/usr/examples/06-Video-Recording/mjpeg_on_movement.py +++ b/usr/examples/06-Video-Recording/mjpeg_on_movement.py @@ -18,7 +18,7 @@ BLUE_LED_PIN = 3 sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others) -sensor.skip_frames(10) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.set_auto_whitebal(False) # Turn off white balance. if not "temp" in os.listdir(): os.mkdir("temp") # Make a temp directory @@ -27,7 +27,7 @@ while(True): pyb.LED(RED_LED_PIN).on() print("About to save background image...") - sensor.skip_frames(60) # Give the user time to get ready. + sensor.skip_frames(time = 2000) # Give the user time to get ready. pyb.LED(RED_LED_PIN).off() sensor.snapshot().save("temp/bg.bmp") diff --git a/usr/examples/07-Face-Detection/face_tracking.py b/usr/examples/07-Face-Detection/face_tracking.py index 3a8372330..28dcdc801 100644 --- a/usr/examples/07-Face-Detection/face_tracking.py +++ b/usr/examples/07-Face-Detection/face_tracking.py @@ -16,7 +16,7 @@ sensor.set_windowing((320, 240)) sensor.set_pixformat(sensor.GRAYSCALE) # Skip a few frames to allow the sensor settle down -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) # Load Haar Cascade # By default this will use all stages, lower satges is faster but less accurate. diff --git a/usr/examples/09-Feature-Detection/edges.py b/usr/examples/09-Feature-Detection/edges.py index 7b2da2158..166820b72 100644 --- a/usr/examples/09-Feature-Detection/edges.py +++ b/usr/examples/09-Feature-Detection/edges.py @@ -6,7 +6,7 @@ import sensor, image, time sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565 sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) -sensor.skip_frames(30) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.set_gainceiling(8) clock = time.clock() # Tracks FPS. diff --git a/usr/examples/09-Feature-Detection/find_line_segments.py b/usr/examples/09-Feature-Detection/find_line_segments.py index f8b9632a0..6250d2d4f 100644 --- a/usr/examples/09-Feature-Detection/find_line_segments.py +++ b/usr/examples/09-Feature-Detection/find_line_segments.py @@ -14,7 +14,7 @@ import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.RGB565) # grayscale is faster sensor.set_framesize(sensor.QQVGA) -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) clock = time.clock() # All lines also have `x1()`, `y1()`, `x2()`, and `y2()` methods to get their end-points diff --git a/usr/examples/09-Feature-Detection/find_lines.py b/usr/examples/09-Feature-Detection/find_lines.py index 7d5ca45e0..6c45fcfbc 100644 --- a/usr/examples/09-Feature-Detection/find_lines.py +++ b/usr/examples/09-Feature-Detection/find_lines.py @@ -16,7 +16,7 @@ import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.RGB565) # grayscale is faster sensor.set_framesize(sensor.QQVGA) -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) clock = time.clock() # All line objects have a `theta()` method to get their rotation angle in degrees. diff --git a/usr/examples/09-Feature-Detection/hog.py b/usr/examples/09-Feature-Detection/hog.py index b3359e5c6..c83e812fe 100644 --- a/usr/examples/09-Feature-Detection/hog.py +++ b/usr/examples/09-Feature-Detection/hog.py @@ -12,10 +12,10 @@ sensor.reset() sensor.set_contrast(1) sensor.set_gainceiling(8) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_pixformat(sensor.GRAYSCALE) -clock = time.clock() # Tracks FPS. +clock = time.clock() # Tracks FPS. while (True): clock.tick() img = sensor.snapshot() @@ -24,5 +24,5 @@ while (True): # Uncomment to save raw FB to file and exit the loop #img.save("/hog.pgm") #break - - print(clock.fps()) \ No newline at end of file + + print(clock.fps()) diff --git a/usr/examples/09-Feature-Detection/keypoints.py b/usr/examples/09-Feature-Detection/keypoints.py index fb64c26b6..790621cd5 100644 --- a/usr/examples/09-Feature-Detection/keypoints.py +++ b/usr/examples/09-Feature-Detection/keypoints.py @@ -14,7 +14,7 @@ sensor.set_framesize(sensor.VGA) sensor.set_windowing((320, 240)) sensor.set_pixformat(sensor.GRAYSCALE) -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False, value=100) def draw_keypoints(img, kpts): diff --git a/usr/examples/09-Feature-Detection/keypoints_save.py b/usr/examples/09-Feature-Detection/keypoints_save.py index 811073feb..ca3e51bcc 100644 --- a/usr/examples/09-Feature-Detection/keypoints_save.py +++ b/usr/examples/09-Feature-Detection/keypoints_save.py @@ -16,7 +16,7 @@ sensor.set_framesize(sensor.VGA) sensor.set_windowing((320, 240)) sensor.set_pixformat(sensor.GRAYSCALE) -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False, value=100) FILE_NAME = "desc" diff --git a/usr/examples/10-Color-Tracking/automatic_grayscale_color_tracking.py b/usr/examples/10-Color-Tracking/automatic_grayscale_color_tracking.py index 9777e29ac..51f8a0a91 100644 --- a/usr/examples/10-Color-Tracking/automatic_grayscale_color_tracking.py +++ b/usr/examples/10-Color-Tracking/automatic_grayscale_color_tracking.py @@ -8,7 +8,7 @@ print("Letting auto algorithms run. Don't put anything in front of the camera!") sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(60) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/automatic_rgb565_color_tracking.py b/usr/examples/10-Color-Tracking/automatic_rgb565_color_tracking.py index 4e9d3b298..50a3f4e6e 100644 --- a/usr/examples/10-Color-Tracking/automatic_rgb565_color_tracking.py +++ b/usr/examples/10-Color-Tracking/automatic_rgb565_color_tracking.py @@ -8,7 +8,7 @@ print("Letting auto algorithms run. Don't put anything in front of the camera!") sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(60) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/black_grayscale_line_following.py b/usr/examples/10-Color-Tracking/black_grayscale_line_following.py index 43523a256..6e0674b63 100644 --- a/usr/examples/10-Color-Tracking/black_grayscale_line_following.py +++ b/usr/examples/10-Color-Tracking/black_grayscale_line_following.py @@ -33,7 +33,7 @@ for r in ROIS: weight_sum += r[4] # r[4] is the roi weight. sensor.reset() # Initialize the camera sensor. sensor.set_pixformat(sensor.GRAYSCALE) # use grayscale. sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed. -sensor.skip_frames(30) # Let new settings take affect. +sensor.skip_frames(time = 2000) # Let new settings take affect. sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock() # Tracks FPS. @@ -43,8 +43,10 @@ while(True): img = sensor.snapshot() # Take a picture and return the image. centroid_sum = 0 + for r in ROIS: blobs = img.find_blobs(GRAYSCALE_THRESHOLD, roi=r[0:4], merge=True) # r[0:4] is roi tuple. + if blobs: # Find the blob with the most pixels. largest_blob = max(blobs, key=lambda b: b.pixels()) @@ -63,6 +65,7 @@ while(True): # are. Non-linear operations are good to use on the output of algorithms # like this to cause a response "trigger". deflection_angle = 0 + # The 80 is from half the X res, the 60 is from half the Y res. The # equation below is just computing the angle of a triangle where the # opposite side of the triangle is the deviation of the center position diff --git a/usr/examples/10-Color-Tracking/image_histogram_info.py b/usr/examples/10-Color-Tracking/image_histogram_info.py index 5a7cb7509..04b386b3e 100644 --- a/usr/examples/10-Color-Tracking/image_histogram_info.py +++ b/usr/examples/10-Color-Tracking/image_histogram_info.py @@ -7,7 +7,7 @@ import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) # or RGB565. sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/image_statistics_info.py b/usr/examples/10-Color-Tracking/image_statistics_info.py index 46ed3385c..04f306109 100644 --- a/usr/examples/10-Color-Tracking/image_statistics_info.py +++ b/usr/examples/10-Color-Tracking/image_statistics_info.py @@ -7,7 +7,7 @@ import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) # or RGB565. sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/ir_beacon_grayscale_tracking.py b/usr/examples/10-Color-Tracking/ir_beacon_grayscale_tracking.py index a8c1e2a43..0a4d9e0b7 100644 --- a/usr/examples/10-Color-Tracking/ir_beacon_grayscale_tracking.py +++ b/usr/examples/10-Color-Tracking/ir_beacon_grayscale_tracking.py @@ -10,7 +10,7 @@ sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.VGA) sensor.set_windowing((240, 240)) # 240x240 center pixels of VGA -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/ir_beacon_rgb565_tracking.py b/usr/examples/10-Color-Tracking/ir_beacon_rgb565_tracking.py index eb08314ce..033908131 100644 --- a/usr/examples/10-Color-Tracking/ir_beacon_rgb565_tracking.py +++ b/usr/examples/10-Color-Tracking/ir_beacon_rgb565_tracking.py @@ -10,7 +10,7 @@ sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.VGA) sensor.set_windowing((240, 240)) # 240x240 center pixels of VGA -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/multi_color_blob_tracking.py b/usr/examples/10-Color-Tracking/multi_color_blob_tracking.py index 4e2ed761b..edd9dcfe9 100644 --- a/usr/examples/10-Color-Tracking/multi_color_blob_tracking.py +++ b/usr/examples/10-Color-Tracking/multi_color_blob_tracking.py @@ -15,7 +15,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/multi_color_code_tracking.py b/usr/examples/10-Color-Tracking/multi_color_code_tracking.py index aef8a4587..917fb5057 100644 --- a/usr/examples/10-Color-Tracking/multi_color_code_tracking.py +++ b/usr/examples/10-Color-Tracking/multi_color_code_tracking.py @@ -17,7 +17,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds -> index is sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/single_color_code_tracking.py b/usr/examples/10-Color-Tracking/single_color_code_tracking.py index d713d30fd..a7a1acd8b 100644 --- a/usr/examples/10-Color-Tracking/single_color_code_tracking.py +++ b/usr/examples/10-Color-Tracking/single_color_code_tracking.py @@ -16,7 +16,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds -> index is sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/single_color_grayscale_blob_tracking.py b/usr/examples/10-Color-Tracking/single_color_grayscale_blob_tracking.py index 2fe18108e..08d34dbb1 100644 --- a/usr/examples/10-Color-Tracking/single_color_grayscale_blob_tracking.py +++ b/usr/examples/10-Color-Tracking/single_color_grayscale_blob_tracking.py @@ -11,7 +11,7 @@ thresholds = (245, 255) sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.VGA) -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/10-Color-Tracking/single_color_rgb565_blob_tracking.py b/usr/examples/10-Color-Tracking/single_color_rgb565_blob_tracking.py index c9771db4c..132d91a9d 100644 --- a/usr/examples/10-Color-Tracking/single_color_rgb565_blob_tracking.py +++ b/usr/examples/10-Color-Tracking/single_color_rgb565_blob_tracking.py @@ -15,7 +15,7 @@ thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +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 clock = time.clock() diff --git a/usr/examples/16-Codes/find_apriltags.py b/usr/examples/16-Codes/find_apriltags.py index e63e7d4bf..02409b0f0 100644 --- a/usr/examples/16-Codes/find_apriltags.py +++ b/usr/examples/16-Codes/find_apriltags.py @@ -8,7 +8,7 @@ import sensor, image, time, math sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger... -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_whitebal(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/16-Codes/find_apriltags_3d_pose.py b/usr/examples/16-Codes/find_apriltags_3d_pose.py index 8879f53f5..64e763253 100644 --- a/usr/examples/16-Codes/find_apriltags_3d_pose.py +++ b/usr/examples/16-Codes/find_apriltags_3d_pose.py @@ -8,7 +8,7 @@ import sensor, image, time, math sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger... -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_whitebal(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/16-Codes/find_apriltags_w_lens_zoom.py b/usr/examples/16-Codes/find_apriltags_w_lens_zoom.py index 43e29afd4..3778ccb68 100644 --- a/usr/examples/16-Codes/find_apriltags_w_lens_zoom.py +++ b/usr/examples/16-Codes/find_apriltags_w_lens_zoom.py @@ -9,7 +9,7 @@ sensor.reset() sensor.set_pixformat(sensor.RGB565) 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.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_whitebal(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/16-Codes/find_barcodes.py b/usr/examples/16-Codes/find_barcodes.py index c506497cd..07dee507c 100644 --- a/usr/examples/16-Codes/find_barcodes.py +++ b/usr/examples/16-Codes/find_barcodes.py @@ -9,7 +9,7 @@ sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.VGA) # High Res! sensor.set_windowing((640, 80)) # V Res of 80 == less work (40 for 2X the speed). -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_whitebal(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/16-Codes/find_datamatrices.py b/usr/examples/16-Codes/find_datamatrices.py index 5087d466d..95d0fe38a 100644 --- a/usr/examples/16-Codes/find_datamatrices.py +++ b/usr/examples/16-Codes/find_datamatrices.py @@ -8,7 +8,7 @@ import sensor, image, time, math sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_whitebal(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/16-Codes/find_datamatrices_w_lens_zoom.py b/usr/examples/16-Codes/find_datamatrices_w_lens_zoom.py index 60ca34a81..889326df1 100644 --- a/usr/examples/16-Codes/find_datamatrices_w_lens_zoom.py +++ b/usr/examples/16-Codes/find_datamatrices_w_lens_zoom.py @@ -9,7 +9,7 @@ sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.VGA) sensor.set_windowing((320, 240)) # 2x Zoom -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... sensor.set_auto_whitebal(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/16-Codes/qrcodes_with_lens_corr.py b/usr/examples/16-Codes/qrcodes_with_lens_corr.py index afcd9b6fa..63275a651 100644 --- a/usr/examples/16-Codes/qrcodes_with_lens_corr.py +++ b/usr/examples/16-Codes/qrcodes_with_lens_corr.py @@ -8,7 +8,7 @@ import sensor, image, time sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) # can be QVGA on M7... -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/16-Codes/qrcodes_with_lens_zoom.py b/usr/examples/16-Codes/qrcodes_with_lens_zoom.py index 541b43d09..c9798a4bf 100644 --- a/usr/examples/16-Codes/qrcodes_with_lens_zoom.py +++ b/usr/examples/16-Codes/qrcodes_with_lens_zoom.py @@ -9,7 +9,7 @@ sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.VGA) sensor.set_windowing((240, 240)) # look at center 240x240 pixels of the VGA resolution. -sensor.skip_frames(30) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # must turn this off to prevent image washout... clock = time.clock() diff --git a/usr/examples/17-Pixy-Emulation/apriltags_pixy_i2c_emulation.py b/usr/examples/17-Pixy-Emulation/apriltags_pixy_i2c_emulation.py index 5c6c1be02..18e394fb5 100644 --- a/usr/examples/17-Pixy-Emulation/apriltags_pixy_i2c_emulation.py +++ b/usr/examples/17-Pixy-Emulation/apriltags_pixy_i2c_emulation.py @@ -44,7 +44,7 @@ import image, math, pyb, sensor, struct, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QQVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) # LED Setup diff --git a/usr/examples/17-Pixy-Emulation/apriltags_pixy_spi_emulation.py b/usr/examples/17-Pixy-Emulation/apriltags_pixy_spi_emulation.py index 999151da4..20a9518fe 100644 --- a/usr/examples/17-Pixy-Emulation/apriltags_pixy_spi_emulation.py +++ b/usr/examples/17-Pixy-Emulation/apriltags_pixy_spi_emulation.py @@ -50,7 +50,7 @@ import image, math, pyb, sensor, struct, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QQVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) # LED Setup diff --git a/usr/examples/17-Pixy-Emulation/apriltags_pixy_uart_emulation.py b/usr/examples/17-Pixy-Emulation/apriltags_pixy_uart_emulation.py index 8552ee459..5a2026a69 100644 --- a/usr/examples/17-Pixy-Emulation/apriltags_pixy_uart_emulation.py +++ b/usr/examples/17-Pixy-Emulation/apriltags_pixy_uart_emulation.py @@ -44,7 +44,7 @@ import image, math, pyb, sensor, struct, time sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QQVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) # LED Setup diff --git a/usr/examples/17-Pixy-Emulation/pixy_i2c_emulation.py b/usr/examples/17-Pixy-Emulation/pixy_i2c_emulation.py index 1e17506b8..35ed48a22 100644 --- a/usr/examples/17-Pixy-Emulation/pixy_i2c_emulation.py +++ b/usr/examples/17-Pixy-Emulation/pixy_i2c_emulation.py @@ -67,7 +67,7 @@ import image, math, pyb, sensor, struct, time sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) sensor.set_auto_whitebal(False) diff --git a/usr/examples/17-Pixy-Emulation/pixy_spi_emulation.py b/usr/examples/17-Pixy-Emulation/pixy_spi_emulation.py index b076fdf29..57755845c 100644 --- a/usr/examples/17-Pixy-Emulation/pixy_spi_emulation.py +++ b/usr/examples/17-Pixy-Emulation/pixy_spi_emulation.py @@ -73,7 +73,7 @@ import image, math, pyb, sensor, struct, time sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) sensor.set_auto_whitebal(False) diff --git a/usr/examples/17-Pixy-Emulation/pixy_uart_emulation.py b/usr/examples/17-Pixy-Emulation/pixy_uart_emulation.py index 1e8c2bc9a..7aa4b262a 100644 --- a/usr/examples/17-Pixy-Emulation/pixy_uart_emulation.py +++ b/usr/examples/17-Pixy-Emulation/pixy_uart_emulation.py @@ -67,7 +67,7 @@ import image, math, pyb, sensor, struct, time sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) sensor.set_auto_whitebal(False) diff --git a/usr/examples/18-MAVLink/mavlink_apriltags_landing_target.py b/usr/examples/18-MAVLink/mavlink_apriltags_landing_target.py index 6e8aa0e2b..236a0f663 100644 --- a/usr/examples/18-MAVLink/mavlink_apriltags_landing_target.py +++ b/usr/examples/18-MAVLink/mavlink_apriltags_landing_target.py @@ -39,7 +39,7 @@ valid_tag_ids = { sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QQVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) x_res = 160 # QQVGA y_res = 120 # QQVGA diff --git a/usr/examples/18-MAVLink/mavlink_opticalflow.py b/usr/examples/18-MAVLink/mavlink_opticalflow.py index b946160e3..4e81b90cc 100644 --- a/usr/examples/18-MAVLink/mavlink_opticalflow.py +++ b/usr/examples/18-MAVLink/mavlink_opticalflow.py @@ -22,7 +22,7 @@ MAV_OPTICAL_FLOW_confidence_threshold = 0.2 sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QQVGA) -sensor.skip_frames(60) +sensor.skip_frames(time = 2000) # Link Setup