Open brht0 opened 2 months ago
Thanks! I will look into that. There was another issue (#4) about how to get the value of the peak, so it's definitely useful that OpenCV also returns that.
Were you running with the Release
build type btw?
Yes, I built it in Release mode, as per your instructions in the README. However, it might have been that the OpenCV build I have is just using acceleration options to make it faster, so I would recommend benchmarking against a standard OpenCV CPU build to see if it is (actually) faster.
Nevertheless, using native OpenCV functions will be faster by default.
PS, I made my own Fourier-Mellin implementation using OpenCV with python bindings, and have linked your project as one of the alternatives. Is this alright with you?
Please use OpenCV's provided phaseCorrelate function to improve performance.
With minor changes I improved the running time of
registerImage
from 316ms to 93ms, or ~3.4x improvement. (1280x720, 100 runs, averaged.) Changes in image_registration.cpp:, and:
I see no reason to implement phase correlation here. The implementation in OpenCV is different (see link), but the difference of the output transformation parameters is marginal.
As a side note, using OpenCV would also allow for outputting the confidence of the transform with the signal power around the peak 5x5:
OpenCV documentation for phaseCorrelate: https://docs.opencv.org/4.x/d7/df3/groupimgprocmotion.html#ga552420a2ace9ef3fb053cd630fdb4952
Implementation of OpenCV phaseCorrelate: https://github.com/opencv/opencv/blob/d7a237aefc76f841dba64544d09ab6df53097206/modules/imgproc/src/phasecorr.cpp#L518
Edit: Code highlight