Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame Rate on Raspberry Pi #84

Open
c-keil opened this issue May 18, 2023 · 3 comments
Open

Frame Rate on Raspberry Pi #84

c-keil opened this issue May 18, 2023 · 3 comments

Comments

@c-keil
Copy link

c-keil commented May 18, 2023

Is there anything in the flirpy code that would limit the frame rate to 30hz when using a raspberry pi with a FLIR Boson? I use the following script to assess frame rate, and it hovers right around 30 hz on a raspberry pi, but hits 60hz with the same camera on my laptop.

import cv2
import numpy as np
import time

loop_start_time = None
with Boson() as camera:
    while True:
        img = camera.grab().astype(np.float32)
        if loop_start_time is None:
            loop_start_time = time.time()
        else:
            current_time = time.time()
            rate = 1/(current_time-loop_start_time)
            loop_start_time = current_time
            print(rate)

As far as I can tell, none of the pi's cores are maxed out, and 30hz seems like a suspiciously round number. I took a quick look at the Boson code and didn't see anything obvious.

@jveitchmichaelis
Copy link
Contributor

jveitchmichaelis commented May 18, 2023

Shouldn't be anything, the code was tested with a 60Hz Boson without any trouble. You could try querying the underlying OpenCV device to see what the frame rate is set to (or what it thinks it is).

@c-keil
Copy link
Author

c-keil commented May 23, 2023

When I check the OpenCV cap with something like:

from flirpy.camera.boson import Boson
import cv2
camera = Boson()
image = camera.grab()
print(camera.cap.getBackendName())
print(camera.cap.get(cv2.CAP_PROP_FPS))

I get:

V4L2
30.0

I get the same response on the Raspberry Pi and my laptop, but am able to grab frames at 60Hz on the laptop, and only at 30Hz on the Pi. So, seems like there is some underlying difference in OpenCV or the backend but it's not obvious what. I'll have to investigate further.

@jveitchmichaelis
Copy link
Contributor

jveitchmichaelis commented May 23, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants