Displaying a color gamut surface -- Old Code does not work in r2021b ?

2 次查看(过去 30 天)
As I tried to step through the code, I stumbled on this error :
Error in Z_Boundary_sRGB (line 13)
trisurf(k,a,b,L,'FaceColor','interp','FaceVertexCData',rgb,'EdgeColor','none')
The web site page, down in the comment section, refers to a 'fix' for 2014b and later :
set(groot,'DefaultFigureColormap',map)
Since I'm using R2021b, I figured I'll add the code but I still got the error. I'll keep searching at my end... but here's, in case...
[r,g,b] = meshgrid(linspace(0,1,50));
rgb = [r(:), g(:), b(:)];
lab = rgb2lab(rgb);
a = lab(:,2);
b = lab(:,3);
L = lab(:,1);
k = boundary(a,b,L);
trisurf(k,a,b,L,'FaceColor','interp','FaceVertexCData',rgb,'EdgeColor','none')
xlabel('a*')
ylabel('b*')
zlabel('L*')
axis([-110 110 -110 110 0 100])
view(-10,35)
axis equal
title('sRGB gamut surface in L*a*b* space')
I get the concept of a 3D boundary but I confess I'm at loss as to explain what's going on in the trisurf function.
Any help is appreciated :-)

回答(1 个)

Roger Breton
Roger Breton 2021-12-19
编辑:Roger Breton 2021-12-19
Never mind! I inadvertently saved a snippet of code under the name trisurf.m in the current directory. So when Matlab executed the script, of course, MY trisurf.m function took precedence ove the built-in, "real" trisurf.m function. Egg on my face... I'll learn to better read error messages in the future... Needless to say, as soon as I renamed my code snippet, the script worked flawlessly, as it pulled the "original" trisurf code...
Boy! Let that be a lesson...

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by