Esp32CameraRover2 icon indicating copy to clipboard operation
Esp32CameraRover2 copied to clipboard

Improve camera frame rate

Open Ezward opened this issue 3 years ago • 1 comments

Camera frame rate is influences by

  • image size; smaller images, especially 640x480 and below, produce better frame rates
  • number of frame buffers allocated. There should be at least 2 buffers allocated. This is only possible for lower resolution modes and with PRAM available.
  • The clock rate. It turns out a lower clock rate can enhance framerate on low resolutions, perhaps because all the work the sensor does can be done within a single frame. See https://github.com/espressif/esp32-camera/issues/15

NOTE: the way memory is partitioned is important to make sure there is enough available for multiple frame buffers. The ESP32-Cam example sketches us the 'Huge APP' partition scheme. So we should make sure we've made enough memory available for our system to have multiple frame buffers. See https://iotespresso.com/how-to-set-partitions-in-esp32/ See this for how to set partition table in platformio https://community.platformio.org/t/partion-scheme-no-ota-with-platformio/13102/8 See relevant PlatformIO docs https://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables

Tasks;

  • experiment with combinations of image size, frame buffers and clock rate to optimize frame rate
    • do this with and without factoring in the transfer of the images, so that we see the raw rate and the overhead imparted by transferring to the web UI.
  • Review partition table settings to make sure they support the configuration. If possible leave memory for OTA, as that would be a much nicer way of programming the board.
  • Add a compile flag to fix the frame size, number of buffers allocated and the clock rate to the chose parameters
  • Hide the camera properties UI when the image properties are fixed.
  • Hard code the camera properties endpoint to return the fixed properties.

Donkeycar uses 160x120, so that might be what we want here. However 640x480 is much better quality for FPV, so maybe we want a way to switch between these two mode.

Ezward avatar Nov 09 '21 20:11 Ezward

Hi, @Ezward , did you manage to find something about increasing the framerate? Im using arduino ide, and struggle with the driver. Greetings.

thet0ast3r avatar Feb 02 '22 11:02 thet0ast3r