Pic time for OV2640 in JPEG/UXGA with USB connected

Discussion related to "under the hood" OpenMV topics.
User avatar
chrisPyres66
Posts: 144
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Pic time for OV2640 in JPEG/UXGA with USB connected

Postby chrisPyres66 » Wed Apr 01, 2020 11:59 am

Hello all,

I use OV2640 cam in UXGA/JPEG mode on STM32F765 with firmware 3.5.3.

The time between pics is very high when usb is connected.
Even if frame view is desactivated in openmvide, or the test is only through uvc terminal.

Here is an test code :

Code: Select all

import sensor, image, time, os,  pyb

total = 10

for i in range(total) :
   filename='temp/test_%d.jpg' % i
   try:
      os.stat(filename)
      os.remove(filename)
      print("%s is deleted" % filename)
   except OSError:
      print("%s does not exist" % filename)

sensor.reset()
sensor.set_pixformat(sensor.JPEG)
sensor.set_framesize(sensor.UXGA)

for i in range(total) :
   start = pyb.millis()
   filename='temp/test_%d.jpg' % i
   try:
      sensor.snapshot().save(filename)
      print('Record %d en %dms: %s' % ( i, pyb.elapsed_millis(start), filename) )
   except:
      print("Error of Record %d: %s" % (i, filename) )

print('photo record is finished')
Whatever i tried, the first image takes around 250ms, then goes around 3s.
If i run this code from sdcard without usb connected and take pictures of a stopwatch, the time between pics is around 250ms.

Thanks for help,
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: Pic time for OV2640 in JPEG/UXGA with USB connected

Postby kwagyeman » Wed Apr 01, 2020 12:14 pm

Update firmware?
Nyamekye,
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: Pic time for OV2640 in JPEG/UXGA with USB connected

Postby kwagyeman » Wed Apr 01, 2020 12:15 pm

Oh, it's because of the SD card write. There's no way to know how long writing to media takes.
Nyamekye,
User avatar
chrisPyres66
Posts: 144
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: Pic time for OV2640 in JPEG/UXGA with USB connected

Postby chrisPyres66 » Wed Apr 01, 2020 1:23 pm

It is the same problem without the SD card write.
it appears along time like 4- 5pics, and stabilize around 3s.
User avatar
kwagyeman
Posts: 3985
Joined: Sun May 24, 2015 2:10 pm

Re: Pic time for OV2640 in JPEG/UXGA with USB connected

Postby kwagyeman » Wed Apr 01, 2020 2:04 pm

Yeah, the first image takes 250 ms because I reset the camera after you made the setup calls to it. It takes a while to start generating valid frames. You moved skip frames code I see. As for the speed of capture. I can't say that UXGA mode with the OV2640 is really fast. I only got the driver technically working with that camera. I didn't speed a lot of time optimizing it.
Nyamekye,
User avatar
chrisPyres66
Posts: 144
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: Pic time for OV2640 in JPEG/UXGA with USB connected

Postby chrisPyres66 » Thu Apr 02, 2020 2:34 am

yes it is, if i dont have usb connected.
The time between pics is around 250ms at each time on pics, when i run main.py and record on sdcard without usb connection.
I will forward today to see if it is not uvc driver, a current limitation of usb2 or something else..

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 20 guests