This is a Python implementation of the Horn-Schunck optical flow computation method. Given an image sequence as input, this program calculates flow vectors (u, v) that represent pixel motion between consecutive frames. The Horn-Schunck method is a classic and widely used approach for estimating optical flow in computer vision.
- Consider two input images of consecutive frames, and compute optical flow.
- Utilizes the Horn-Schunck method for optical flow estimation.
- Regularization constant (alpha) to control the smoothness of the output flow vectors.
- Easily adjustable parameters for customized results.
Before running the program, make sure you have Python (>= 3.6) installed on your system. Clone this repository and install the required dependencies:
git clone https://github.com/chanukaravishan/Optical-flow-Horn-Schunk.git
cd Optical-flow-Horn-Schunk
pip install -r requirements.txt
To compute optical flow for your image sequences, follow these steps:
-
Prepare your image sequences: Make sure you have consecutive image frames in a directory.
-
Open the
of_hornschunk.py
script and set thealpha
parameter according to your requirements. The higher the value ofalpha
, the smoother the output flow vectors will be. -
Run the script by providing the path to your image sequence directory:
python of_hornschunk.py --input_path /path/to/your/image_sequences --output_path /path/to/save/flow_results
Contributions to this project are welcome! Feel free to open issues and submit pull requests to address bugs, add new features, or improve the existing implementation.
This optical flow computation program was developed by Chanuka Algama (https://github.com/ChanukaRavishan).
Special thanks to the original authors of the Horn-Schunck method for their valuable research and contribution to the computer vision community.