Author Topic: Script for deflickering and ramping ACR (.xmp) settings in Bridge  (Read 253282 times)

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7373
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #75 on: October 29, 2013, 06:52:08 AM »
Thank you!
Your script is amazing. Multiple ramping, additive setting. Together with ML and the dual-iso one can really get the timelapse workflow cooking.
Before you explained the additive method I tried exporting to jpeg and tiff, then applying ramping and shows the script works for those filetypes as well within the acr module.
Thanks

Joachim Buambeki

  • Freshman
  • **
  • Posts: 78
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #76 on: October 29, 2013, 08:45:14 AM »
Okay, now I don't really understand what you want it for. If you're going to manually edit settings for keyframes, how much more difficult is it to mark that keyframe with a star? I figured the auto keyframing thing would only be very useful if you were trying to do everything automatically, and it only makes sense for deflickering. For ramping you have to manually edit each keyframe anyway.

My idea was as following:
- Run the part (that isn't yet implemented in that way) of your script that creates keyframes (I would prefer to be able to choose the number of keyframes that are then evenly distributed instead of every n-th frame) 
- choose the 1* filter in Bridge so only the keyframes are displayed
- Ctrl+A to select all of them
- open them in ACR and adjust until it looks good
- apply deflicker if needed
- render out

The auto set keyframes would just be there for a more convenient workflow, nothing more.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #77 on: October 30, 2013, 03:00:55 AM »
Some updates:
I figured out how to do a fast resize, so I'm using that to improve speed rather than line skipping, you'll now see an 'Analysis Size' option, this is the size in pixels to shrink the longest side down to. Default is 200, you might get away with 100, it's pretty fast.

You can specify a crop for the histogram analysis. You just have to enter x,y,width,height (in percent), no way to allow you to draw it with some sort of UI, but the preview will draw the crop box so at least you can see where it is.

You specify max iterations, rather than iterations, the script wont do another iteration if it thinks it doesn't need to (the histograms are already as close as it can make them). If the script thinks there is still potential room for improvement after max iterations have been reached, it will popup a message box indicating this.

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7373
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #78 on: October 30, 2013, 06:56:09 AM »
Awesome! Gonna try this tonight

Joachim Buambeki

  • Freshman
  • **
  • Posts: 78
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #79 on: October 30, 2013, 10:00:21 AM »
Some updates:
...
You can specify a crop for the histogram analysis. You just have to enter x,y,width,height (in percent), no way to allow you to draw it with some sort of UI, but the preview will draw the crop box so at least you can see where it is.
...
Great update, would you please give me the line in the script to hardcode the folder to enable the preview? It's not 533 anymore.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #80 on: October 30, 2013, 12:09:04 PM »
Great update, would you please give me the line in the script to hardcode the folder to enable the preview? It's not 533 anymore.
Just search for "var tempFilename ="
Did hardcoding it work for you? If so I might be able to make a cross platform solution, perhaps the 'Folder.temp' property is wrong on windows. I can't actually find any documentation for that property, I just found an example of someone using it and it seems to work at least on mac.
Try this:
Code: [Select]
var tempFilename = ".PercentilePreview.jpg";
This should just put it in the current directory so we don't have to worry about / vs. \ and temp folders being wrong.

Joachim Buambeki

  • Freshman
  • **
  • Posts: 78
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #81 on: October 30, 2013, 09:25:53 PM »
Just search for "var tempFilename ="
Did hardcoding it work for you?
Didn't get to try it before. With the latest version and the modification Bridge hangs if I press the "Preview" button - before the modification it just didn't do anything if pressed.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #82 on: October 30, 2013, 09:39:31 PM »
Try it now as is, run the script from the ExtendScript Toolkit (not as a startup script), I've included some debug info, it should display the filename of the temp file in the upper right console log. Send me the output from that.

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7373
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #83 on: October 30, 2013, 09:40:47 PM »
tried your fine script again. Deflickering is really much slower now with the new algorithm.
Actually with two iterations with the older 3 line skipping it was very fast and accurate. Didn,t clock or any extensive comparisons but the former method is about five times faster. How fast would lineskipping be with crop? Preview works fine here

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #84 on: October 30, 2013, 09:56:09 PM »
Try making the preview smaller

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7373
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #85 on: October 30, 2013, 10:07:39 PM »
I have run on analyse size 100, 50, even 30 but it,s still quite slow compared to the old one. I noticed that with two iterations and the former script it gets the job done. Problem is I can,t change iteration number in the old script. The number 1 is greyed out?

old script(greyed out)

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #86 on: October 30, 2013, 10:38:09 PM »
Yeah, I didn't have it working yet. I'll look into it and see if I can figure out what's slowing it up, seemed to go pretty fast for me.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #87 on: October 30, 2013, 11:01:12 PM »
Haha, I accidentally deleted the actual resize part, no wonder it's slow. It should be fixed now. (I made that change in a sleepy stupor right before bed last night)

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7373
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #88 on: October 30, 2013, 11:18:57 PM »
lol, I,ll try again

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7373
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #89 on: October 30, 2013, 11:31:42 PM »
Quite a difference now :) Works great. Ran 3 iterations and got completetly flickerfree results. One thing. When opening preview it also opens up the software extendScript toolkit?

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #90 on: October 31, 2013, 01:52:04 AM »
I put some code to write some debug info in the console to try and track down JB's issue, I guess it automatically opens extendscript if you do that, you can just comment out any lines that start with $.writeln.  I'll take it out once we figure it out.

