http://www.brucelindbloom.com/
不買教科書…
用這個網站上課~~
今日上課內容~~
% [X Y Z]–>[x y z]
disp(‘Tristimus values of color sample=’)
tri=[50 60 70;60 70 80]
sum=tri(:,1)+tri(:,2)+tri(:,3);
x=tri(:,1)/sum;
y=tri(:,2)/sum;
z=tri(:,3)/sum;
Y=tri(:,2);
disp(‘(x,y,Y) value=’)
%color1=[x y z]
%color2=[x y Y]
[x y Y]
%x+y+z
——————————————————————————————————————————————————————-
XYZ to xyY
Given an XYZ color whose components are in the nominal range [0.0, 1.0]:
Implementation Notes:
- Watch out for black, where X = Y = Z = 0. In that case, you may want to set x and y to the chromaticity coordinates of your reference white.
- The output Y value is in the nominal range [0.0, 1.0].
vascript:window.scroll(0,0)”>Top of Page | E-mail: [email protected] |
Revised Sun, 20 Apr 2003 04:07:11 UTC | URL: http://www.brucelindbloom.com |
All material on this web site is Copyright © 2001 – 2007 Bruce Justin Lindbloom. All Rights Reserved. |
XYZ的範圍在0~1之間
黑色不適用…
components = 成分
——————————————————————————————————————————————————————-
翻譯此篇~~
RGB Reference Images
In the interest of digital imaging research, I am providing a set of four images that represent “perfect” images, that is, they represent a natural scene (as opposed to say, a test pattern or a gradient) which is completely void of any noise, aliasing or other image artifacts. They were taken with a virtual, six mega-pixel camera using a ray tracing program I wrote myself. The intensity of each pixel was computed in double precision floating point and then companded and quantized to 8- or 16-bits per channel at the last possible moment before writing the image file. The four variations represent all combinations of 8- or 16-bits per channel and gamma of 1.0 or 2.2. I believe these images will be useful for research purposes in answering such questions as “How many bits are needed to avoid visual defects?” and “How does one determine the number of bits of real image information, as opposed to digitized noise?” In this sense, they may provide ideal image references against which actual digitized images may be compared by various visual or statistical analysis techniques.
The scene is titled Delta E and represents an imaginary view of my imaginary desktop (I am a color scientist).
I offer these images for research and other non-commercial purposes. In consideration of the time and effort put forth in their preparation, I request that my copyright notice accompany them wherever they are used.
All four images are RGB color type and in TIFF format. All have dimensions 3072 × 2048 = 6,291,456 pixels. All images are tagged with ICC reference profiles (sRGB primaries and white point). Other relevant information is shown in the following table:
DeltaE_16bit_gamma1.0.tif | 8.6 | 12.0 | 16 | 1.0 | 50,731 | 49,518 | 52,092 | 1,045,769 |
DeltaE_16bit_gamma2.2.tif | 11.1 | 15.9 | 16 | 2.2 | 59,027 | 58,235 | 60,150 | 1,260,832 |
DeltaE_8bit_gamma1.0.tif | 0.9 | 1.4 | 8 | 1.0 | 241 | 247 | 249 | 89,029 |
DeltaE_8bit_gamma2.2.tif | 1.2 | 1.7 | 8 | 2.2 | 250 | 253 | 253 | 134,683 |
Notes:
- Image DeltaE_8bit_gamma1.0.tif has visible quantization defects in colors with small R, G or B components. This is especially apparent in the flat color patches of the ColorChecker chart and also in the deep shadow regions at the periphery of the spotlight. This image illustrates the fact that linear images need more than 8-bits per channel if visible quantization defects are to be avoided.
- In theory, a 16-bit image may contain up to 65,536 unique levels per channel. My reference images show approximately this number of levels. However, Adobe Photoshop represents 16-bit image data as a 16-bit unsigned integer, in a form that has the binary point between bits 14 and 15, and therefore can only represent 32,769 unique levels (binary 0000000000000000 through 1000000000000000). This means that simply opening and saving one of the 16-bit reference images will reduce the number of unique levels per channel by about half (which will also reduce the total number of unique colors).
- Converting a 16-bit image to 8-bits in Photoshop introduces noise into the image.
- Passing an 8-bit image through a profile or a mode change in Photoshop 6 also introduces noise into the image if the “Use Dither (8-bit/channel images)” checkbox is enabled in the Color Settings dialog (Advanced Mode).
- The download files are provided in both StuffIt (SIT) and ZIP formats (the expanded files are 18 or 36 Mb each). These files may be expanded with the freeware StuffIt Expander program from Aladdin Systems (available for both Macintosh and Windows) and with many other utility programs.
- The ray tracing program had all stochastic features disabled so that no noise was introduced. All texture maps were computer generated (no scans or digital photographs were used).
- All colors in the scene were computed based on the colorimetry of the embedded ICC profile. When viewing in Photoshop, you should use the embedded profile. Either use the embedded profile as the working space (recommended) or convert from the embedded profile into your current working space.
vascript:window.scroll(0,0)”>Top of Page | E-mail: [email protected] |
Revised Sun, 20 Apr 2003 04:07:35 UTC | URL: http://www.brucelindbloom.com |
All material on this web site is Copyright © 2001 – 2007 Bruce Justin Lindbloom. All Rights Reserved. |
——————————————————————————————————————————————————————-
詳讀此篇~~
Beta RGB
There are many RGB working spaces in existence. Some have derived from color television and video standards. Others have come about by tedious trial-and-error efforts or even by accident. It can be difficult choosing the “best” working space for any given application. In fact, it is not at all obvious what working space attributes are even desirable.
One important characteristic would be that the working space is suffiently large that it can properly encode (or contain) all colors that are important to an application. This implies “larger is better.”
Another attribute, which conflicts with the above, is that the working space should be as small as possible, so that quantization errors may be minimized. This implies “smaller is better.”
Since working space definitions are normally derived from theoretical monitor mathematical models, there is a small set of numbers that fully defines them. However, because of this, the gamut has a characteristic “shape” which cannot be arbitrarily formed. Therefore, a good working space would have a gamut shape that minimizes wasted space. This has to do with shape, not size.
In an effort to quantify and evaluate the various existing working spaces, I performed many types of calculations and gamut comparisons, summarized on the RGB Working Space Information page. As part of this exercise, I chose various color sets of possibly important colors, such as different film types, color charts and printing gamuts. After doing this, it was a natural progression to turn this problem around and define the optimal working space for the combined sets of colors. Thus, Beta RGB was born.
Choice of a Reference White
Since Adobe Photoshop and the ICC profile specifications both use D50 as a reference white, this was the logical choice. If instead, a non-D50 white was chosen, then both the creation of, and the use of the working space would require adaptation, which opens the door just a crack for mistakes to be made. Specifying the working space directly in D50 avoids this possibility for error.
The reference white of Beta RGB is:
Reference White | = | D50 |
Choice of Reference Primaries
For this part, I mathematically found the optimally sized and shaped working space that contained all of the colors in my reference set. So the gamut is large enough to encode the colors, but no larger. Here is a chromaticity diagram showing the color set along with the working space:

