A GPU-accelerated application for real-time video processing, enhancement, and analysis using CUDA.
This capstone project demonstrates the power of GPU computing for real-time video processing. The application leverages CUDA to perform computationally intensive operations on video frames in parallel, achieving significant performance improvements compared to CPU-based processing.
Key features:
- Multiple GPU-accelerated image filters (blur, sharpen, edge detection, emboss, sepia, etc.)
- Real-time video processing from files or camera input
- Advanced visual effects like thermal vision and night vision simulation
- Motion detection between consecutive frames
- Optical flow visualization
- Simple object detection
- Batch processing for higher throughput
- Performance benchmarking tools
- NVIDIA CUDA Toolkit (11.0+)
- OpenCV 4.x
- C++17 compatible compiler
- CMake 3.10+
-
Clone this repository:
git clone <repository-url> cd GPU-Specialisation-Capstone
-
Create a build directory and compile:
./build.sh
Or manually:
mkdir -p build cd build cmake .. make -j$(nproc)
A Dockerfile is provided for containerized development and execution:
docker build -t cuda-video-processor .
docker run --gpus all -it --rm cuda-video-processorThe application supports various command-line arguments:
./video_processor [options]--input <source>: Input source (video file path or camera index)--output <filename>: Output video file (optional)--filter <filter_type>: Filter to apply (default: none)--transform <transform>: Transform to apply (default: none)--intensity <value>: Filter intensity (0.0-1.0, default: 0.5)--detect-motion: Enable motion detection--optical-flow: Enable optical flow visualization--detect-objects: Enable simple object detection--benchmark: Run performance benchmark--batch-size <size>: Batch processing size (default: 1)--help: Display help message
none: No filterblur: Gaussian blursharpen: Sharpen effectedge_detect: Edge detectionemboss: Emboss effectsepia: Sepia tonegrayscale: Grayscale conversionnegative: Color inversioncartoon: Cartoon effectsketch: Sketch effectnight_vision: Night vision effectthermal: Thermal vision effect
none: No transformationrotate_90: Rotate image by 90 degreesrotate_180: Rotate image by 180 degreesrotate_270: Rotate image by 270 degreesflip_h: Flip horizontallyflip_v: Flip vertically
Process a video file with a blur filter:
./video_processor --input input_video.mp4 --output output_video.mp4 --filter blur --intensity 0.7Use camera input with thermal vision effect:
./video_processor --input 0 --filter thermal --intensity 0.8Enable motion detection with edge detection filter:
./video_processor --input input_video.mp4 --filter edge_detect --detect-motionRun performance benchmark:
./video_processor --input input_video.mp4 --benchmark- Frame Acquisition: Frames are captured from video files or camera.
- GPU Transfer: Frame data is transferred to the GPU memory.
- Parallel Processing: Each pixel is processed in parallel using thousands of CUDA threads.
- Filter Application: Mathematical operations are applied to transform pixel values.
- Result Transfer: Processed frames are transferred back to CPU memory.
- Display/Storage: Results are displayed in real-time and/or saved to disk.
The project implements various CUDA kernels for different image processing tasks:
- Convolution Kernel: Applies convolution filters (blur, sharpen, edge detection, etc.)
- Color Transformation Kernels: Applies specialized color effects (sepia, grayscale, etc.)
- Motion Detection Kernel: Computes differences between consecutive frames
- Special Effect Kernels: Implements complex effects like thermal vision and night vision
The GPU acceleration provides significant performance improvements over CPU-based implementations:
- Processing HD video (1920x1080) in real-time at 30+ FPS
- 10-20x speedup compared to equivalent CPU implementation
- Efficient batch processing for higher throughput
Actual performance depends on GPU specifications, filter complexity, and frame resolution.
- Advanced object detection and tracking using CUDA-accelerated ML models
- Deep learning-based video enhancement
- Support for multiple GPU devices
- Hardware-accelerated video encoding/decoding
- More complex visual effects and transformations