Gimp-Forum.net
Auto adjust colors so that second image colors matches - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Auto adjust colors so that second image colors matches (/Thread-Auto-adjust-colors-so-that-second-image-colors-matches)



Auto adjust colors so that second image colors matches - Grobe - 10-02-2022

Disclaimer: Before posting this thread, I realized I don't know exact to express the problem so that it give sense. I give it a shot anyway.

Situation: I have to photos that are taken by help of a tripod, delayed some seconds from each other. The point is there is a moving object so that I'll plan to put the latest photo as a layer above, make a mask and then draw the mask so that only one subject are visible. I've done similar before (same moving bike appear several times on same image).

However, there is a minor problem that occur quite often. If the camera re-adjust between the photos taken, the colors may be too different to be usable without manually tweaking. This always work but takes extra time, and I might regret afterwards (because adjusted too much or less) when it is too late and I have to do every thing over again to fix the outcome.

Here is the question. When I do have two images in Gimp, same image/motive but when the second image was taken, background/ambient light was causing the camera to re-adjust. Then, is there a method that make it possible to select a region (or whole image area) and then say that image1 should be the base, and Image2 would auto-adjust so that all the pixel colors in image2 transforms in such a way that it color-wise matches image1 as close as possible ?


RE: Auto adjust colors so that second image colors matches - Ofnuts - 10-02-2022

What I tried:
  • Pick up a "raw" picture in my collection, and load in RawTherapee
  • Output two pictures as JPEG, one with no exposure correction, and one slightly more exposed
  • Load these in Gimp as layers
  • Set the top on to "Difference" mode
  • Start Colors > Exposure and try to make the difference as dark as possible.
Doesn't work too well: I can't make the whole picture go dark, some areas brighten before other are finished darkening. Tried with Curves and I get better results (darker difference), but that requires some tweaking. I suspect that the exposure fix is distorted by the gamma correction.

Also tried to use Colors > Auto > Equalize on both pictures. This works fine from the point of view of having both image look the same, but they both look awful...

What I would try if you take the pictures "raw":
  • Looking at the EXIF you can tell exactly the exposure value (EV) of each pic, and therefore compute the difference. 
  • Your demosaicing app very likely has an exposure compensation slider with EV values, so you can correct one of the pictures
  • Possibly some auto-exposure on both images could give better results in that app than in Gimp.



RE: Auto adjust colors so that second image colors matches - zeuspaul - 10-03-2022

I would put the camera in manual mode. You don't want the camera changing settings if the lighting hasn't changed which it likely hasn't in such a short time.


RE: Auto adjust colors so that second image colors matches - Grobe - 10-03-2022

(10-03-2022, 01:40 AM)zeuspaul Wrote: I would put the camera in manual mode. . .
Yes I know this, and it doesn't solve the problem because some photos may be taken within the time frame of an once event only (manual mode forgotten or used a very user friendly camera / cell phone as source), or the images can be taken by somebody else (i.e the shot cannot be repeated ever again).

The problem lies in when I already have the image files, and I also may or may not have all exif data.

To clear up: I'm only interested in a technique within Gimp (if exist / is possible) to solve this problem. But, yes, I do use manual settings on camera when applicable, the question relates to the instances where this wasn't done for some unrelated reason.


RE: Auto adjust colors so that second image colors matches - denzjos - 10-03-2022

Try this with the two photos : https://github.com/samrocketman/home/blob/main/dotfiles/.gimp/scripts/histogram_match.scm

Channels to use : 'LAB - Preserve Luma' or 'YCbCr - Preserve luma'


RE: Auto adjust colors so that second image colors matches - Grobe - 10-04-2022

(10-03-2022, 04:20 PM)denzjos Wrote: Try this with the two photos : https://github.com/samrocketman/home/blob/main/dotfiles/.gimp/scripts/histogram_match.scm

Channels to use : 'LAB - Preserve Luma' or 'YCbCr - Preserve luma'

Yess, yess - this is perfect, exactly what I I wanted to do, thank you so very much   Big Grin  Big Grin Big Grin 

Problem solved Cool


[edit]
Is there a way to flag this post as solved? Cannot see any options for that and cannot edit first post either.