I have intentionally excluded the FOGRA colors from this illustration because none is a defining color, and there are so many of them (1856) that they would obscure many of the more interesting colors.
The chromaticity coordinates of the Beta RGB primaries are:
Red | = | (0.6888, 0.3112) |
Green | = | (0.1986, 0.7551) |
Blue | = | (0.1265, 0.0352) |
Choice of Gamma
Gamma does not affect the size or shape of the gamut. It does affect the distribution of RGB points within the gamut. Therefore, it is an important consideration for controlling quantization. I have previously analyzed the optimal gamma for the grayscale only (you can see this analysis here). This result was about 2.2 (actually either 2.1723 or 2.3243 depending upon the error metric used).
For Beta RGB, I additionally performed a three-dimensional analysis, where I looked at the ΔE produced by tiny perturbations in RGB space, measured at each of the locations in the color set. For each color, the RGB value was perturbed a distance of one-percent in each of 20 different directions (I used the centers of the 20 faces of an icosahedron to evenly distribute the directions in three-space). Minimizing the RMS ΔE resulted in a gamma of 2.12. This was sufficiently close to 2.2 that I did not feel a deviation from a “standard” 2.2 value was warranted.
The gamma of Beta RGB is:
Gamma | = | 2.2 |
Download Beta RGB
I have incorporated Beta RGB into various calculators and data tables found on this site. You may download the Beta RGB ICC profile in either zip or sit format.
vascript:window.scroll(0,0)”>Top of Page | E-mail: [email protected] |
Revised Sun, 20 Apr 2003 04:06:14 UTC | URL: http://www.brucelindbloom.com |
All material on this web site is Copyright © 2001 – 2007 Bruce Justin Lindbloom. All Rights Reserved. |
RGB Working Space Information
The concept of colorimetrically defined RGB spaces has been around for a long time — at least since the the days of the development of color television. But the popularity in digital imaging applications grew substantially only after Adobe introduced the “RGB Working Space” into Photoshop 5.0. Since that time, many different working space definitions have been added to the original set of color television spaces.
This page summarizes some of the factual information about some of the more popular RGB working spaces. This may serve as a convenient reference source to those investigating the relative merits of each. It is organized as follows:
Specifications | • | Complete colorimetric specifications for the working spaces, along with some efficiency measurements. |
Side Notes | • | Some interesting observations about a few of the working spaces. |
Gamut Projections | • | Views of all gamuts projected onto the a*/b* plane. |
Adapted Primaries | • | A table containing all working space primaries adapted to D50. |
Color Set Evaluations | • | Each working space is evaluated against selected color sets. |
Specifications
Name | Gamma | Reference White |
Red Primary | Green Primary | Blue Primary | Volume (ΔE3) |
Lab Gamut Efficiency % |
Coding Efficiency % |
||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x | y | Y | x | y | Y | x | y | Y | ||||||
Lab Gamut | – | D50 | – | – | – | – | – | – | – | – | – | 2,381,085 | 97.0 | 35.1 |
Adobe RGB (1998) | 2.2 | D65 | 0.6400 | 0.3300 | 0.297361 | 0.2100 | 0.7100 | 0.627355 | 0.1500 | 0.0600 | 0.075285 | 1,208,631 | 50.6 | 100.0 |
Apple RGB | 1.8 | D65 | 0.6250 | 0.3400 | 0.244634 | 0.2800 | 0.5950 | 0.672034 | 0.1550 | 0.0700 | 0.083332 | 798,403 | 33.5 | 100.0 |
Best RGB | 2.2 | D50 | 0.7347 | 0.2653 | 0.228457 | 0.2150 | 0.7750 | 0.737352 | 0.1300 | 0.0350 | 0.034191 | 2,050,725 | 77.6 | 96.5 |
Beta RGB | 2.2 | D50 | 0.6888 | 0.3112 | 0.303273 | 0.1986 | 0.7551 | 0.663786 | 0.1265 | 0.0352 | 0.032941 | 1,717,450 | 69.3 | 99.0 |
Bruce RGB | 2.2 | D65 | 0.6400 | 0.3300 | 0.240995 | 0.2800 | 0.6500 | 0.683554 | 0.1500 | 0.0600 | 0.075452 | 988,939 | 41.5 | 100.0 |
CIE RGB | 2.2 | E | 0.7350 | 0.2650 | 0.176204 | 0.2740 | 0.7170 | 0.812985 | 0.1670 | 0.0090 | 0.010811 | 1,725,261 | 64.3 | 96.1 |
ColorMatch RGB | 1.8 | D50 | 0.6300 | 0.3400 | 0.274884 | 0.2950 | 0.6050 | 0.658132 | 0.1500 | 0.0750 | 0.066985 | 836,975 | 35.2 | 100.0 |
Don RGB 4 | 2.2 | D50 | 0.6960 | 0.3000 | 0.278350 | 0.2150 | 0.7650 | 0.687970 | 0.1300 | 0.0350 | 0.033680 | 1,802,358 | 72.1 | 98.8 |
ECI RGB | 1.8 | D50 | 0.6700 | 0.3300 | 0.320250 | 0.2100 | 0.7100 | 0.602071 | 0.1400 | 0.0800 | 0.077679 | 1,331,362 | 55.3 | 99.7 |
Ekta Space PS5 | 2.2 | D50 | 0.6950 | 0.3050 | 0.260629 | 0.2600 | 0.7000 | 0.734946 | 0.1100 | 0.0050 | 0.004425 | 1,623,899 | 65.7 | 99.5 |
NTSC RGB | 2.2 | C | 0.6700 | 0.3300 | 0.298839 | 0.2100 | 0.7100 | 0.586811 | 0.1400 | 0.0800 | 0.114350 | 1,300,252 | 54.2 | 99.9 |
PAL/SECAM RGB | 2.2 | D65 | 0.6400 | 0.3300 | 0.222021 | 0.2900 | 0.6000 | 0.706645 | 0.1500 | 0.0600 | 0.071334 | 849,831 | 35.7 | 100.0 |
ProPhoto RGB | 1.8 | D50 | 0.7347 | 0.2653 | 0.288040 | 0.1596 | 0.8404 | 0.711874 | 0.0366 | 0.0001 | 0.000086 | 2,879,568 | 91.2 | 87.3 |
SMPTE-C RGB | 2.2 | D65 | 0.6300 | 0.3400 | 0.212395 | 0.3100 | 0.5950 | 0.701049 | 0.1550 | 0.0700 | 0.086556 | 758,857 | 31.9 | 100.0 |
sRGB | ≈2.2 | D65 | 0.6400 | 0.3300 | 0.212656 | 0.3000 | 0.6000 | 0.715158 | 0.1500 | 0.0600 | 0.072186 | 832,870 | 35.0 | 100.0 |
Wide Gamut RGB | 2.2 | D50 | 0.7350 | 0.2650 | 0.258187 | 0.1150 | 0.8260 | 0.724938 | 0.1570 | 0.0180 | 0.016875 | 2,164,221 | 77.6 | 91.9 |
Note: The gamma of sRGB is not exactly 2.2, but rather, is a grafting together of two different functions, that when viewed together, may be approximated by a simple 2.2 gamma curve. When using a simple gamma function, Photoshop calls this “Simplified sRGB.” All calculators, spreadsheets and reference tables found on my entire site use the proper functions, not the simplified versions. The proper sRGB functions may be found here and here.
If you are interested in the RGB-to-XYZ and XYZ-to-RGB matrices for these working spaces, you will find them summarized here.
The first entry in the table is the Lab Gamut. This is the set of Lab color coordinates for which there could possibly be a physical sample. These are the “real colors.” Lab color coordinates that lie outside this gamut can never exist in nature, and therefore it is not important that these coordinates be represented in a working space definition. Further information about the Lab Gamut may be found here and 3D images of it may be found here.
Since the Lab TIFF specification, the ICC profile specification and Adobe Photoshop all use a D50, 2° standard observer basis for Lab, all of the above working spaces that are not similarly defined have been adapted from their native reference white to D50 using the Bradford transformation when computing the volume and efficiencies. This particular transformation is generally accepted as superior to other adaptation algorithms, such as von Kries (see related article evaluating chromatic adaptation methods here).
The Lab Gamut Efficiency % indicates the percent of the entire Lab Gamut (i.e. all colors visible to the eye) that the working space encompasses. As a general rule, a larger value is superior to a smaller value, since it defers any gamut compression and color clipping decisions to a later time. The higher the efficiency, the less likely it is that a color may be clipped in the capture/encoding process.
The Coding Efficiency % indicates the relative portion of the encoding space (e.g. RGB) that represents real colors. Some of the larger volume working spaces contain many RGB triplets for which there is no physical counterpart, and therefore could be considered wasteful.
These two efficiency metrics are perhaps better understood by looking at an example comparing ProPhoto with sRGB. ProPhoto captures a relatively large portion of the Lab Gamut (91%), but in order to do that, it must sacrifice much of its coding space to waste (13%). By contrast, sRGB captures a smaller portion of the Lab Gamut (35%), but every single RGB triplet represents a real color, so there is no waste. As you can see, these two efficiencies are at odds with each other — as you strive for higher Lab Efficiency, you generally lose in Coding Efficiency.
Another interesting observation from the table relates to native Lab encoding. The established methods of integer encoding of Lab color (Lab TIFF, ICC, Photoshop) will clip some of the Lab Gamut. But even more devastating than that is the gross coding inefficiency (only 35%). This means that nearly two-thirds of Lab coding space is wasted on colors that do not even exist. This may be seen here. This inefficiency “squeezes” real colors tightly together, resulting in possible quantization losses. So converting an image into Lab for the purposes of applying a color correction in Photoshop can severly reduce the number of unique colors in your image. This is discussed further here. Whether this is a significant loss depends on the particular situation, but you should at least be aware of it.
Side Notes
-
Perhaps you’ve learned that you can compute the luminance of an RGB color by taking 30% of its red component plus 59% of its green component plus 11% of its blue component. These weightings are often expressed in three-digit precision as 29.9% red, 58.7% green and 11.4% blue. Did you ever wonder where these weightings came from?
You can find them in the above table as the relative Y values for red, green and blue for the NTSC color model. The more precise weightings are 29.8839% red, 58.6811% green and 11.4350% blue. But it should also be obvious that the real RGB weightings depend upon the color system in use. So the “standard” weightings are incorrect for other RGB systems like sRGB or Adobe RGB (1998).
Another relevant fact is that these weightings must be made in a linear RGB space, that is, after the gamma companding function has been removed. It is very common to see the weightings applied bluntly to the companded RGB values, which is wrong.
-
The following four RGB systems are identical, except for the green primary:
- Adobe RGB (1998)
- Bruce RGB
- PAL / SECAM RGB
- sRGB
Since the PAL / SECAM television standard existed first, it is logical to assume that the other three derived from it. I have heard the rumor that the green primary for Adobe RGB came about by the accidental use of the NTSC green primary, used incorrectly since NTSC is defined relative to Illuminant C while Adobe RGB is defined relative to D65. After the mistake was discovered, Adobe decided to keep it since their experiences with this accidental reference space were favorable.
-
You can learn about some of the working space authors here.
Gamut Projections
Below are views of each of the working space gamuts, as viewed from above in Lab space. The darker blue square represents the limited range of Lab encoding offered by normal integer encoding methods as described above. The red outline is the projection of the Lab Gamut. Each gamut is rendered as its L* value only, so darker shades represent darker colors, as seen especially in the blue region (lower right of each image).
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Adapted Primaries
Since the ICC specification and Adobe Photoshop both use a reference white of D50, the working space primaries that are specified relative to some other reference white must first be adapted to D50 before they may be used in a D50 environment, or be meaningfully compared with one another. You can learn the mathematics of chromatic adaptation here, and you may use an online chromatic adaptation calculator here. For those wishing to avoid the tedium, I have adapted the above working space primaries from their native reference whites to the D50 reference white, using the Bradford transform (the transform used by Photoshop). The results are summarized below. In this table, those working spaces highlighted in yellow needed adaptation, the others were already specified in D50, and therefore remain unchanged from the values shown in the table at the top of this page.
Name | Red Primary | Green Primary | Blue Primary | ||||||
---|---|---|---|---|---|---|---|---|---|
x | y | Y | x | y | Y | x | y | Y | |
Adobe RGB (1998) | 0.648431 | 0.330856 | 0.311114 | 0.230154 | 0.701572 | 0.625662 | 0.155886 | 0.066044 | 0.063224 |
Apple RGB | 0.634756 | 0.340596 | 0.255166 | 0.301775 | 0.597511 | 0.672578 | 0.162897 | 0.079001 | 0.072256 |
Best RGB | 0.734700 | 0.265300 | 0.228457 | 0.215000 | 0.775000 | 0.737352 | 0.130000 | 0.035000 | 0.034191 |
Beta RGB | 0.688800 | 0.311200 |