How to measure FPS of an OpenCV camera preview?

Okay, wow that makes sense! It’s only appropriate for me to move my framerate measurement into the method that is responsible for processing the frames.

I’ve ended up moving the get_fps snippet into OnCameraFrame and double-slashed the snippet being called in the main method. However, I’ve encountered several errors here. The main ones being one you had pointed out in your previous response; old_time requires a value input because there isn’t anything assigned to it, which is also a concern I should have included in OP as it was an issue I had prior to posting. Also, the variables get_fps are never used, so would I have to use it sometime within the OnCameraFrame method?

Aside from that, these seem to be the errors I have faced and have resolved everything else.