Gradient Vector Flow (GVF)

Pure MATLAB version of Quan Wang's Fast Gradient Vector Flow (GVF).

You are now following this Submission

This implementation was originally based on Quan Wang's Fast Gradient Vector Flow (GVF): https://www.mathworks.com/matlabcentral/fileexchange/45896-fast-gradient-vector-flow-gvf
On tested hardware, this pure MATLAB implementation achieved comparable or better performance than the referenced C++ implementation.
Implementation details:
Compared to the original implementation, this MATLAB version introduces several optimizations focused on computational efficiency and memory usage:
  • The Laplacian term is computed using a direct 4-neighbour finite-difference stencil implemented via conv2(), avoiding the overhead of del2() and providing approximately a 3x speed improvement over del2().
  • Computations are performed in single precision, reducing memory consumption and improving runtime by approximately 2x compared to double precision.
  • Memory usage is reduced by minimizing temporary array allocations during the iterative update process. The Laplacian buffer is reused for both vector field components.
  • Boundary conditions are handled efficiently by updating the existing one-pixel symmetric padding instead of repeatedly creating padded copies of the image.
  • The implementation supports CUDA-enabled GPUs through MATLAB's gpuArray framework. Performance improvements depend on image size and GPU hardware.

Cite As

Gebhard Stopper (2026). Gradient Vector Flow (GVF) (https://in.mathworks.com/matlabcentral/fileexchange/173055-gradient-vector-flow-gvf), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired by: Fast Gradient Vector Flow (GVF)

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
2.0.0

More efficient padding now simply updates boundary pixels.
Reduced memory consumption.
GPU compatible.
Improved code comments.

1.0.1

Improved description

1.0.0