Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Match altered image to its original
#1
Objective is to match an image altered by an uncontrollable process, to a variant which will, when run through that same process, appear the same as in its original, unprocessed form.

I have reviewed numerous posts, tutorials, etc., but remain stumped.
  1. I have no control over that process/processor, which let's say imparts a "ghost image" of whatever runs through it.
  2. I must run through that process/processor, and cannot side-step it.
  3. My hunch is it has something to do with legacy engineering, such as conversion from 24-bit to 16-bit color, or along those lines.
Attached is '1 Hall Original.png', which is the intended appearance to the user.

Attached '2 Hall Ghosted.png' indicates the "ghosting" which is beyond my control.

I seek to create an image, 'Hall Original - Prepped for Ghosting', which will come out the other end appearing identical to the pre-processed original.

Attached '9 Image A - Gray of RGBs 119 on L, Ghosted to RGBs 137 on R' was successfully addressed by setting Image A to Brightness -34 [resulting in RGBs of 103].  Post-process, it measures all 119s.

However, the ghost processor is provably not simply linear, across all channels, as seen in the more complex Hall image, as it is not similarly remedied by simply a Brightness reduction.  (If twiddling only Brightness, approximate matches are: Stage -6, Back wall -12, Center red carpet -33.)

I am aware of Color Curves, Channels, and such, but fully inexpert in their application.

