# Frame buffer

**URL:** <https://forums.openmv.io/t/frame-buffer/2072>\
**Category:** OpenMV Boards\
**Created:** [December 11, 2020, 6:21pm UTC](https://forums.openmv.io/t/frame-buffer/2072 "2020-12-11T18:21:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tennisparty](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tennisparty](https://forums.openmv.io/u/tennisparty)\
**Post date:** [December 11, 2020, 6:21pm UTC](https://forums.openmv.io/t/frame-buffer/2072/1 "2020-12-11T18:21:03Z")

</div>

Hello,

I have just found about about the OpenMV cam after using an ESP32-cam. I have a question about motion detection software. I would like to know if it is possible to continuously buffer X number of seconds into the memory and then if motion is detected save this buffer and the next x seconds into a video file. I am sure this can be done but just want to check before I take the deep dive and buy a board.

I have been using pikrellcam on a raspberry pi which has these features- [PiKrellCam](https://billw2.github.io/pikrellcam/pikrellcam.html)

My second question is what current does the OpenMV H7 draw when in a low power state. I would like to turn off the board during the day time as I will be recording nocturnal animals.

Many thanks,  
Sam

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [December 11, 2020, 6:23pm UTC](https://forums.openmv.io/t/frame-buffer/2072/2 "2020-12-11T18:23:02Z")

</div>

This is possible with the hardware, however, it’s not implemented by our camera driver yet.

When it’s in a lower power state it’s less than 1mA.

---

<div class="post-metadata">

**Author:** ![tennisparty](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tennisparty](https://forums.openmv.io/u/tennisparty)\
**Post date:** [December 11, 2020, 6:29pm UTC](https://forums.openmv.io/t/frame-buffer/2072/3 "2020-12-11T18:29:42Z")

</div>

OK do you have plans to implement a frame buffer in the driver soon? I’m recording bats and they move in and out of shot in much less than a second so any lag in the motion processing means they are missed.

---

<div class="post-metadata">

**Author:** ![tennisparty](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tennisparty](https://forums.openmv.io/u/tennisparty)\
**Post date:** [December 11, 2020, 6:31pm UTC](https://forums.openmv.io/t/frame-buffer/2072/4 "2020-12-11T18:31:06Z")

</div>

Sorry about the duplicate post. I also asked about whether the board has an RTC?

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [December 11, 2020, 7:26pm UTC](https://forums.openmv.io/t/frame-buffer/2072/5 "2020-12-11T19:26:18Z")

</div>

The microcontroller has an RTC, however there’s no backup battery, so you’ll need to keep power on all the time. The RTC still functions in low-power modes. There’s no plan to implement recording in memory for now, but if it ever gets implemented it will only be possible on the H7+ with SDRAM.

EDIT You could also connect a PIR sensor to the camera, and wake it up on interrupt from I/O (there’s an example). You have to try and see if that’s good enough for your application.

---

<div class="post-metadata">

**Author:** ![tennisparty](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tennisparty](https://forums.openmv.io/u/tennisparty)\
**Post date:** [December 11, 2020, 7:34pm UTC](https://forums.openmv.io/t/frame-buffer/2072/6 "2020-12-11T19:34:28Z")

</div>

I’ve done some tests with a pir but no success. Thanks though. Probably not the one for me at the mo,

---

<div class="post-metadata">

**Author:** ![Betabulls](https://avatars.discourse-cdn.com/v4/letter/b/8e8cbc/32.png) [@Betabulls](https://forums.openmv.io/u/Betabulls)\
**Post date:** [January 6, 2021, 7:20pm UTC](https://forums.openmv.io/t/frame-buffer/2072/7 "2021-01-06T19:20:52Z")

</div>

Hi,  
Tracking two objects(circle shape) within the field of frame buffer. But the problem is when I try to center one object then the other object also comes to the field. So the device is confused to center the object. My question is when multiple objects in the frame buffer(scope of the camera), Is there any chance to track and center the single object in the frame buffer.  
My device is OpenMv H7 Plus.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [January 6, 2021, 7:52pm UTC](https://forums.openmv.io/t/frame-buffer/2072/8 "2021-01-06T19:52:57Z")

</div>

Hi, you need to explain more clearly what the problem is… if you have two objects that look similar then you need some way to distinguish them. Can you give a picture of the issue?

---

<div class="post-metadata">

**Author:** ![Betabulls](https://avatars.discourse-cdn.com/v4/letter/b/8e8cbc/32.png) [@Betabulls](https://forums.openmv.io/u/Betabulls)\
**Post date:** [January 7, 2021, 6:25am UTC](https://forums.openmv.io/t/frame-buffer/2072/9 "2021-01-07T06:25:11Z")

</div>

Hi,  
Please see the attached file for you reference. here frame buffer have two circle shape objects, when i try to center the object 1 to the frame then object 2 also there at frame see at attached file. in this case i confused to know the object 1 from the find\_circles() library to center the object in frame buffer.

 ![image (1).png](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/7/73a5eeb8e3314ba6f5b5d8ff6335b6eb36bc7537.png)

---

<div class="post-metadata">

**Author:** ![Betabulls](https://avatars.discourse-cdn.com/v4/letter/b/8e8cbc/32.png) [@Betabulls](https://forums.openmv.io/u/Betabulls)\
**Post date:** [January 7, 2021, 6:27am UTC](https://forums.openmv.io/t/frame-buffer/2072/10 "2021-01-07T06:27:20Z")

</div>

Hi,  
Please find attached file for your reference

 ![image (1).png](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/8/8a4cbee0378a589fc9ee05a7034931b5ed1864d1.png)

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [January 7, 2021, 5:02pm UTC](https://forums.openmv.io/t/frame-buffer/2072/11 "2021-01-07T17:02:59Z")

</div>

Is there any way to tell the difference between the two objects? If you want to choose one over the other you need to have some criteria for that. Otherwise, they both are valid to center on.

---

<div class="post-metadata">

**Author:** ![tennisparty](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tennisparty](https://forums.openmv.io/u/tennisparty)\
**Post date:** [March 22, 2021, 9:57pm UTC](https://forums.openmv.io/t/frame-buffer/2072/12 "2021-03-22T21:57:51Z")

</div>

Hi,

I’m just wondering if frame buffers were ever implemented in the h7+? Or plans in the future?

Thanks,  
Sam

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 22, 2021, 10:45pm UTC](https://forums.openmv.io/t/frame-buffer/2072/13 "2021-03-22T22:45:08Z")

</div>

You can alloc an extra in the sensor module.

Double buffering is not here yet. I haven’t been working on given there are other features I have to build out.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 23, 2021, 5:03pm UTC](https://forums.openmv.io/t/frame-buffer/2072/14 "2021-03-23T17:03:37Z")

</div>

This is on my todo list and will be done before June.

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [March 23, 2021, 6:32pm UTC](https://forums.openmv.io/t/frame-buffer/2072/15 "2021-03-23T18:32:10Z")

</div>

> [@tennisparty](#):
>
> I would like to know if it is possible to continuously buffer X number of seconds into the memory

The original request here has been implemented with ImageIO.

---

<div class="post-metadata">

**Author:** ![tennisparty](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tennisparty](https://forums.openmv.io/u/tennisparty)\
**Post date:** [November 15, 2023, 2:12pm UTC](https://forums.openmv.io/t/frame-buffer/2072/16 "2023-11-15T14:12:56Z")

</div>

Hi,

Sorry for the slow reply, I’ve been investigating openmv again and it looks really promising. Do you have some more details on how to implement a frame buffer in the system and then record the previous x frames when motion is detected.

I assume it will be some combination of these two example scripts:

> <https://github.com/openmv/openmv/blob/master/scripts/examples/01-Camera/01-Video-Recording/imageio_memory.py>

&

> <https://github.com/openmv/openmv/blob/master/scripts/examples/01-Camera/01-Video-Recording/mjpeg_on_movement.py>

It would be useful to know what number of frames might be possible to store in some different resultions (e.g. qqvga and vga)

Thanks for your help,  
Sam

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 15, 2023, 2:41pm UTC](https://forums.openmv.io/t/frame-buffer/2072/17 "2023-11-15T14:41:31Z")

</div>

Just do:

Sensor.set\_framebuffers(x)

And use an X greater than or equal to 4. This gives you an image fifo of that depth.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 15, 2023, 2:42pm UTC](https://forums.openmv.io/t/frame-buffer/2072/18 "2023-11-15T14:42:58Z")

</div>

Alternatively, see the ImageIO module.

---

<div class="post-metadata">

**Author:** ![tennisparty](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@tennisparty](https://forums.openmv.io/u/tennisparty)\
**Post date:** [November 15, 2023, 3:05pm UTC](https://forums.openmv.io/t/frame-buffer/2072/19 "2023-11-15T15:05:19Z")

</div>

Great, I will have a look, I assume I would need to clear that buffer every x frames aswell so it doesn’t become unmanageable?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 15, 2023, 4:05pm UTC](https://forums.openmv.io/t/frame-buffer/2072/20 "2023-11-15T16:05:04Z")

</div>

The image fifo mode for the frame buffer does pretty much what you want. There’s also a setting you can enable to disable automatic flushing if you want older images. By default it flushes itself if you start dropping frames.

Please see the sensor documentation.

[Next page](https://forums.openmv.io/t/frame-buffer/2072.md?page=2)
