Page 1 of 1

Batch exposure compensation

Posted: 2019-03-06T18:10:09-07:00
by jeffry7
Hi folks,

I have a stack of photos of the moon that have some different exposure. There are 693 of them. During the time I took them I changed the exposure time setting. This was a novice mistake. In any case I am trying to salvage the most pics I can by correcting the exposure of the frames.

I tried using rawtheerapee and correcting by the number of stops different the shots were made in. But this had uneven results. The exposure looks different to the eye, and also shows on the histogram.

This seems like something I could automate via imagemagick, but am unsure how.

One idea I had was to do the first image by hand and then write code to adjust the compensation of the remaining so that the histogram matched as much as possible. I would need someway to compare histograms, but possibly just subtracting one from another and adding the resulting array would be good enough. As for what to change, that would be the white and black points.

Thinking about this though makes it clear that this is a lot of trouble for one stack and there is probably and easier way.

Any pointers on how to make my stack have similar exposures would be appreciated. Thanks!

Re: Batch exposure compensation

Posted: 2019-03-06T18:43:05-07:00
by fmw42
What is your IM version and platform? Coding and syntax is different.

On Unix, I have a script called matchimage that matches according to brightness and contrast (mean and standard deviation). See my link below. User snibgo has a similar script for Windows. See http://im.snibgo.com/gainbias.htm.

I also have one that will do histogram matching (see histmatch). I believe that snigbo has a processing module at http://im.snibgo.com/customim.htm#matchhist for that.

Re: Batch exposure compensation

Posted: 2019-03-07T05:35:27-07:00
by snibgo
I assume your exposures haven't burnt-out, and that your camera has a linear sensor.

Histogram matching is more complex than you need for simple exposure correction, which needs only a multiplier to be applied to all three channels.

If your photos have the same amount of moon and background, then the overall mean of each image tells you the factor for multiplication.

You can do the multiplication in linear RGB or non-linear sRGB to get virtually identical results, but these will need different factors.

Re: Batch exposure compensation

Posted: 2019-03-07T19:29:36-07:00
by jeffry7
fmw42 wrote: 2019-03-06T18:43:05-07:00 What is your IM version and platform? Coding and syntax is different.

On Unix, I have a script called matchimage that matches according to brightness and contrast (mean and standard deviation). See my link below. User snibgo has a similar script for Windows. See http://im.snibgo.com/gainbias.htm.

I also have one that will do histogram matching (see histmatch). I believe that snigbo has a processing module at http://im.snibgo.com/customim.htm#matchhist for that.
Doing "convert --version" gives me 6.9.7-4
This is on Linux

Thanks! I will check these out.

Re: Batch exposure compensation

Posted: 2019-03-07T19:40:08-07:00
by jeffry7
snibgo wrote: 2019-03-07T05:35:27-07:00 I assume your exposures haven't burnt-out, and that your camera has a linear sensor.

Histogram matching is more complex than you need for simple exposure correction, which needs only a multiplier to be applied to all three channels.

If your photos have the same amount of moon and background, then the overall mean of each image tells you the factor for multiplication.

You can do the multiplication in linear RGB or non-linear sRGB to get virtually identical results, but these will need different factors.
The exposure are not clipped. The camera is a Canon DSLR (550d).

So the mean can be used as a exposure value of a given photo and if between two photos of the same subject and framing one has half the mean of the other, then it should be a stop darker?

In which case I would multiply the values in the second picture by two to get matched exposures?

Re: Batch exposure compensation

Posted: 2019-03-07T21:46:12-07:00
by jeffry7
jeffry7 wrote: 2019-03-07T19:40:08-07:00
snibgo wrote: 2019-03-07T05:35:27-07:00 I assume your exposures haven't burnt-out, and that your camera has a linear sensor.

Histogram matching is more complex than you need for simple exposure correction, which needs only a multiplier to be applied to all three channels.

If your photos have the same amount of moon and background, then the overall mean of each image tells you the factor for multiplication.

You can do the multiplication in linear RGB or non-linear sRGB to get virtually identical results, but these will need different factors.
The exposure are not clipped. The camera is a Canon DSLR (550d).

So the mean can be used as a exposure value of a given photo and if between two photos of the same subject and framing one has half the mean of the other, then it should be a stop darker?

In which case I would multiply the values in the second picture by two to get matched exposures?
dOh!

I was overthinking, or not thinking. If A has the desired exposure and B has the exposure to correct, then mean(A)/mean(B) gives you the value to multiply B by to get the correction. I tried this and the histograms look much closer.

Thanks!

Re: Batch exposure compensation

Posted: 2019-03-08T06:13:54-07:00
by snibgo
Yes, that's it. The goal is to get the means to be the same, so the ratio of the means is the factor for multiplication.

This is only if the moon is fully visible on each frame, at the same size. If that's not true, the goal would be to make the mean of some feature on the moon to be the same in each frame.

If your images are linear RGB, then each doubling is a photographic stop.

If your images are non-linear sRGB, then each multiplier of 1.3704 is a photographic stop. (More or less, because sRGB isn't exactly a power curve.)

However, after taking the photo, I rarely think in terms of photographic stops. The concept isn't useful.