Joachim Buambeki

  • Freshman
  • **
  • Posts: 78
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #91 on: October 31, 2013, 02:19:46 AM »
Try it now as is, run the script from the ExtendScript Toolkit (not as a startup script), I've included some debug info...
I put some code to write some debug info in the console to try and track down JB's issue, I guess it automatically opens extendscript if you do that, you can just comment out any lines that start with $.writeln.  I'll take it out once we figure it out.
Thanks, will run some tests tomorrow. Gotta go to bed now.

Another thing:
Could you add adjustments that divide the deflickering into:
- average exposure = how much the algorithm tries to straighten out the exposure graph
- deflicker strength = how agressive the algorithm is adjusting the exposure to the average exposure

Why?
I am working on a sequence where the sky is free from any flicker but the foreground in on the other hand is flickering because of clouds (that aren't in the frame) that cast large shadows. I am now running a render where I am blending those two together in AE but I wanted to keep some of the flicker on the foreground trying to make it look similar to how the human eye with its adaptive vision would see it (if one could see in timelapse, hehe). I did that by just weakening the flicker (with commercial software) instead of trying to get rid of it totally.
Could you implement that? Feel free to come up with better names for those options.

itsskin

  • Freshman
  • **
  • Posts: 67
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #92 on: October 31, 2013, 07:39:16 AM »
Playing with cool script here. Great work. The best of all it that it accounts for adjustments made. Supercool.

But I think deflicker is not changing keyframes. And IMHO it should - otherwise deflikering is not working correctly if several keyframes are set for changing color temperature for example.

Joachim Buambeki

  • Freshman
  • **
  • Posts: 78
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #93 on: October 31, 2013, 01:55:30 PM »
But I think deflicker is not changing keyframes. And IMHO it should - otherwise deflikering is not working correctly if several keyframes are set for changing color temperature for example.
From my perspective it is working exactly as it should.
By adjusting the exposure of the keyframe and the deflickering adjust the surrounding frames to that target - if you don't touch your exposure this is your target. Just open all the keyframes in ACR and bring the exposure/brightness close to each other.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #94 on: October 31, 2013, 02:06:23 PM »
- average exposure = how much the algorithm tries to straighten out the exposure graph
In terms of the way this algorithm works, I can't make sense of what you mean by this. The algorithm simply matches where a particular percentile falls on the histogram from one frame to the next. I'm not sure what you mean by 'exposure graph'.
- deflicker strength = how agressive the algorithm is adjusting the exposure to the average exposure
I could easily implement something like this (see the 'evCoefficient' at the top of the script, simply make it smaller), but...
I am now running a render where I am blending those two together in AE but I wanted to keep some of the flicker on the foreground trying to make it look similar to how the human eye with its adaptive vision would see it (if one could see in timelapse, hehe).
If you're already making two different layers, you could just only partially blend the ground of fully deflickered footage (i.e. your layer mask makes the sky of the original 100% opaque, and the ground 50% or whatever). That should be basically the same I should think.

itsskin

  • Freshman
  • **
  • Posts: 67
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #95 on: October 31, 2013, 02:33:03 PM »
From my perspective it is working exactly as it should.
By adjusting the exposure of the keyframe and the deflickering adjust the surrounding frames to that target - if you don't touch your exposure this is your target. Just open all the keyframes in ACR and bring the exposure/brightness close to each other.

My keyframes looks like skipped in deflicker algorithm...

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #96 on: October 31, 2013, 03:13:49 PM »
My keyframes looks like skipped in deflicker algorithm...
Exactly, they're keyframes, the deflicker algorithm does not touch them, it uses them as a reference to make the images around them try to look the same. That's the whole point. When you mark a frame as a keyframe you are saying 'I want the other frames to look like this'.  The algorithm measures the specified percentile on the histogram of the keyframes, this gives a grayscale color level 0-255, for example 127. It then tries to match the histogram percentile of all the frames inbetween the keyframes to this target that is interpolated linearly (ramped) from one keyframe to the next. For example: frame 0 and 30 are keyframes. frame 0 measures the percentile at 100, frame 30 measure the percentile at 130. The script will then try to make the percentile of frame 1 at 101, frame 2 102, frame 3 103 and so on.

itsskin

  • Freshman
  • **
  • Posts: 67
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #97 on: October 31, 2013, 03:44:07 PM »
Exactly, they're keyframes, the deflicker algorithm does not touch them, it uses them as a reference to make the images around them try to look the same. That's the whole point. When you mark a frame as a keyframe you are saying 'I want the other frames to look like this'.  The algorithm measures the specified percentile on the histogram of the keyframes, this gives a grayscale color level 0-255, for example 127. It then tries to match the histogram percentile of all the frames inbetween the keyframes to this target that is interpolated linearly (ramped) from one keyframe to the next. For example: frame 0 and 30 are keyframes. frame 0 measures the percentile at 100, frame 30 measure the percentile at 130. The script will then try to make the percentile of frame 1 at 101, frame 2 102, frame 3 103 and so on.

I guess I wanted to say that I get flicker around keyframes. Anyway, I'll play a little bit more with it and report back. Thx for clarification!

itsskin

  • Freshman
  • **
  • Posts: 67
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #98 on: October 31, 2013, 05:02:28 PM »
I'm running script on sequence of 600 images and it randomly can stuck "Processing xxxxx.CR2". Both in CS6 and CC. Any ideas how to avoid this?

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7373
Re: Script for deflickering and ramping ACR (.xmp) settings in Bridge
« Reply #99 on: October 31, 2013, 05:35:20 PM »
I guess I wanted to say that I get flicker around keyframes. Anyway, I'll play a little bit more with it and report back. Thx for clarification!

I had to run the deflicker program about three times to get excellent results.