mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Added pause parameter to Image_Reader
This commit is contained in:
parent
4dcc74cd25
commit
6e84c06091
@ -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())
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -1182,6 +1182,7 @@ Q(next_frame)
|
||||
// duplicate Q(copy_to_fb)
|
||||
// duplicate Q(loop)
|
||||
// duplicate Q(close)
|
||||
Q(pause)
|
||||
|
||||
// FIR Module
|
||||
Q(fir)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user