Closed sberryman closed 6 years ago
Great find! I'll have to include a case where not all the images have the same dims but I'll check this out.
Added.
Nice! Did you test it on a large batch of images to see the performance improvement?
On a side note I've got ODM running on 1,443 images with some changes to depthmap parameters to depthmap_resolution=1280
, depthmap_min_patch_sd=2.5
and depthmap_method=BRUTE_FORCE
(Computer has an overclocked Intel Core i7-7820X w/ 64 GB ram)
The mapping area consists of an EXTREMELY dense urban environment. Thus, I'm not expecting amazing results. It has been running since 2018-03-02T21:47:40Z
and moved to odm_25dmeshing
roughly 8 hours ago.
I ran into this issue on a side project where I had to undistort ~7 million 4K resolution images. It turns out OpenCV's undistort function computes a rectification map every execution.
If you simply move
getOptimalNewCameraMatrix
before the for loop, addmapx, mapy = cv2.initUndistortRectifyMap(K, d, None, newcamera, (w, h), 5)
below that and then replace line 83cv2.undistort(...)
withcv2.remap(img, mapx, mapy, cv2.INTER_LINEAR)
you will see a massive speed up. The only issue is that every image must have the same dimensions.https://github.com/dakotabenjamin/CameraCalibration/blob/708694bd42ff18e204beb142925b9ccdecc83884/undistort.py#L82-L83