![]() |
在MATLAB中建模HSV颜色空间
我可以在MATLAB中创建3D圆锥体,但是:有谁知道如何绘制圆锥体,以便重新创建HSV颜色空间?我知道有命令:
色彩映射hsv; 但是我该如何使用呢? 提前致谢。 [B]回答:[/B] 我猜您想在以下[URL="http://en.wikipedia.org/wiki/File:HSV_cone.jpg"]Wikipedia[/URL]图像中创建类似于圆锥体的图: [IMG]https://upload.wikimedia.org/wikipedia/commons/f/f1/HSV_cone.jpg[/IMG] 一种方法是绘制圆锥体并使用HSV颜色空间的图像在表面上绘制[URL="https://stackoverflow.com/q/2488086/52738"]纹理贴图[/URL] 。这是您可以执行的操作: % First, create a 100-by-100 image to texture the cone with: H = repmat(linspace(0, 1, 100), 100, 1); % 100-by-100 hues S = repmat([linspace(0, 1, 50) ... % 100-by-100 saturations linspace(1, 0, 50)].', 1, 100); %' V = repmat([ones(1, 50) ... % 100-by-100 values linspace(1, 0, 50)].', 1, 100); %' hsvImage = cat(3, H, S, V); % Create an HSV image C = hsv2rgb(hsvImage); % Convert it to an RGB image % Next, create the conical surface coordinates: theta = linspace(0, 2*pi, 100); % Angular points X = [zeros(1, 100); ... % X coordinates cos(theta); ... zeros(1, 100)]; Y = [zeros(1, 100); ... % Y coordinates sin(theta); ... zeros(1, 100)]; Z = [2.*ones(2, 100); ... % Z coordinates zeros(1, 100)]; % Finally, plot the texture-mapped surface: surf(X, Y, Z, C, 'FaceColor', 'texturemap', 'EdgeColor', 'none'); axis equal 并且您应该得到下图: [URL="https://i.stack.imgur.com/VriU3.png"][IMG]https://i.stack.imgur.com/VriU3.png[/IMG][/URL] [url=https://stackoverflow.com/questions/3339692]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 14:17。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.