Custom RGB color space

18 ビュー (過去 30 日間)
Roger Breton
Roger Breton 2024 年 2 月 23 日
コメント済み: Roger Breton 2024 年 9 月 9 日
I am plottiing the measured Lab colors of a ColorChecker SG chart in 3D as you can see below:
To obtain the "gamut surface", I use the following code:
[r,g,b] = meshgrid(linspace(0,1,20)); % linspace(0,1,50)
rgb = [r(:), g(:), b(:)];
lab = rgb2lab(rgb, 'ColorSpace', 'adobe-rgb-1998', 'WhitePoint','d50');
a = lab(:,2);
b = lab(:,3);
L = lab(:,1);
k = boundary(a,b,L);
h1 = trisurf(k,a,b,L,'FaceColor','interp', 'FaceVertexCData',rgb,'EdgeColor','none', 'FaceAlpha', 0.30);
Works great as it allows me to analyze how the ColorChecker SG chart "fit" inside a given RGB color space such as AdobeRGB. But as you can see by the screen capture, some points lie outside the AdobeRGB gamut? I don't want to use ProPhotoRGB as I find it is so "big" (I'm still not sold on it).
My question is: would there be any way for me to specify custom primaries? As in Photoshop?
The goal would be to find which primaries are capable of fully enclosing my ColorChecker SG colors and give me the "best" editing space to transform my RGB images from my Nikon to Photoshop using a custom camera profile.
Thanks in advance for your help.

採用された回答

Aastha
Aastha 2024 年 9 月 4 日
Hi Roger Breton,
I understand that you want to specify custom values for gamma, whitepoint, and RGB primaries for the rgb2lab function instead of using the built-in templates.
However, according to the MathWorks documentation of “rgb2lab” function only built-in templates can be specified. Here is the link to the documentation of “rgb2lab” function:
I tried to implement a manual conversion process which could adjust the parameters according to user specifications. You may find my custom implementation in the attached file “custom_primaries.m”. I have also compared this custom implementation with MATLAB’s built-in rgb2lab function using the "adobe-rgb-1998" template for your reference.
You can replace the built-in rgb2lab function in your code with this custom rgb_to_lab” function implementation within the “custom_primaries.m” script to visualize the ColorCheckerSG chart and identify the primaries that best fit your image. You can then adjust the primaries, whitepoint, and gamma according to your specifications to achieve the best results.
I hope this helps!
  1 件のコメント
Roger Breton
Roger Breton 2024 年 9 月 9 日
Thank you very much for your kind help!

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by