This code is an accelerated open-source software for 2D optical flow estimation and mechanical strain.
The code is based on D. Sun method with some improvements.
There are two versions of the software: a CPU and a GPU version.
To use the code, you will need Python 3 (3.6 or higher) with the following modules:
For the CPU version:
- Numpy 1.20.3 or newer
- Scikit-image 0.16.2 or newer
- Scipy 1.6.3 or newer
- OpenCV 4.2.0 or newer
- You may also need Numba if Li and Osher filter will be used
For the CPU version:
For the GPU version you will first need an NVIDIA CUDA GPU with the Compute Capability 3.0 or larger.
Beside the previous packages some additional ones with some and APIs will be needed to run the code on GPU
Some image sequences were given in the folder Images in order to test the code.
Inputs:
The software will need at least 3 inputs:
- The image sequence path
- The name of the first image of the sequence
- The name of the second image of the sequence
The other parameters were set by default, but you can modify them also using the keywords as how it was described in the documentation.
Outputs:
Two npy files will be generated in the end of running:
- u_cucim.npy the horizontal flow field
- v_cucim.npy the vertical flow field
To calculate the strain field, you can use the function gradient of numpy or( of cupy if you are using the graphic card).