-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoC Mavic 3M RGB unwarping #1740
Conversation
Classify point cloud before generating derivative outputs
…tmp_dir Update comment on mvs_tmp_dir
GLTF - obj2glb - Set extensionsUsed in all cases to be consistent with the GLTF standard
* Add Mavic 3 rolling shutter * M3
…ult-GPS-Accuracy increase default GPS-Accuracy to 3m
replace fisheye with fisheye_opencv but keep API the same until 4.0
Fix BOM encoding bug with geo files
good day, what can I do to help closing this issue? |
Previously, I tested this PR with a series of DJI M3M datasets (50 ~ 400 acres). Everything works perfectly so far. However, one aspect I'm uncertain about is whether we need to execute the downstream calibration/unwarping from OpenSfM after applying unwarping on the source images. |
Thanks for testing @pfxuan ! The unwarping from OpenSfM is needed because the reference images are unwarped also (and they need to align). This PR needs more testing, in my (small) experiments this did not completely solve the alignment issue and since this PR introduces some complex logic, I'm hesitant to merge it unless it really shows some good improvements over baseline. |
Thanks for explaining the OpenSfM unwarping part! From my previous tests, I found the following setup (Incremental + 2.5D mesh) is working particularly good in a high density of vegetation area. It can produce a better orthos than pix4d and metashape does. However, I was not able to produce a similar result using Triangulation and Plannar SfM-algorithm. In addition, I found the names of DJI GPS tags are inconsistent across different DJI models and probably firmwares. e.g. in M3M, EXIF meta shows
|
This is a never-ending nightmare that impacts practically every tag, including altitude, offsets, etc. Sorry this is impacting your work on this -_- |
From what I see in yours screenshot , looks like the calibration homography (close to identity = just a bit of misalignment) is the one you'll need to apply in the warp. This looks good if DJI provides this.. 95% shall be fixed ... The rest will be tiny parallax and unperfect Calibration ✌️✌️✌️🚀🚀🚀 |
Skip feathered raster generation when possible
From what little I can discern for the process, I assume we'd apply a cv2.warpPerspective after cv2.initUndistortRectifyMap, or would we somehow bundle those transformations together? |
I've been playing with getting a good alignment locally and came up with this, based on the DJI image processing guide. I'm a newbie when it comes to CV and Python though so there's likely issues. https://gist.github.com/lewispb/6c7dd6022ba3266cfd4f1310d4d51f5f One thing I haven't attempted is using the sun sensor data for calibration. Seems to only be present in the MS images XMP, not RGB. I've been testing this branch locally but was intermittently running into several stack overflows at the final orthophoto stage. I can share a dataset if it's helpful, or help with testing. |
This is great! Reading through (as a non-expert) this looks pretty solid. Would you be willing to do a pull request to integrate? As far as I can tell, just integrating the parse_homography_matrix and then use that padded warp_matrix in the align_image function prior to writing out would do the trick. But I'm no expert either, so happy to be corrected on approach. Testing data would be great, and I can do some testing too. Are your overflows memory overflows, or a race condition, or something else? I can run a few different docker images with different memory allocated up to 1.5TB, if we need to do any testing on memory needs. |
I'm getting segmentation faults when I run your code snippet headless. I'm not sure if that's an opencv module that requires a gui or an issue with my configuration, but I thought I'd mention it. Crunching though some test data now. |
@lewispb you seem to be on the right track. you can do both warping operations at once: https://github.com/wisescootering/infrareddrone/blob/master/registration/warp_flow.py#L95-L138 |
@lewispb -- do you have some test data to share? Perhaps unsurprisingly, my test data doesn't match your tags. It'd be good to cross walk them. |
Disregard: I have a matching dataset. And it works great. |
I had to disable multiprocessing, and we might have datasets that don't have the appropriate tags, in which case, we may have to fall back to DJI's published expected values. @lewispb -- are you ok with licensing this GNU Affero v3 ala the repo: https://github.com/OpenDroneMap/ODM/blob/master/LICENSE? Alternatively a pull request integrating it would be even better. :) Thanks for sharing this! |
Of course, that's fine. I'm not sure I if I'd be able to get a PR ready - I already attempted an integration with the work started here but struggled to get past / understand seg faults in the final orthophoto stage. If I get some time this week I'll share more on those. This is what I managed BTW - I just used the MS bands, not the RGB: |
I need to get back to testing, but traveling is slowing me down. I did just see this on the community forum, so I'll drop it here in the interest of keeping the conversation in one place: |
Hi there, I posted that comment and code smathermather linked above. You can tune the paramters number_of_iterations and termination_eps, which determine the "loop that aligns the images". But when you lower these numers you will run into issues when your images are quite homogeneous (grassland in my case). Increasing the number on the other side will slow things down even more. I ran it on two datasets and it seems to work fine. |
Cool! Diving in now. @MarioTro: Am I reading it correctly that it is calculating the homography and then applying it? If so, have you compared the results to using the homography published in the exif? |
Progress! I'm closing this in favor of #1771. |
Opening early to encourage testing.
Since the Mavic 3M's RGB sensor differs significantly from the multispectral sensor, image alignment fails. We actually currently drop the RGB band to allow the program to at least process the rest of the bands.
This PR unwarps the RGB images before processing using the EXIF dewarp data field which is provided by DJI and rescale the images to match the focal lengths between the two sensors.
The images this way are pretty close, although on very small datasets (5 images) this still yields some alignment issues.
I will test with larger datasets in the upcoming days.