Skip to content

Repository files navigation

Description

This Python script captures a video or an image file, or uses the camera to capture real-time video, and then displays the frames with the FPS (frames per second) count. It uses the OpenCV library to read and display the frames, and the Numpy library for numerical calculations. It also uses the argparse library to parse command-line arguments.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Requirements

Python 3
OpenCV
PyTorch
numpy
argparse

Installing

Clone the repository to your local machine using the following command:

 git clone https://github.com/your_username/video-fps-analyzer.git 

Usage

The script takes in the following command-line arguments:

python python_main.py [-h] [-v] [-v VIDEO] [-c] [--no_show] [-d] [-d DEVICE]

The following arguments are available:

-h, --help: show help message and exit.
-v VIDEO, --video VIDEO: path to Video File.
-c, --camera: set this flag to use the camera.
--no_show: don't show output.
-d DEVICE, --device DEVICE: specify the target device to infer on; CPU or GPU. Suitable plugin for the device specified.

Example usage:

bash To analyze the FPS of a video file, run the following command:

python python_main.py -v /path/to/video.mp4

To analyze the FPS of a camera feed, run the following command:

python python_main.py -c

To analyze the FPS of a video file using the GPU, run the following command:

python python_main.py -v /path/to/video.mp4 -d gpu

Output

The script displays the frames with the FPS count on them. It also outputs the average and maximum FPS over all frames to the console.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages