how4rd / meshflow

An implementation of the MeshFlow video stabilization algorithm by S. Liu et al.
31 stars 8 forks source link

About the speed? #3

Closed realgump closed 2 years ago

realgump commented 2 years ago

Hi, thanks for your great work.

I am not an expert in video stabilization. I wonder what the speed should be of the algorithm. I try to run the given video1, but takes nearly 10 minutes. In my opinion, the algorithm should have been computationally cheap. Is that because of the python language itself?

how4rd commented 2 years ago

Thank you!

I'm no expert either. My main goal with this implementation was to learn, so whenever I had to decide between making the code faster or more readable, I made it more readable. As a result, the code runs rather slowly. 10 minutes sounds about right.

Yeah, I think Python the main reason the code is slow. The implementation uses lots of for loops, which are much slower in Python than in C/C++. I don't think the matrix math is the bottleneck, since it's done through NumPy and OpenCV functions, which are wrappers for C/C++ code.