Announcement

Collapse
No announcement yet.

First steps towards a new adjustment tool

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Photoshop: First steps towards a new adjustment tool

    I decided to split this off from this thread so as to not derail it.

    I'm not an engineer, so pardon my fuzziness.

    I've got this idea in my head that if we assume a perfect gradient, then compare the tonal range of part of an image to that gradient, the differences could be portrayed as a curve.

    Then, if we did the same to a similar tonal range section of another image we'd have another curve. Then some math (I warned you, I'm not an engineer) could be done to determine what would be required to transform the second curve into the first curve. Then that math could be applied to the actual second image section and we'd have a way to adjust images based on other images.

    So then we'd have a quick, precise solution to the frequent questions such as "how do I turn a white shoe into a black shoe", not to mention skin tone.

    Lightning bolt or dead horse?
    Learn by teaching
    Take responsibility for learning

  • #2
    Re: First steps towards a new adjustment tool

    Hi Doug,

    Do you have some images to explain your idea in a more graphical way? Even if they are just sketches on photos it could probably give me better understanding of what you are thinking about.

    Thanks!

    Comment


    • #3
      Re: First steps towards a new adjustment tool

      Well, there are several fictional algorithms that would need to exist first.

      First, something to examine a selected area and sort the tones from darkest to lightest. That would be the actual thing being compared to the perfect gradient. EDIT: this might not be needed, could be an extraneous step

      Then you'd need another to determine a curve that would adjust said perfect gradient to match your newly-sorted tone gradient.

      Then ditto on the other image. So now you have two curves.

      Finally, you'd need another way to determine a curve that would transform the destination curve into the source curve. That's the curve that would actually be applied to the section of destination image.

      I did warn you of fuzziness
      Last edited by Doug Nelson; 05-03-2015, 10:20 PM.
      Learn by teaching
      Take responsibility for learning

      Comment


      • #4
        Re: First steps towards a new adjustment tool

        What is the definition of perfect gradient?

        I see three definitions:
        Black to White.
        Light intensity. in HSV or HSL, Hue is fixed and Value or Lightness increases from 0.0 to 1.0.
        Light frequency. The rainbow.. I guess this is not.

        Comment


        • #5
          Re: First steps towards a new adjustment tool

          For my mind experiment it is 0-255 gray linear RGB. But for the real application some other model might be more appropriate.
          Learn by teaching
          Take responsibility for learning

          Comment


          • #6
            Re: First steps towards a new adjustment tool

            It is possible this already exists as Gradient Domain Image Processing. Is anyone out there already familiar with this?

            EDIT: upon further googling, no this is not like GDIP, which is still very cool.
            Last edited by Doug Nelson; 05-05-2015, 03:21 AM.
            Learn by teaching
            Take responsibility for learning

            Comment


            • #7
              Re: First steps towards a new adjustment tool

              Can MATLAB (or any other software) extract the values of an image and express them as a gradient? I'm thinking any image could be represented by 3 gradients, R, G, and B.

              Some sort of input/output mapping (I used curves in my example above, but this could be too complex for a curve) could remap each of these 3 gradients into a perfect 0-255 gradient. That would be the map for the source image (or source selection).

              Repeat said splitting and remapping on your destination image.

              Then <insert math> the transformation necessary to turn the destination map (or curve, or LUT, or whatever) into the source map could then be applied to the destination image (or selection) and it would then have the tonal values represented in the source image.

              An example:
              Source image: black shoe
              Destination image: white shoe
              Extract 3 gradients from source, remap to 0-255
              Extract 3 gradients from destination, remap to 0-255
              Calculate transformation to make destination map (curve, LUT, whatever) match source map
              Apply that transformation to actual destination image

              Result: white shoe is now a black shoe!

              It's possible this might need to use Lab or some other color space instead of RGB, otherwise the result might end up being like the source being pasted over the destination.
              Learn by teaching
              Take responsibility for learning

              Comment


              • #8
                Re: First steps towards a new adjustment tool

                Hi Doug,

                I think I understand the description of the tool, and I will give it a try this week after I finish another tool I am developing now. From what I understand this is a linear transformation, and it's possible that there will be a lot of clamping (tone values lower than 0 or greater than 255, that are clamped to 0 and 255). But sounds interesting enough to give it a try.

                About GDIP, the definition is similar to the normal maps for 3d texutring, a type a image where each color represents a normal in the surface:
                Wikipedia Normal Mapping

                The seamless image cloning I think is the heal tool! I have done that before, and indeed you use the neighbor pixels to find how much a pixel should blend with the background...

                Comment


                • #9
                  Re: First steps towards a new adjustment tool

                  If my idea worked, and I realize that's a BIG if, I just had a nifty idea of how the interface could work (once all the backend math got worked out):

                  One window, with both source and destination images loaded side-by-side. You draw a line from one part of the source to the similar part in the destination. Do this several times. Maybe even with different kinds of lines. Click whatever option buttons and slide whatever sliders the math allows, and click Preview. Once you get the look you like, click Go and it makes an adjustment layer that provides the look you designed for further refinement.
                  Learn by teaching
                  Take responsibility for learning

                  Comment


                  • #10
                    Re: First steps towards a new adjustment tool

                    Originally posted by Doug Nelson View Post
                    For my mind experiment it is 0-255 gray linear RGB. But for the real application some other model might be more appropriate.
                    Originally posted by Doug Nelson View Post
                    Can MATLAB (or any other software) extract the values of an image and express them as a gradient? I'm thinking any image could be represented by 3 gradients, R, G, and B.

                    Some sort of input/output mapping (I used curves in my example above, but this could be too complex for a curve) could remap each of these 3 gradients into a perfect 0-255 gradient. That would be the map for the source image (or source selection).

                    Repeat said splitting and remapping on your destination image.

                    Then <insert math> the transformation necessary to turn the destination map (or curve, or LUT, or whatever) into the source map could then be applied to the destination image (or selection) and it would then have the tonal values represented in the source image.

                    An example:
                    Source image: black shoe
                    Destination image: white shoe
                    Extract 3 gradients from source, remap to 0-255
                    Extract 3 gradients from destination, remap to 0-255
                    Calculate transformation to make destination map (curve, LUT, whatever) match source map
                    Apply that transformation to actual destination image

                    Result: white shoe is now a black shoe!

                    It's possible this might need to use Lab or some other color space instead of RGB, otherwise the result might end up being like the source being pasted over the destination.
                    There are several approaches to this. For digestible literature you could try Gonzalez and Woods. Erik Reinhard's books are quite readable, but they focus a lot on the statistical aspects. He also deals with color transfer, which is what you're thinking of here. If you're interested in color and chromatic adaptation models, look into the work and books by noboru ohta, mark fairchild, and jan morovic. Octave works well enough as a free matlab replacement. If you attempt any difficult books, supplement them with a set of course notes. Here's an example of adifficult book. The first one I mentioned is much easier to read, but it's also pretty dry. It's from more of an engineering perspective. This one is aimed at researchers. These are straight up math texts with extremely high applicability in graphics work. If you want to attempt some of it, be smart about it. Look at coursera or opencourseware for spare course notes to provide high level summaries and details that authors might omit. Make notes for yourself as you go. Just keep a spiral bound notebook next to you while you read. Work through all examples on paper. Try to re-derive things. Try to imagine applicability. Avoid the overly bloated texts or anything that just jumps between theorems with little exposition.

                    Comment


                    • #11
                      Re: First steps towards a new adjustment tool

                      Hi Doug
                      I spent some time investigating this problem, and the best I came up with ended up being a linear transformation (think curves with just 2 points), which could convert a black shoe into a white shoe, but I doubt is what you have in mind.
                      Do you any other examples? Or maybe a graph that describes what you have in mind?

                      Comment


                      • #12
                        Re: First steps towards a new adjustment tool

                        Originally posted by pixaeiro View Post
                        Hi Doug
                        I spent some time investigating this problem, and the best I came up with ended up being a linear transformation (think curves with just 2 points).
                        Linear transformations are used in photo filtering, some adjustment tools. Whenever you convert between color profiles, that is a linear transformation. There isn't a known ideal way to map one range into another. You could employ some strategy for smoothing / relaxation of data, but that doesn't qualify it as a perfect gradient. There's also the issue that once you step away from photoshop, gradient means something completely different. When he says a perfect gradient, I think he means a gradient of constant value. It wouldn't result in what expects, but I think it's what he meant. Suppose you remapped the image to a linear rgb basis with values encoded relative to some measure of intensity. It would need some inverse mapping to be usable, but you could do this as long as you can establish a clean workflow(see scene referred color workflows). At that point you could could rescale the range per channel to match the desired end points and mean or median. In fact that has been tested and abandoned by multiple researchers before moving on to different methods. I could probably link some of the papers.

                        Comment


                        • #13
                          Re: First steps towards a new adjustment tool

                          By "perfect gradient" I meant some standard that only exists in theoretical ("perfect") space. Probably a poor choice of words, I'm a bit like Homer Simpson trying to understand living in a 3D world. It could very well end up being a cube or something only roughly imaginable in the real world. The important point is to have a fixed standard with which to compare the 2 photos against. It might very well exist in some higher bit-depth range.

                          Premiere Pro has a scope which is sort of like a histogram only instead of just distribution it also shows location. So imagine a photo being raised up by the levels (and colors) involved depending on the amount of that particular value, then looking down on that. So the dark and light spots (in the case of Premiere, but we're talking some abstract model that also shows colors) not only show you how much of a tone exists but where it is located. I'm not saying this is the best way to do this, just as an example of a theoretical analysis space.

                          The important point is we'd be comparing two images to a fixed standard, so we'd be able to extract all sorts of information about the differences from that standard, then we could compare those differences and extract the necessary math to convert from one to the other.
                          Learn by teaching
                          Take responsibility for learning

                          Comment


                          • #14
                            Re: First steps towards a new adjustment tool

                            I'm not sure why you mentioned Premiere. The feature you described is more common in applications aimed at editing video. It just gives you the equivalent of a histogram for each segment of a given image. It tends to provide somewhat more context, especially in scenes with variable lighting, but it still requires some interpretation.

                            Regarding geometric forms that aren't limited to 3 dimensions, hypersurfaces are a confusing topic, but they do come up in computer graphics. A lot of the stuff you mention is currently implemented in some way or an area of active research. For example computing differences between two things with respect to a given standard is currently done either via lookup table or linear transformation. ICC profiles actually use the latter. When you convert between them, the lookup is always with respect to a given profile connection space. If you wanted to remap one range of values to another based on measured values, you're back to an area of active research (and I can post many links). Also let me know if you want any crash course reading. I'm an obsessive reader.

                            Comment


                            • #15
                              Re: First steps towards a new adjustment tool

                              Originally posted by klev
                              I could probably link some of the papers.
                              That would be awesome! Thanks!

                              Comment

                              Related Topics

                              Collapse

                              • frankg
                                Sampling & applying col from a photo to another
                                by frankg
                                If I have a photo with a skin col & density that I am very happy with and want to apply the same to another image, rather than going to Image>Adjustment>Match Color can I use the Col Sampler Tool & click on the face I like with the Info palette open & read the RGB &/or CMYK values....
                                12-10-2012, 12:59 PM
                              • mayday
                                Gradient maps different uses and techniques?
                                by mayday
                                Gradient maps have many different uses and I think its probably one of the most versatile tools in photoshop.

                                Heres a few of they ways I use them.

                                You can use them to change and shift colour dramatically with precise control over the colours that you want to use.
                                ...
                                04-07-2008, 08:58 AM
                              • atholg
                                Gradient maps
                                by atholg
                                I have been restoring images for OPR for some time. My efforts at replacing damaged color leave something to be desired, particularly when the area is high contrast and there have to be subtle hue and saturation variations to achieve a natural result.

                                A search located http://www.reto...
                                07-18-2010, 07:27 PM
                              • caroled
                                curves + gradient
                                by caroled
                                I recieved this advise

                                Since I am working with Elements 2 + hidden power toola would like to know if this is possible / and how to do it... My image is in forum Help request... Poley family 1906...

                                Thanks

                                Carol...
                                01-22-2004, 12:11 PM
                              • groovigyrl
                                Gradient Map
                                by groovigyrl
                                Hi all,

                                I'm experimenting with the gradient map and haven't been able to get too far with it. Argh. When I add the new adjustment layer for gradient map, my image switches to infrared (it looks like a film negative). It doesn't give me the box with the slide bar gradient that should automatically...
                                10-14-2011, 08:57 PM
                              Working...
                              X