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

조회 수: 2 (최근 30일)
Roger Breton
Roger Breton 2021년 12월 18일
편집: Roger Breton 2021년 12월 19일
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