ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Looking to subtract between two images & add the difference to another

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Michael Morgenstern
Looking to subtract between two images & add the difference to another
on Feb 16, 2014 at 7:17:47 pm

Hi all,

I have some footage that has a strange banding effect -- wide bands of light and dark very slowly moving up the image. It's regular and consistent, and there is a part of the image that doesn't move at all, so I would like to freeze frame that part, grab the difference between the freeze frame and the current frame, and then apply that difference, inverted, back to the image.

I'm playing with blend modes and precomps, but the issue is that things like the subtract mode clip values and don't act perfectly. Is there a plugin that lets me do arithmetic blending of images?

Here are some screenshots of my project:

The original image:
https://www.dropbox.com/s/xscr4qeaiumhln2/Screenshot%202014-02-16%2014.13.0...

A precomp, with the unmoving section cropped out (and a blur):
https://www.dropbox.com/s/pu87vnnzzic5057/Screenshot%202014-02-16%2014.14.1...

The freeze frame applied over the precomp, blending mode set to subtract, and another blur applied. I've used the Levels effect to expand it and see the difference -- in reality, the values are around 1% brightness
https://www.dropbox.com/s/st2t5ietjdrfe2z/Screenshot%202014-02-16%2014.16.4...

A split-screen of the extended precomp on top of the image:
https://www.dropbox.com/s/qdh81bbbunvsg8j/Screenshot%202014-02-16%2014.17.1...

Thanks all!
Michael


Return to posts index

Walter Soyka
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 2:10:44 am

[Michael Morgenstern] "I have some footage that has a strange banding effect -- wide bands of light and dark very slowly moving up the image. It's regular and consistent, and there is a part of the image that doesn't move at all, so I would like to freeze frame that part, grab the difference between the freeze frame and the current frame, and then apply that difference, inverted, back to the image. I'm playing with blend modes and precomps, but the issue is that things like the subtract mode clip values and don't act perfectly. Is there a plugin that lets me do arithmetic blending of images?"

Subtract mode will not clip values in 32bpc (they will go negative), but inversion by definition always expects input in a 0-1 range -- invert(a) = (1-a) doesn't make sense when a is less than 0 or greater than 1 -- so you'll run into trouble there.

Can you build an adjustment layer manually that corrects the bands, then animate it to match the footage?

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events


Return to posts index

Michael Morgenstern
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 3:57:21 am

I've tried to do that a few times and it hasn't been great. The shift is so subtle that I don't really have something to go off of, and since I have the adjustment layer in there already I'd much rather figure out how to make that one work.

I was also thinking of using some plugin that allows me to directly do arithmetic on the layers: for example, mapping the difference values to center around 0.5.


Return to posts index


Darby Edelen
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 6:20:15 am
Last Edited By Darby Edelen on Feb 17, 2014 at 6:43:06 am

Invert shouldn't clip values if the project is set to 32bpc.

I've removed my previous answer as it was posted before I could view the images. For the record many corporate environments block Dropbox and the COW does have its own photo embedding feature :)

Now that I've looked at the shot I'm still concerned that you may not be able to solve it with the method you're suggesting but if you'd like to give it a whirl anyway you should definitely set the project depth to 32bpc. Then you'll essentially do what you're doing now:

The clean area's current frame gets subtracted from the clean frame, that value is spread out horizontally to cover the frame and then added back into the whole frame.

The concerns I have with this are:

1) The blur required to remove high frequency noise is going to cause trouble along the edges, likely solvable with the right radius blur

2) the band is likely raising/lowering color values in a non-uniform manner across the frame. My guess is that this may have been caused by one of the lights being a fluorescent that was out of phase with the camera. In that case the dark areas are areas during the exposure of the frame in which the light was "off." Since lights are not uniformly bright and also cast shadows I'd be concerned that the variation in values in the bands are not uniform. That said: I may be over thinking this and everything might work out just fine with the described method :)

I've used the temporal filtering feature from this plug-in in the past to repair issues like the one you describe:

http://revisionfx.com/products/denoise/

In addition, there's this one from the same folks:

http://revisionfx.com/products/deflicker/

I haven't used it. It's advertised primarily for high frame rate or time lapse footage but the problem it's solving is essentially the same.

Darby Edelen


Return to posts index

Michael Morgenstern
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 6:27:45 am

Perhaps I explained this incompletely. What I want to do is take a small segment of the image, which doesn't move, and getting the difference between that and the freeze frame. Then I will blur that difference, expand it horizontally so that it covers the whole image, and invert it / subtract it from the video footage.

Yes, the small section of the image this diff layer was taken from will be adjusted to be close to the image, but with the blur, the adjustment will not be perfect -- it will just be a broad brighten/darken to even out the tones of the image. And the rest of the frame would be affected too.

So:
F = a pixel from the freeze frame
A = a pixel from the video
X = stretch(blur(F-A))

And I'm looking to get A+X
or A+stretch(blur(F-A))


Return to posts index

Darby Edelen
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 7:27:21 am

I think I was editing my last response when you responded. Hopefully that one is more helpful now :)

Darby Edelen


Return to posts index


Michael Morgenstern
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 4:05:41 pm

Thanks Darby! Even if there is a bit of a color shift, I know (hope) I can get rid of the greyscale shift... Also, as you can see the difference layer is colored so I'm hoping that will affect the cast.

I'll check out your links! Question on one thing you said, though: "do essentially do what you're doing now"

What am I doing now? I've researched Subtract, Difference, etc, and it's not clear to me exactly what operations I should be doing. Subtract (F-A) -> Blur&Stretch -> Invert -> ?? to the original source?

Thank you!


Return to posts index

Darby Edelen
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 5:07:02 pm

No need to invert depending on your order of operations. If the still area on the clean frame is A, the same area on the current frame is B and the entire current frame is C:

C + stretch(A - B)

If you need to blur I'd do it where you suggest.

Again, this will need to be done in 32bpc.

Darby Edelen


Return to posts index

Chris Wright
Re: Looking to subtract between two images & add the difference to another
on Feb 17, 2014 at 7:23:36 pm
Last Edited By Chris Wright on Feb 17, 2014 at 8:49:08 pm

if it was stationary objects or even slight camera movement, it would be hard but not impossible, but...

i don't think a temporal filter or timeremap/difference matte will work because there's actors in the scene and they will move about and each frame will be completely different than the previous frame. (i.e. its impossible to create a clean matte)

I just don't think this is savable. at, least quality-wise.

saying all that, here comes the partial solution:
solution 1:

your only hope is a motion tracked mask of the actual bars moving around, then they themselves can be deflickered or color corrected back into the scene with nice opacity and feathers.

solution 2:

solution 1 has failed and you are out of options. precomp your video, timewarp 50% the precomp, then timestretch the same amount. The video will have the same duration but it will create intermediate frames essentially slowing down the moving boxes to such a crawl, that they become unnoticable.



if you have 15 frames you wouldn't mind uploading, I'd be more than happy to take a stab at it.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]