CRT gamut solid
4 views (last 30 days)
Show older comments
Matteo Niccoli
on 5 Jan 2012
Commented: Matteo Niccoli
on 20 Mar 2022
Has anyone seen a function to create and display the 3D outline of CRT gamut in Lab coordinates? it would be interesting to be able to plot a colormap created with Lab Color Scale - http://www.mathworks.com/matlabcentral/fileexchange/11037 (or any other method) to test if it's within the gamut.
0 Comments
Accepted Answer
Image Analyst
on 5 Jan 2012
Like I said in your newgroup posting, check out my answer. Basically, yes you can get a 3D color space gamut through use of an ImageJ plug-in.
0 Comments
More Answers (2)
DGM
on 19 Mar 2022
This wasn't available in 2012, but for anyone looking today, MIMT (on the File Exchange) has a tool that's made for this. The csview() tool can be used to plot the projection of sRGB in various other spaces/models. It can be used along with other basic plotting tools, or if called without arguments, it will open a GUI for interactive selection of options.
A task like the one described can be done quite easily. Consider that we want to plot the distribution of colors in an image. Note that points which are tangential to the gamut boundary show through since the plot markers are not zero-width.
A = imread('peppers.png');
A = reshape(A,[],3);
Alab = rgb2lab(A);
csview('lab','alpha',0.5); hold on
xlim([-130 130])
ylim([-130 130])
view(52,23)
scatter3(Alab(:,2),Alab(:,3),Alab(:,1),1,'k','filled')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/932719/image.png)
Of course, looking by eye isn't very effective to see if points are OOG. There are likely millions of points, and the state of ones that are close to the boundary is impossible to discern because of the marker width. You can calculate that easily enough. The original question asked about checking a colormap, so let's show that:
% test whether entries in a CT are OOG
% a sample CT in LAB
CTlab = rand(100,3).*[100 200 200] - [0 100 100];
% test using IPT tools
CTtest = lab2rgb(CTlab);
isoog1 = any(CTtest<0 | CTtest>1,2); % a logical vector
% MIMT LCH tools with GC bypass are about 10x as fast
% ctflop() permutes the CT so that it can be processed as an image
CTtest = ctflop(lch2rgb(lab2lch(ctflop(CTlab)),'lab','nogc'));
isoog2 = any(CTtest<0 | CTtest>1,2); % a logical vector
isequal(isoog1,isoog2) % both methods produce identical results
This can easily be done with regular IPT tools, but if speed is of any concern, it can be worthwhile to skip the gamma correction. Even with the extraneous rectangular-polar conversions, the MIMT tools can be much faster.
It's worth asking why one needs to check if points are in-gamut. If the goal is to find the gamut boundary, then MIMT maxchroma() can do that for you. No need to check.
One of the initial motivations for csview() was to demonstrate the undesirable trajectory of out-of-gamut color points when they are truncated after conversion back to RGB. The goal was to emphasize the utility of truncation in LCH prior to conversion to RGB -- which is one of the options that MIMT lch2rgb() offers.
% a test point in LAB
testpoint = [90 75 50];
% show the gamut extents and show the test point
% show its trajectory as it is clipped on conversion to RGB
csview('lab','testpoint',testpoint,'cplane','patch')
xlim([-130 130])
ylim([-130 130])
view(52,23)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/932724/image.png)
John D'Errico
on 19 Mar 2022
Not totally pertinent, but years ago, I built a solid model of some gamuts. I no longer have it, since I gave it away when I retired. I'll give the details of how I made it here. (All computations were done in MATLAB of course.)
But the idea was to first start with data that described the gamut in LAB coordinates. I used I think a printer gamut. It was probably something like an HP DeskWriter C gamut at the time - something pretty small. And at the time, it was printed on plain paper, probably not even the high quality coated stuff, so it would have been tiny.
I also had a monitor gamut, which I could generate using a model. Of course, it was much larger.
Next, compute an alpha shape in Lab of each gamut from those points describing the gamuts. This is because gamuts are never concave things. (I had my own tools to compute alpha shapes in 3-d at the time.)
Next, slice through each alpha shape at constant levels of L*. Because an alpha shape is a triangulated volume, the result will be a triangulated surface, a 2-manifold. Again, I used my own codes for this task to perform the constant L* slices.
Next, plot out those slices in color, where the colors were chosen at each point by converting back to RGB coordinates, now using a higher quality printer that would print on clear plastic. I would have needed to gamut map those colors, since the monitor gamut would have resulted in out of gamut colors for the printer.
Print out the two gamut slices. Cut them out carefully using scissors. The origin in the (a*,b*) plane was always labeled, as was one other point that was common to all gamuts.
The larger monitor gamut slices, I now temporarily stuck to a sheet of acrylic plastic. The it was all acaled so the slices were 1/4 inch thick, so I used 1/4 inch thick acrylic, easy to get in sheets.
Cut out each gamut slice on the bandsaw. Drill holes in each gamut slice using a small drill bit, 1/8 inch, or something like that. One hole at the origin, the second hole at the offset point I had chosen.
Take each of those now acrylic gamut slices, and polish the edges until they were virtually optically clear. Alternate the acrylic slices with the small printer gamut slices. Since the printer gamut slices were only printed on transparency plastic, I could stack them up, and you could see the smaller gamut inside the larger one.
I used a brass rod though the center point at the origin. to hold everything solidly in place, with the second brass rod to insure that the pieces could not spin. The ends of the brass rods were threaded to take a small nut. I was quite careful to make sure that all finger prints were removed from the slices, so everything was perfectly transparent. Assemble using gloves.
The base of the now 3-d gamut model was made of a thick slice of acrylic, probably 1/2 inch thick stuff. I even made plastic handles, attached to the base to pick it up to avoid getting finger prints on the gamut surface. If I remember right, I probably glued up more acrylic into a solid chunk, then turned knobs on the lathe.
The total time to build was not small, but doable in my spare evenings for a couple of weeks. Fun to make too.
It was a great way to bring in a gamut into classes we taught, to teach students what the various gamuts looked like, how they compared in volume, etc.
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!