danopdev / MergePhotos

Android application for marge multiple photos: panoramas, HDR, ...
MIT License
28 stars 0 forks source link

Median filter in long exposure mode #5

Open vwueest opened 3 months ago

vwueest commented 3 months ago

Hi @danopdev Thanks a ton for your work. Really like your app. Have used it lots for panoramas. Just great!

I have a tiny feature request that would help me a lot. You have a "nearest to average" mode, which supposedly gets rid of things that change. For me it kind of works but many objects don't disappear completely (see attached photo). However, I have previously done some tests with applying a median instead and that completely got rid of all objects. What do you think, could you implement that as well? It would be super useful to remove people in crowded areas, for example in touristy place. If I understand correctly it shouldn't be to much effort to code that, but let me know what you think :) Screenshot_20240519-105234

vwueest commented 3 months ago

Something similar to this :)

danopdev commented 2 months ago

Hi @vwueest

I'll have a look. If possible can you attach the original photos ?

Regards,

vwueest commented 2 months ago

Sweet, very glad to hear :) sure thing, here you go! Hope that helps

PXL_20240519_004359584 PXL_20240519_004356680 PXL_20240519_004355677 PXL_20240519_004354344 PXL_20240519_004357687

danopdev commented 2 months ago

Hi I did some test and it does not improve much the output. It's not easy to compare "colors". Maybe it work better when colors are more different. Regards,

vwueest commented 2 months ago

Hey, thanks for the update! Ah really? That's surprising. I'm sorry if that means I wasted some of your time. I could have a look as well on my side. Unfortunately I'm much more comfortable with python. Any chance you can export the aligned images easily? Or can I do that myself with the "align" mode in the app? Sorry, I never quite figured out how that mode works

danopdev commented 2 months ago

Hi, yes you can with the align from the app. Just in case I attach the images aligned (ignore the black regions, they are caused by the rotation needed for alignment). If you find a decent solution I happy to use it.

My tested was based on:

Regards

2_align 2_align_001 2_align_002 2_align_003 2_align_004

vwueest commented 2 months ago

Hey @danopdev, thanks for the pictures! And sorry for the delay.

I did some testing on my side. And from what I see it seems that the filters for the pictures with the sand didn't work well because the alignment of the pictures was not so great. So I did some testing with an easier case, where the pictures are taken from the same spot to see (a) if median filter works to get rid of moving objects, (b) if 'median' or 'closest to average' works better in such a case.

The pictures I used as a source are these 3: 1 2 3

(a) And here is the result of the median filter: median_img

(b) And the result of the nearest to average filter: closest_to_average_image

In both, we see some ghosting of the hand on the right. I assume this effect would disappear if there were more pictures. Overall, both images are very similar. And thinking about it a bit more, this makes total sense. Since nearest to average often is the same value as median. Maybe median could be a bit more robust to outliers, where for example one of the pictures does not get aligned well or similar. But my conclusion is, that your implementation of closest to average seems to be as good as median and I would therefore leave the code as it was. Let me know if you have any other inputs :)

danopdev commented 1 month ago

I'll try to see if the median helps a little or not. If it does (even a little bit) I'll used it :)

vwueest commented 1 month ago

Awesome, would be happy to hear about any findings and let me know if I can help