Have you ever wondered why some videos appear choppy while others look smooth? The reason behind this is the frame rate of a video, also known as the frames per second (FPS). FPS measures the number of still images, or frames, displayed in one second of a video or animation clip.

Examples of Different Frame Rates (Source)

The higher the number of frames in a video, the smoother it looks. On the other hand, a lower frame rate makes the video appear choppy or stuttered.

Both high and low frame rates have advantages in different applications. This is especially true for computer vision applications like surveillance systems and sports analysis that require real-time video processing.

In this article, we’ll explore what FPS is, how to calculate it, and its significance in various computer vision-based applications. Let’s get started!

What is FPS?

Frames per second (FPS) or frame rate indicates the number of individual frames that are processed or displayed consecutively in a second. It is a crucial component that helps determine the fluidity and smoothness of visuals in many fields, including video production, gaming, and animations.

In most cases, a higher FPS is desirable because it improves the visual experience by providing a more realistic and engaging representation of movement.

What is considered a higher or lower FPS? FPS values that are 30 and above can be considered higher as they provide a much smoother viewing experience.

An FPS of 60 to 120 can provide an even more immersive experience. Generally, movies, TV shows, and YouTube videos are at an FPS of 24 to 30. However, high-speed photography, virtual reality, and gaming applications may require much higher frame rates (60 FPS or more) to showcase seamless and immersive motion.

How to Calculate FPS

To calculate FPS, divide the number of frames processed by the total time taken to process those frames. For example, if 100 frames are processed in 2 seconds, the FPS would be calculated as follows:

FPS = Number of Frames / Duration in Seconds

In this example, we would calculate FPS as:

FPS = 100 frames / 2 seconds = 50 FPS

You can use OpenCV and Python to calculate the FPS of a video using a built-in method or a manual calculation approach.

OpenCV's VideoCapture function allows you to access video files or webcam streams and lets you retrieve various properties, including the FPS. You can also manually calculate the FPS by measuring the time it takes to process a specific number of frames.

Before running the code, make sure to install OpenCV. You can do this using pip:

pip install opencv-python

Let’s take a look at the code for this:

import cv2
import time

# Start video capture
video = cv2.VideoCapture("your_video.mp4")

# Get FPS using OpenCV property
fps = video.get(cv2.CAP_PROP_FPS)
print(f"Frames per second using video.get(cv2.CAP_PROP_FPS): {fps}")

# Calculate FPS manually
num_frames = 120  # Number of frames to capture
print(f"Capturing {num_frames} frames")

# Start time
start = time.time()

# Capture frames
for i in range(num_frames):
    ret, frame = video.read()

# End time
end = time.time()

# Calculate time elapsed and FPS
seconds = end - start
fps_manual = num_frames / seconds
print(f"Time taken: {seconds} seconds")
print(f"Estimated frames per second: {fps_manual}")

# Release the video capture object
video.release()

This code will capture 120 frames, measure the FPS, and print the FPS to the console.

Note: When manually calculating frames per second (FPS), it's important to set a consistent number of frames to get reliable measurements.

FPS in Computer Vision

With respect to computer vision, FPS is an important metric to evaluate. For example, computer vision applications like product quality assurance and sports broadcasting may require high frame-rates. Whereas environments where changes happen less frequently may require a lower frame rate .

Having a higher FPS for computer vision projects brings many benefits to the table, including: 

  • Better object tracking: A higher FPS helps object tracking algorithms like ByteTrack perform with greater accuracy.
  • Improved performance for security applications: In security and surveillance systems, a higher FPS can result in higher-quality video footage that is easier to analyze and use for identification purposes.

The FPS at which your application runs will determine the accuracy of your system.

For example, if you wish to identify a large, slow object in a video, then 15 FPS can be sufficient. But if you want to identify the license plate number of a car that is moving at a speed of 40 km/hr on the highway, then you would need at least 30 FPS (or more) for hassle-free identification. In this case, you will need a fast computer vision model and a camera graded for higher FPS to achieve the desired performance.

How FPS Affects Computer Vision Model Selection

Choosing a computer vision model is also dependent on the required FPS. For example, YOLO is ideal for high-speed detection in surveillance and autonomous driving.

Faster R-CNN is good at detailed image analysis with high accuracy but lower FPS. EfficientDet balances speed and accuracy and is suitable for various applications, while MobileNet is designed for mobile and IoT devices with low computational needs.

So, it’s essential to understand your FPS needs and consider them when deciding what model to work with.

Applications of High FPS AI Systems

Next, let’s take a closer look at some applications where a high FPS is key.

Industrial Inspection Systems

Consider a production line where products go by at high speeds on a conveyor belt. Here, a high FPS AI system can capture sharp, detailed images of each item without any motion blur. These images can be used for real-time detection of defects, inconsistencies, or malfunctions, catching every imperfection on the fly. 

Computer Vision Being Used to Monitor Vehicle Assembly Lines (Source

Integrated with pick-and-place robots, these systems capture sharp, detailed images of objects and allow the robots to precisely identify and grab items based on barcodes or other markings. The data generated using these high FPS systems gets sent to central systems for real-time analysis.

ANPR

ANPR Needs a Higher FPS Rate (Source)

A higher FPS can greatly improve the accuracy and speed of computer vision-based Automatic Number Plate Recognition (ANPR) systems. Capturing more frames per second will reduce the chances of missing critical details like the make, model, and plate number of fast-moving vehicles. A higher frame rate also allows the system to process number plates in real-time without delay, so vehicles that are speeding can be flagged on the go. 

Conclusion

Frame rate or FPS refers to the number of individual frames recorded or processed in a second. In this guide, we walked through what FPS is and how FPS relates to computer vision models. 

Higher FPS in AI systems like industrial inspection and license plate recognition means sharper images, real-time analysis, and better overall performance. However, it can also drain resources, reduce battery life, and strain hardware. You will need a fast computer vision model to achieve the best FPS. Slow models will limit the number of frames you can process.