Generating a Colour Image

Moderator: jsachs

Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Generating a Colour Image

Post by Marpel »

I have a 16bit greyscale image of a single solid tone (let's say exactly middle grey) open.
I generate a new image.
I click the "background colour" box to open the colour picker window.
Using the eyedropper, I click in the, already opened, image and the arrows move along the Value slider.
Without clicking on the eyedropper again, I click somewhere in the field of the Colour Picker. The arrows remain stationary on the Value slider, but a related colour is identified.
I click OK to generate a new solid colour image.
However, if I then convert this image to 16bit black and white, it does not match the initial black and white image.

I am confused, if the value of both the initial black and white and the newly generated colour image have the same value, why would they not be exactly the same in black and white.

What I am trying to do is generate solid colour images, whose tone values are a match to some solid tone black and white images, and I presumed the above process would do that. Or am I way out in space on this?

Can anyone help?

Thanks,

Marv
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Generating a Colour Image

Post by jsachs »

First, the color picker only selects 8-bit colors so sampling a 16-bit image is only approximate. The difference between 8-bit and 16-bit grays is pretty much invisible in any case since displays and printers are all 8-bit.

Second, the default conversion from color to black and white used by the Convert transformation is to extract the luminance channel which is different from the HSV value channel used by the color picker.

The problem with what you are trying to do is that there are many definitions of tone for color images - luminance, HSV value, HSL value, and many others that have been invented over the years. The method you are using with the color picker is giving you a color with approximately the same HSV value as the gray patch. Offhand, I can't think of any easy way to select a color with a given luminance -- you could not use a standard color picker to do this since many of the colors in the color wheel cannot be rendered at a high luminance value and would thus lie outside the RGB color space. For example, pure blue has a luminance of only about 10% which is why it looks so much darker than pure green which has a luminance of about 60%. Only pure white has a luminance of 100%. Luminance is however the most accurate definition of tone for colors as it takes into account the relative sensitivity of the eye to different colors.
Jonathan Sachs
Digital Light & Color
Dieter Mayr
Posts: 453
Joined: April 24th, 2009, 11:47 am
What is the make/model of your primary camera?: Nikon D700
Location: Salzburg / Austria

Re: Generating a Colour Image

Post by Dieter Mayr »

Jonathan,

would it be theoretically possible to create the colour Marv is looking for by combining the Luminance channel of the grey patch with the a*b channels from the colour patch ? (L*a*b combining is not possible now in PWP, thats why theoretically).
Im not 100% sure if the Extract Channel - Luminance channel is exactly the same as L in L*a*b but i think this should be a practical way.
Would need some other software that is able to combine 3 greyscales to a L*a*b* colour image, though.
Dieter Mayr
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Generating a Colour Image

Post by jsachs »

The L in Lab is just luminance so you have the same problem I described above, namely that most of the colors you can specify in Lab are impossible to realize. For example, if L = 100%, a and b can only be zero, and if a and b specify pure blue then L cannot be more than about 10%.
Jonathan Sachs
Digital Light & Color
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Generating a Colour Image

Post by jsachs »

Here is a color sequence I computed using a spreadsheet which is calculated to have even steps in luminance. There are many other possible sequences but they all need to start with black and end with white to cover the full luminance range.
Luminance Series.jpg
Luminance Series.jpg (3.14 KiB) Viewed 9480 times
Jonathan Sachs
Digital Light & Color
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Generating a Colour Image

Post by jsachs »

Here are a couple more with different color schemes but the same luminance gradient.
Luminance Series 2.jpg
Luminance Series 2.jpg (2.73 KiB) Viewed 9461 times
Luminance Series 3.jpg
Luminance Series 3.jpg (2.3 KiB) Viewed 9463 times
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Generating a Colour Image

Post by Marpel »

Thanks Jonathan and Dieter for your responses. It seems like my task is a bit more difficult than first thought.

However, Jonathan, your stepped colour sequences that you included in your replies have given me an idea that I wish to try.

Presumably, if one was to convert those sequences to a 16 bit black and white, they would not exactly match the corresponding step of a sequence that is black and white (made from grey scale rather than colour as in your examples), but each step may more closely match a step that is one up or down in tone of the black and white sequence (i.e. if placed side by side).

So, is there an easy way to generate these colour sequence schemes so I may make them then convert to 16 bit b and w and compare the various steps to see if I could more easily get a closer match without the use of the colour picker? (Hope I explained this clearly as I just now thought of this possible solution).

Thanks,

Marv
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Generating a Colour Image

Post by jsachs »

If you convert the sequences I uploaded to 8-bit gray, they would very closely match a step wedge with even steps in brightness. If you convert to 16-bit, there will be small deviations, but they would be invisible to the naked eye.

Luminance is only an approximation as there is a limit to how accurately once can measure the eye's relative sensitivity to different colors. PWP uses the following formula for luminance: L = 0.30*R + .59*G + .11*B, so for a desired luminance value, L, if you supply values for any two channels of (R, G, B) you can solve for the third one. The catch is that the resulting value must be between 0 and 256 (or between 0 and 65535 for 16-bits). For example, in 8 bits, if you want to create a color with a luminance of 128, and you want R to be 32 and G to be 100, then you can calculate B as (L - .30*R - .59*G)/0.11 = (128 - .30*32 - .59*100)/0.11 = 540. Since this is greater than 255, there is no solution with the specified inputs as there is no way to set the blue channel to more than 100%. If you wanted the luminance to be 80, however, then you get a value for B of roughly 104 which is legal. This means that only certain ranges of colors can be used to create each luminance level. Generally you are less likely to run into trouble if you use blues for the dark colors, reds for the midtones and greens for the bright colors. Luminance 0 is always black (R = G = B = 0) and max luminance is always white (R = G = B = 255).

I can't really imagine an application where you would need 16-bits for this as the result will be visually indistinguishable from 8-bits, but maybe you can be more specific about what you are trying to do and I could suggest an approach.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Generating a Colour Image

Post by Marpel »

Jonathan,

Sorry for the delay in responding, but I have been away from my computer for awhile.

Here is what I am trying to do that sparked my initial post: I have a greyscale image comprised of a number (16 in this example) of squares of different tones/densities. I need to generate a same-sized 16 square colour image where each colour square is a tone match with the corresponding square in the greyscale image. During my initial attempt I converted the colour square to 16 bit greyscale to confirm it matched the corresponding grey square. However, when I clicked back and forth on each square (using the new image dialogue) the pointer on the slider jumped quite a bit, suggesting the two squares did not match as close as I had expected. I have tried using the greyscale image (or an 8 bit version) as a mask and trying various blending modes with no success. The added issue I am facing is the colour image will be comprised of not only different densities but different hues.

I am (hopefully) attaching the greyscale image to give you an idea of what I am talking about(actually I failed in uploading the image as I tried an 800 pixel image rather than 600 - I will have to resize and send in another post).

Thanks,

Marv
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Generating a Colour Image

Post by Marpel »

The image as discussed.
Attachments
4-x-4-square.jpg
4-x-4-square.jpg (18 KiB) Viewed 9197 times
Post Reply