Items with no label
告知
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
3338 ディスカッション

How can I get the fps value?

idata
従業員
2,318件の閲覧回数

Hi,

I realized that when I have a high computational cost in my program, the fps reduced its value. I wondered if I can get the fps value instantly.

Thanks in advance!

7 返答(返信)
MartyG
名誉コントリビューター III
1,100件の閲覧回数

This article has some downloadable source code that may give you insight about how to monitor the frame rate.

https://software.intel.com/en-us/videos/intel-realsense-unity-5-pro-tip-monitor-the-realsense-frame-rate RealSense - Intel® RealSense™ + Unity* 5 Pro Tip: Monitor the RealSense Frame Rate | Intel® Software

jb455
高評価コントリビューター II
1,100件の閲覧回数

If you just want to check the frame rate for debug purposes, you could put a System.Diagonstics.Stopwatch (assuming C# ) on to time each frame, adding each stopwatch.ElapsedMilliseconds to a List and calling stopwatch.Reset() at the end of each frame. I've used this method for identifying parts of my camera loop which were causing slowdowns and required optimisation. If you want FPS rather than milliseconds, you can do 1000/ElapsedMilliseconds to get the maximum frame rate (eg, if your camera loop takes 50ms, the maximum frame rate would be 1000/50 = 20fps)

idata
従業員
1,100件の閲覧回数

Thanks jb455, but I'm working in c++. I was asking for some function that get me that value.

Anyway I'm going to try your solution

jb455
高評価コントリビューター II
1,100件の閲覧回数

The C++ Raw Streams sample has an FPS counter along the bottom of the screen - if you look in the source code you should be able to work out how they do it!

idata
従業員
1,100件の閲覧回数

Hi MQMQ,

 

 

Do you still need assistance with this thread? Keep us updated on your progress.

 

 

-Sergio A

 

idata
従業員
1,100件の閲覧回数

Hi Sergio,

I tried to do the jb455's solution but I'm not was able.

In the RAW example there are some functions and I tried to use one of them but it doesn't work.

My code:

int frame = FaceTrackingFrameRateCalculator::GetFrameRate();

int FaceTrackingFrameRateCalculator::GetFrameRate()

{

isFrameRateReady = false;

return frameRate;

}

idata
従業員
1,100件の閲覧回数

Perhaps the answer is on using generic C++ code instead of focusing on the SDK. For example, you can try something similar to what is explained on these guides:

 

 

https://noobtuts.com/cpp/frames-per-second

 

http://www.opengl-tutorial.org/miscellaneous/an-fps-counter/

 

 

Pedro M.
返信