OpenSfM icon indicating copy to clipboard operation
OpenSfM copied to clipboard

added lru caching for faster undistortion

Open originlake opened this issue 2 years ago • 0 comments

In undistortion, computing camera mapping is the most expensive part, but it's only related to the camera model and image size, hence for each camera model and size, it only needs to be calculated once, and all the undistortion can use the same camera mapping.

This PR introduces a simple thread/process safe LRU cache wrapper to cache the camera mapping results so future undistortion can reuse it. This should greatly speed up the undistortion stage.

(The cmakelists.txt and similarity_model.cc changes are used to fix a bug when building c extensions in debug mode, **undefined symbol**)

originlake avatar Jul 03 '23 01:07 originlake