frames/second

General discussion about topics related to OpenMV.
pcls1026
Posts: 19
Joined: Tue Aug 22, 2017 1:33 am

frames/second

Postby pcls1026 » Mon Nov 13, 2017 3:14 pm

I run helloworld.py.
The fps printed out vary wildly--80 fps to 28 fps.
what overhead causes the difference?
will the fps be more stable when the camera is not run in the IDE?

Jim
User avatar
kwagyeman
Posts: 1248
Joined: Sun May 24, 2015 2:10 pm

Re: frames/second

Postby kwagyeman » Mon Nov 13, 2017 10:22 pm

Hi, the FPS should be pretty stable. Which FPS number are you talking about? The one printed in the terminal is the actual FPS, the one printed on the IDE is how fast the IDE samples the camera frame buffer. The speed at which the IDE samples the frame buffer is highly variable depending on your computers CPU load.
Nyamekye,
pcls1026
Posts: 19
Joined: Tue Aug 22, 2017 1:33 am

Re: frames/second

Postby pcls1026 » Tue Nov 14, 2017 12:49 am

I am referring to the FPS printed out using "print(clock.fps())" command in the script. The printout is in the IDE serial terminal.
User avatar
kwagyeman
Posts: 1248
Joined: Sun May 24, 2015 2:10 pm

Re: frames/second

Postby kwagyeman » Tue Nov 14, 2017 3:24 am

Yes, that FPS should be very stable. Um, does the FPS continue to vary wildly throughout the runtime of the script or just at the beginning?
Nyamekye,
pcls1026
Posts: 19
Joined: Tue Aug 22, 2017 1:33 am

Re: frames/second

Postby pcls1026 » Tue Nov 14, 2017 2:29 pm

10.42305
--
--
7.692307

See attached file
Attachments
kwa.py
(685 Bytes) Downloaded 4 times
User avatar
kwagyeman
Posts: 1248
Joined: Sun May 24, 2015 2:10 pm

Re: frames/second

Postby kwagyeman » Wed Nov 15, 2017 1:49 am

Hi, the code you posted isn't doing what you think. I believe you want this:

Code: Select all

import sensor, image, time

sensor.reset()                           # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE)   # Set pixel format to GRAYSCALE.
sensor.set_framesize(sensor.VGA)         # Set frame size to QVGA (640x480)
sensor.skip_frames(time = 2000)          # Wait for settings take effect.
clock = time.clock()                     # clock timeing

while True:
    clock.tick()
    cxm=320
    cym=260
    img = sensor.snapshot()                  # Take a picture and return the image.
    for j in range(40):
        for i in range(40):
            gs = img.get_pixel((cxm-20)+i,(cym-20)+j)      # Read pixel value of returned image.

    print(clock.fps())
The FPS is stable too.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests