Pages: [1] 2   Go Down

Author Topic: "Antimedian" to preserve moving subjects - RAW exercise  (Read 2282 times)

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
"Antimedian" to preserve moving subjects - RAW exercise
« on: November 12, 2022, 06:44:33 am »

I already did some RAW exercises (i.e. building a synthetic Bayer DNG file to obtain some advantages over the input files), like using the Median to eliminate moving subjects:

Eliminating vehicules in a crowded motorway:



But the Median can be used in the opposite way, to preserve all moving subjects in the scene with respect to a fixed background:



The output RAW file is available here to play with:
http://guillermoluijk.com/datosimagensonido/rawantimedian.dng

This "Antimedian" is computed by picking the farthest to the Median value on every single pixel (photosite), so the runner prevails since it can be considered an outlier in every frame vs the 11 shots burst.
Unfortunately, and although the Median was very robust against misalignments, moving subjects,..., the "Antimedian" is very sensitive to producing artifacts (including false colours) in the overlapping areas of any moving subject. The algorithm works fine anyway, but would be better applied over already demosaiced RGB files. It's a pity that Photoshop doesn't have and "antimedian" blending mode.

The complete article with online translation available:

https://www.overfitting.net/2022/11/apilado-por-antimediana-para-replicar.html

Regards
« Last Edit: November 12, 2022, 06:52:45 am by Guillermo Luijk »
Logged

jrsforums

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1290
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #1 on: November 12, 2022, 11:32:52 am »

Would be great if someone (you?) created a Photoshop plugin 😀
Logged
John

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #2 on: November 13, 2022, 04:54:50 am »

I am not a PS plugin programmer sorry.
But if there is some around here don't hesitate to ask for any help if needed.

Regards

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #3 on: November 15, 2022, 05:55:06 pm »

A lot of improvement in overlapping areas is obtained applying the statistical mode (3x3 matrix on each pixel) so that most pixels take RAW values from the same input RAW file.
Also noise is reduced (since the antimedian picks the noisiest pixels by default):

LEFT: plain antimedian, RIGHT: antimedian + 3x3 mode on fusion map:


Regards

EricV

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 270
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #4 on: November 15, 2022, 11:51:17 pm »

Could you use existing Photoshop methods to construct [sum - (n-1)*median], where n is the number of images in the stack?  That should be pretty close to an anti-median or outlier filter.
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #5 on: November 16, 2022, 07:11:18 pm »

Could you use existing Photoshop methods to construct [sum - (n-1)*median], where n is the number of images in the stack?  That should be pretty close to an anti-median or outlier filter.

Thanks Eric, I love these statistical approaches, and it works! I just used n=3 of the input RAW files for simplicity:
- Developed them identically in ACR and converted to linear sRGB in Photoshop (linear eases the coming operations)
- Put them in three layers, and applied a 1/3 curve to each of them (to prevent highlight clipping when adding later)
- Converted the three layers into one intelligent object
- Duplicate this intelligent object:
  * Apply to the lower copy: Layer -> Smart objects -> Stacking method: Median. Then add to it a *2 curve (2=n-1) -> We have the (n-1)*median term
  * Apply to the upper copy: Layer -> Smart objects -> Stacking method: Add -> We have the sum term. Set Difference blending mode to this copy.

Ta daaa!

http://guillermoluijk.com/misc/photoshop_antimedian.jpg

TIFF file with the 'sum - (n-1)*median' terms (37MB):
http://guillermoluijk.com/misc/photoshop_antimedian.tif

Regards
« Last Edit: November 17, 2022, 06:32:18 am by Guillermo Luijk »
Logged

fdisilvestro

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1860
    • Frank Disilvestro
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #6 on: November 17, 2022, 05:19:29 am »

Brilliant! thanks for sharing the file

Objeto Inteligente -> Smart Object

mcbroomf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1564
    • Mike Broomfield
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #7 on: November 17, 2022, 05:59:59 am »

I'm quite interested in this technique.  As you can see from the images below I've blended many files of the birds to create the final version.  I've been able to get away with it because the birds are pretty much in silhouette and I've been able to use the Darken blend mode with a little masking/cleanup.  This would not work if my subjects are more normally lit (like your runner).  I am using many, many layers as you can see.  (I specifically faded some of the cormorants in the rooting image)

I have a couple of questions;

"- ...converted to linear sRGB in Photoshop (linear is needed for the coming operations)"
  How do you convert to Linear?
  I would use Pro Photo rather than sRGB.  I assume that is OK

- Put them in three layers, and applied a 1/3 curve to each of them (to prevent highlight clipping when adding later)
  What do you mean by 1/3 curve?
  If this is just for highlight protection does it matter which way?  for example could I pull back on Highlights, Whites or Exposure sliders in ACR?
  If so how much protection is needed (and how would I assess it)?

  * Apply to the lower copy: Layer -> Intelligent objects -> Stacking method: Median. Then add to it a *2 curve (2=n-1) -> We have the (n-1)*median term
  What do you mean by adding an n-1 curve (2 curve)
So if I am using 50 images do I different curves for each layer?

Apply to the upper copy: Layer -> Intelligent objects -> Stacking method: Add -> We have the sum term. Set Difference blending mode to this copy.
With many more than 3 layers (say 50) do I change all 49 layers above the base layer to Add and Difference Blend mode?

Thanks

Mike


« Last Edit: November 17, 2022, 06:07:15 am by mcbroomf »
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #8 on: November 17, 2022, 06:25:34 am »

Hi Mike, sorry for being so cryptic, it was late night here. I am thinking of writing a more detailed and friendly tutorial since this technique strangely doesn't seem to have been published before.
BTW I love your birds pictures far more than my runner, would you share a series of flying birds to use it in the tutorial? I don't need the RAW files for the Photoshop procedure, and a reduced size (1280px width for instance) would be enough for teaching purposes. The only condition is all of them have been developed with exactly the same parameters (including WB).

Objeto Inteligente -> Smart Object
Thx!

Regards
« Last Edit: November 17, 2022, 06:32:52 am by Guillermo Luijk »
Logged

jrsforums

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1290
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #9 on: November 17, 2022, 11:04:20 am »

Looking forward to tutorial so I can try it…..thanks!!
Logged
John

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #10 on: November 17, 2022, 01:23:51 pm »

Looking forward to tutorial so I can try it…..thanks!!
It's slowly baking in the oven...



Regards

mcbroomf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1564
    • Mike Broomfield
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #11 on: November 17, 2022, 03:03:52 pm »

Hi Mike, sorry for being so cryptic, it was late night here. I am thinking of writing a more detailed and friendly tutorial since this technique strangely doesn't seem to have been published before.
BTW I love your birds pictures far more than my runner, would you share a series of flying birds to use it in the tutorial? I don't need the RAW files for the Photoshop procedure, and a reduced size (1280px width for instance) would be enough for teaching purposes. The only condition is all of them have been developed with exactly the same parameters (including WB).
Thx!

Regards

Thanks for your comments Guillermo.  Yes, I'll be happy to let you use some images.  I will post a link shortly to a gallery with few more and you can select which one you'd prefer then I'll put the files together.  The crow shot took a lot of masking as I was hand holding and not too steady.
Logged

mcbroomf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1564
    • Mike Broomfield
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #12 on: November 17, 2022, 03:14:21 pm »

Here's the link to the gallery
https://photos.app.goo.gl/MnFQK89A8h4ASfhP8

The 1st image is static.  I put it in there to show people the context of the cormorant's perch in the trees.  The rest have different mixes.  Some include faded birds as in the cormorant shot I posted, some are fully black.  They give different looks/feelings to the image.  I have included the blurred movement (using mean rather than median) just to give an impact of movement in the image to some of them (the birds on the wooden pilings for example) and of course in the flurry of pigeons you can't see any birds, but that would not show off your technique.

Let me know which you'd like, just post a link to the image or PM/Email me (my email is in my details).

Thanks
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #13 on: November 17, 2022, 05:42:40 pm »

Hi Mike, I think this is a good example:

https://photos.app.goo.gl/f3o9DQkKeVoekVPP7

since it both shows a bird in the different stages of flight so as some more static birds where the antimedian will have to deal with overlapping. Did you take it using a tripod, right?

I have good and bad news. The process can be done simpler than in my first try: no need for linear conversion nor the 1/N prescaling, just calculating the Median, the Mean and two easily defined curves.
The bad news is that it produces far more artifacts and transparencies/noise when seen at 100% than the RAW approach (which can even be improved more). The rescaled image looks OK because the mathematical procedure is correct:



