diff --git a/scripts/examples/06-Video-Recording/image_reader.py b/scripts/examples/06-Video-Recording/image_reader.py index c548b3f4e..4cecf3f51 100644 --- a/scripts/examples/06-Video-Recording/image_reader.py +++ b/scripts/examples/06-Video-Recording/image_reader.py @@ -5,6 +5,9 @@ # This example shows how to use the Image Reader object to replay snapshots of what your # OpenMV Cam saw saved by the Image Writer object for testing machine vision algorithms. +# Altered to allow full speed reading from SD card for extraction of sequences to the network etc. +# Set the new pause parameter to false + import sensor, image, time snapshot_source = False # Set to true once finished to pull data from sensor. @@ -19,7 +22,7 @@ img_reader = None if snapshot_source else image.ImageReader("/stream.bin") while(True): clock.tick() - img = sensor.snapshot() if snapshot_source else img_reader.next_frame(copy_to_fb=True, loop=True) + img = sensor.snapshot() if snapshot_source else img_reader.next_frame(copy_to_fb=True, loop=True, pause=True) # Do machine vision algorithms on the image here. print(clock.fps()) diff --git a/src/omv/py/py_image.c b/src/omv/py/py_image.c index e7ab99d38..30ff6533a 100644 --- a/src/omv/py/py_image.c +++ b/src/omv/py/py_image.c @@ -6825,12 +6825,14 @@ mp_obj_t py_imagereader_next_frame(uint n_args, const mp_obj_t *args, mp_map_t * read_long(fp, &ms_tmp); uint32_t ms; // Wait for elapsed ms. - for (ms = systick_current_millis(); - ((ms - ((py_imagewriter_obj_t *) args[0])->ms) < ms_tmp); - ms = systick_current_millis()) { - __WFI(); + ms = 0; + if (!py_helper_keyword_int(n_args, args, 3, kw_args, MP_OBJ_NEW_QSTR(MP_QSTR_pause), true)) { + for (ms = systick_current_millis(); + ((ms - ((py_imagewriter_obj_t *) args[0])->ms) < ms_tmp); + ms = systick_current_millis()) { + __WFI(); + } } - ((py_imagewriter_obj_t *) args[0])->ms = ms; image_t image = {0}; diff --git a/src/omv/py/qstrdefsomv.h b/src/omv/py/qstrdefsomv.h index df255ec11..5a69ff195 100644 --- a/src/omv/py/qstrdefsomv.h +++ b/src/omv/py/qstrdefsomv.h @@ -1182,6 +1182,7 @@ Q(next_frame) // duplicate Q(copy_to_fb) // duplicate Q(loop) // duplicate Q(close) +Q(pause) // FIR Module Q(fir)