This repository contains a Python script that processes video files to detect and visualize motion vectors using block-matching algorithms. The script analyzes each frame of a video, compares blocks between consecutive frames, and draws arrows to represent motion. The processed frames are then compiled into a new video.
- Extracts frames from a video.
- Compares blocks of pixels between consecutive frames.
- Draws arrows to indicate motion between blocks.
- Saves processed frames and compiles them into a new video.
The script requires the following Python packages:
numpyopencv-python
You can install the required packages using pip:
pip install numpy opencv-python- Place your video file in the
SourceVideofolder. - Ensure the
VideoFramesandOutputFramesdirectories exist or create them.
- Change the variables
video_nameandoutput_video_nameto match the input video name [WITH EXTENSION] and desired output name
block_radius = 2pixel_search_radius = 35Tmin = 400Tmax = 1000
The above parameters can be tweaked to provide more optimal results based on your input video resolution and noise levels.