But in real life noise and movements produce some undesirable effects:

http://guillermoluijk.com/datosimagensonido/antimedianstackingphotoshop.jpg

Regards

mcbroomf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1564
    • Mike Broomfield
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #14 on: November 17, 2022, 06:27:10 pm »

OK, I will check that file and find the source photos, tomorrow I hope.  I'll see if they were taken on a tripod.  Even if they were I used auto align to give improvement for any main tree movement.  If you find then unusable I could look to see which in the gallery is the best.

Not sure if the processing is different but I always use Raw and keep to Raw or Smart Object for as long as possible.
Logged

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
PHOTOSHOP TUTORIAL
« Reply #15 on: November 17, 2022, 07:41:05 pm »

Thanks Mike, let's check that out. An extra example in the tutorial would be great.
I just published it here:

https://www.overfitting.net/2022/11/apilado-por-antimediana-para-replicar_18.html

Find a Google Translation box top right, I think the translation is sufficiently good.

Regards
« Last Edit: November 18, 2022, 02:37:41 am by Guillermo Luijk »
Logged

NikoJorj

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1082
    • http://nikojorj.free.fr/
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #16 on: November 18, 2022, 04:15:01 am »

Wow! Great work as usual, thanks.

What would do your algorithm with the noise? Amplify it, or am I mistaken?
Stacking series of images for star trails, I've often daydreamed of an algorithm that could either choose the outlier where there is one clearly apart of the rest, eg to produce star trails, or stack the pixels in a median or sigma-clipping way where there is no clear outlier, to produce smooth sky and landscape apart from the stars. May be a bit too paradoxical (and would wash out the fainter stars)?
Logged
Nicolas from Grenoble
A small gallery

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #17 on: November 18, 2022, 05:42:45 am »

Wow! Great work as usual, thanks.

What would do your algorithm with the noise? Amplify it, or am I mistaken?
Stacking series of images for star trails, I've often daydreamed of an algorithm that could either choose the outlier where there is one clearly apart of the rest, eg to produce star trails, or stack the pixels in a median or sigma-clipping way where there is no clear outlier, to produce smooth sky and landscape apart from the stars. May be a bit too paradoxical (and would wash out the fainter stars)?
You are correct, the antimedian is an outlier detector, but when there is no outlier (runner) it becomes a noise seeker. That is why in the RAW version of the algorithm, when I did a refinement in the fusion map to pick the mode (value appearing the most) in every 3x3 pixels area, in order to reduce artifacts, a good collateral effect was that the result was less noisy. Compare left (base algorithm) vs right (improved):



The difference is not crazy but exists; look at the gray area in the second sample.

Regards
« Last Edit: November 18, 2022, 05:47:40 am by Guillermo Luijk »
Logged

mcbroomf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1564
    • Mike Broomfield
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #18 on: November 18, 2022, 05:55:56 am »

Hi Guillermo,
Files are on their way to you (I used email from your website).  A 10MB zipped file that should go through, but if not let me know.

This is what I get using Darken blend mode.  As I mentioned this works well as the cormorants and branches are all in silhouette.  I then blend this with mean files to allow faded blur for the movement on the perched birds and also on the birds in flight which I prefer.  I would use your outlier method on other images I think.  The dark blobs on the edges were branches I was shooting through.  I got rid of them on the final image rather than individual frames.  These were all shot on a tripod and have the same LR settings.
EDIT : Added the finished version with blurred mean blends

If anyone is interested there are 24 files that make up this image.  They were shot on a Sony A1, probably low or medium frame rate and they were culled from a series of 211 shots.

« Last Edit: November 18, 2022, 06:35:27 am by mcbroomf »
Logged

mcbroomf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1564
    • Mike Broomfield
Re: "Antimedian" to preserve moving subjects - RAW exercise
« Reply #19 on: November 19, 2022, 05:32:36 am »

Hi Mike, I think this is a good example:

https://photos.app.goo.gl/f3o9DQkKeVoekVPP7

since it both shows a bird in the different stages of flight so as some more static birds where the antimedian will have to deal with overlapping. Did you take it using a tripod, right?

....

Regards

Hi Guillermo,
Did the files for the image come through on your email?

Thx
Logged
Pages: [1] 2   Go Up