8
$\begingroup$

Trichoplax question aroused my curiosity and the answers in this question also reminded me why I sometimes use different gamma "amounts" to enhance images.

Therefore, is it possible to determine the amount of gamma applied to an image by knowing its source (the original image)? I.e. can the mathematical formula be applied to compare two images and determine the difference in gamma "amount"?

Example: which of the following have a different gamma amount (I'll give you a non-edible cookie if you find out, and sorry trichoplax for snatching your ball):

t_1t_2t_3t_4

$\endgroup$
4
  • $\begingroup$ Do you mean you have both the pre and post gamma images and you want to find the gamma applied? $\endgroup$
    – cifz
    Commented Aug 6, 2015 at 13:55
  • $\begingroup$ @cifz Yes, the original image is from trichoplax's profile. $\endgroup$
    – Armfoot
    Commented Aug 6, 2015 at 13:56
  • 1
    $\begingroup$ I don't know for certain that the CC BY-SA 3.0 licence applies to profile images, but I operate under the assumption that anything that I use as an avatar is automatically licensed that way, and in any case I'm very happy for the image to be reused :) $\endgroup$ Commented Aug 6, 2015 at 18:26
  • 1
    $\begingroup$ Meta Stack Exchange suggests that profile images are also CC BY-SA 3.0 so as long as you give credit you should be OK using anyone's avatar (provided they complied with the requirement to not post works they don't have the right to...). $\endgroup$ Commented Aug 6, 2015 at 18:42

1 Answer 1

6
$\begingroup$

If I get correctly what you are asking you basically just need to find the G in this equation:

$$Image_{out} = Image_{in}^G$$

This could be easily solved as

$$G = \frac{\log{Image_{out}}}{\log{Image_{in}}}$$

Because usually gamma is applied in a uniform fashion on the image, you can just pick any two non zero pixel values (one for source and one for destination) to find out the gamma value applied.

EDIT: As @ChristianRau pointed out, if you don't actually know if the image has been modified with gamma correction, you have to take an higher amount of samples and trying to fit a gamma function on those. If a fit to a gamma function results in too many significant outliers, then probably gamma correction wasn't the function applied.

$\endgroup$
4
  • 3
    $\begingroup$ Though, I think part of his problem as posed in the question is also that he might not know if it is gamma corrected in any way at all or if the colors were not otherwise (linearly or whatever) modified in contrast to mere gamma correction. But ok, in this case you just take a bigger sample size and try to see if it can be approximated sufficiently well with a gamma transformation. $\endgroup$ Commented Aug 6, 2015 at 14:07
  • $\begingroup$ Exactly @ChristianRau, ideally it is to determine the difference even when other color transformations were applied. Thanks cifz, so if you sample several of each image's pixels and the resulting G is approximately 1, then we can conclude that no gamma correction was made? $\endgroup$
    – Armfoot
    Commented Aug 6, 2015 at 14:27
  • $\begingroup$ If also the other transformations are unknown, then to my limited knowledge I don't know how and if you can find the gamma. Intuitively I'd say you can't $\endgroup$
    – cifz
    Commented Aug 6, 2015 at 14:35
  • 1
    $\begingroup$ As @ChristianRau correctly said, you can try and fit the combination of transformations into a gamma function, but that will not tell you what gamma was applied on top of the other unknown transform, but rather an gamma that once applied to the source will give you roughly your destination $\endgroup$
    – cifz
    Commented Aug 6, 2015 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.