This repository contains the source code for my Bachelor's final project titled DeepVision Frame Reconstruction System, which focuses on intelligent video frame reconstruction using classical computer vision and optical flow techniques.
The project is structured into three major components:
Detects the most significant frames in a video based on HSV color differences. A weighted moving average filter is used to smooth the difference signal, and a statistical threshold identifies keyframes.
Creates a simulated incomplete video by removing every other frame. This step emulates real-world scenarios like transmission loss or low-frame-rate capture.
Missing frames are reconstructed by estimating motion between remaining frames using the Farneback optical flow algorithm. Intermediate frames are generated and inserted to produce a complete, smooth video.
This system currently uses classical computer vision and image processing methods, including:
- HSV color analysis for frame comparison
- Optical flow for motion estimation
- Hybrid interpolation for reconstructing missing frames (combines fast remapping with robust interpolation)
No deep learning models are used in this version, but the architecture is designed to support future integration with neural-based approaches.
The system supports two modes of output video generation:
- OpenCV-based (fast, efficient for standard formats like
.mp4
) - ImageIO-based (flexible, supports formats like
.gif
,.webm
, etc.)
You can choose the backend by setting a flag in the code, depending on your platform or output needs.
This project serves as a foundation for various real-world and research applications:
- Recovery of damaged or incomplete video streams
- Frame rate upscaling (e.g., 30fps to 60fps)
- Video summarization using keyframes
- Preprocessing for deep learning models (temporal consistency, frame interpolation)
- Restoration in surveillance, drone, and medical video footage
DeepVision helps in generating clean, temporally consistent video sequences ideal for training AI models in:
- Action recognition
- Gesture detection
- Temporal segmentation
- Video captioning and understanding
project/
│
├── main.py # Entry point for executing the full pipeline
├── keyframe_extraction.py # Detects keyframes using HSV differences
├── make_incomplete_video.py # Drops every other frame
├── hybrid_optical_flow_interpolation.py # Interpolates missing frames (fast + robust)
├── reconstruct_full_video.py # Builds final output video
├── README.md # This documentation file
└── output/ # Folder to store results
The file hybrid_optical_flow_interpolation.py
implements an advanced interpolation method that combines:
- Fast warping using
cv2.remap
- Edge-correction using
RegularGridInterpolator
from SciPy
This hybrid approach ensures both speed and accuracy, particularly in edge cases or at motion boundaries.
The next stages of development include:
- Replacing classical methods with AI-powered frame generation (e.g., RIFE, Super SloMo)
- Real-time frame interpolation and restoration
- Evaluation on real-world, low-quality video datasets
To run the entire pipeline:
python main.py
Make sure to update the input video path in main.py
before running.
- Python 3.7 or higher
- OpenCV
- NumPy
- SciPy
- ImageIO
Install dependencies using:
pip install -r requirements.txt
Shady Nikooei
Final Year B.Sc. Student in Computer Engineering
This repository will continue to evolve with future integration of deep learning techniques for advanced video restoration and understanding.