[Disclaimer: I'm aware of spatial distortions regarding slight scaling/proportionality differences in the examples.  That is easily remedied by a more careful workflow that shall be employed.  Not to worry.]

.....  I see I hit the 5-file Upload Limit.  Shall send specimens 6 - 9 in followup to this Post .....

Prompt replies would be most gratefully welcomed.

Thanks,

BR

Find here attached, specimens 6 - 9 mentioned in my original Post.

– BR


Attached Files Thumbnail(s)
                                   
Reply
#2
Looks like jpeg compression artefacts to me. Does export as jpeg feature in your original workflow ?

Edit: maybe not jpeg compression, maybe some smoothing ? I can see parts of after version have vanished.  
 I did try a before-after CLUT using the gmic plugin without success.
Reply
#3
If (and only if) the process is altering the pixels individually (ie, not using data from adjacent pixels like it's done when sharpening), then you can feed the process an image with 16 mega-pixels, each pixel being a different RGB triplet, and the output will be a "CLUT" (Color Lookup Table). In the general case, all you can then do is invert the CLUT, Note that you can discover than some input RGB values produce the same RGB output (in particular if the process clips a channel) and that some RGB output values cannot be achieved (because there is always some color loss in such processes).

Then, if you are lucky you can discover that the mapping of the R (or G or B) values to output values doesn't depend on the other channels on the same pixel (ie, a Red 200 becomes a Red 220, whether it is in a light gray (200,200,200), strong red (200,0,0), yellow (200,200,0) . In which case you can indeed use Curves to obtain a per-channel mapping.

If you aren't, then you can see if the same would be true in the HSV, HSL, LCH, or Lab models and perhaps be able to emulate the same thing with Gimp.

But in any case, if you want an accurate result, you won't be using Gimp alone, you will need some data exploration tools.
Reply
#4
Wonderful to hear from both of you, familiar names.  And so promptly.  (My email notification was lagging.)

I have been trying to upload an attachment image, '10 Original JPEG converted to '1 Hall Original' PNG', as to Rich2005's question.  It's a jpeg of size <500K, so go figure.  Have tried more than one browser.  I'm geting:

Bad Request
Your browser sent a request that this server could not understand.

– – –

I'll keep at it.

Separately, perhaps I ought to upload the previous specimens in their .xcf form.  I'll have to knock down their sizes.  Ofnuts - would those shed light on the LUTs?

I know it comes up, here –– any suggestion of an outside-the-forum upload repository, to make sharing examples easier ?
Reply
#5
(10-30-2021, 08:12 PM)Brian.Raila Wrote: I know it comes up, here –– any suggestion of an outside-the-forum upload repository, to make sharing examples easier ?

No real preferences, I was using wetransfer but they now ask for an email even to get just a link,
imgur start to block some countries from 2 weeks or so, like the country I am actually living in, so I would not recommend it, and it become even worse as from few days now, they also start to block the different free proxies I was using recently to see screenshots on GF (thus I can't see anymore @rich2005's videos Cry )

I did found (and test) those 2, which don't trade your upload with your email

https://www.filedropper.com/ up to 5GB
https://transfer.sh/ ?10GB
Reply
#6
The original JPEG, along with the full set of previous attachments, as well as the XCFs from which they were exported, are available to all at this link.

Hoping to gain some competence in this realm.

Many thanks,
BR
Reply
#7
Probably not possible with those  images (nothing is ever definite) I can get a better match with the main areas of colour but the 'fringe' 'ghosted' (would be antialiased) pixels defeats the plugins.

1. Look Up Table: The gmic plugin http://www.gmic.eu has two filters CLUT from before-after and Apply external CLUT  Make a difference CLUT and apply to one to hopefully get back to the other. 

   

The attached .xcf has 3 layers to compare the clut applied - 1.orig - 2 ghosted

2. Color curve matching: 2 plugins a compiled plugin http://elsamuko.github.io/gimp-elsamuko/...get-curves  and a python plugin https://www.gimplearn.net/viewtopic.php/...f=3&t=1447 both get sort of a color match 2-ghosted.png is lighter that 1. png and gives the darker colours.  The split view not so easy to see the difference but it is there.

elsamuko
   

gimplearn
   


One problem is, these plugins sample 8 bit images and the curve is an approximation.

A couple of odd things about the images Wink the embedded 'gimp sRGB' profiles and The original jpg is a different scale to the cropped pngs.


Attached Files
.xcf   1-clut-2.xcf (Size: 93.5 KB / Downloads: 140)
Reply
#8
If you look at the histograms of the before/after pictures, you find in both the same bumps in the color channels, with roughly the same shapes.

So you can match the bump between the two, and with the histogram you can find the value of the bumps (using the little handles at the bottom). For instance, in the Red channel the three bumps at 82, 207, 243 are matched by three bumps at 100, 217, 246.

   

So if you want to compensate for the shift in the process, you change the colors of your input image to have the colors that will give them their initial color after your processing. For instance, a Red channel at 100 in the input image, should be darkened to 82 so that the process puts it back to 100. In other words, you use Curves where the inputs are the values in the "after" image and the outputs are the values in the before image.

In the Curves tool, this means selecting the red channel, clicking on the diagonal, and dragging to put your point at Input=100,Output=82. This creates a smooth curve with its ends still in the corners at (0,0) and (255,255)). By a total coincidence, the points at (217,207) and (246,243) are on that curve. If you do the same for Blue, you'll find the same coincidence (start with the value closest to middle)

   

Caveats:
  • The accuracy of the technique depends on the sharpness of the bumps.
  • In most case you can set a channe Curves with a single point, the other points are mostly use for sanity checks
  • You are going to lose colors, and create artifacts such as banding. In fact the surprising thing in the "after" image is that its histogram isn't exhibiting any hint of "haircomb", but since the image doesn't exactly overlap the original the necessary pixel interpolation has blended the colors again.
Reply
#9
This is wonderful, fellows !

As to your correctly noted "different scales", and "total coincidence", and absence of "hair combing" – 
  1. Scales differed from hastily slapping together the specimens; here corrected.
  2. If I'm not mistaken, the total coincidence may be explained by the fact that both specimens are spatially coincident.  That is to say, the "Ghost Processor" [happy Hallowe'en] leaves each pixel sitting exactly where it was, and always acts its mischief [yet to be precisely defined] the same way, on each channel ?  I've observed the effect on numerous images.  No matter what the subject [landscape, living room, child at play, electron micrograph, human MRI, flower bouquet], my initial assumption was always, "Oh, that there looks like it was overexposed by one F-stop."  Hence my initial stab at simply knocking down the brightness.
To those ends [Note to PixLab – I utilized Google Drive], I have added to The Upload Repository:
  • 10 Forum - Registration Checker 423.72 x 199.04 pt.tiff
  • 10 Forum - GHOSTED Registration Checker 423.72 x 199.04 pt.tiff
I can't wait to see what you add to this here Trick or Treat bag.

– – –

In the meantime, I'll be examining your replies in detail, and upping my Gimp Game [histogram analysis, channel manipulation, multi-window views, etc.]
Reply
#10
This is very odd. There are 32 regularly spaced (step=8) peaks in the output histogram (that are the same on all channels). IS the image quantized in the process? If so, forget it, no way you are going to get a proper image after compensation. That would be a bit like transforming a cow so that it eventually comes out alive from the meat grinder.

   
Reply


Forum Jump: