Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 在matlab中制作具有代表性的HSV图像_Image_Matlab_Image Processing_Computer Vision - Fatal编程技术网

Image 在matlab中制作具有代表性的HSV图像

Image 在matlab中制作具有代表性的HSV图像,image,matlab,image-processing,computer-vision,Image,Matlab,Image Processing,Computer Vision,我想创建一个HSV图像(或者可能是一个坐标图),精确显示坐标 我使用下面的代码,并得到这样一个图像的结果,下面的代码,这不是我想要的 img = rand(200,200); [ind_x, ind_y] = ind2sub(size(img),find(isfinite(img))); ind_x = reshape(ind_x,size(img)); ind_y = reshape(ind_y,size(img)); ind = ind_x.*ind_y; figure, imagesc(

我想创建一个HSV图像(或者可能是一个坐标图),精确显示坐标

我使用下面的代码,并得到这样一个图像的结果,下面的代码,这不是我想要的

img = rand(200,200);
[ind_x, ind_y] = ind2sub(size(img),find(isfinite(img)));
ind_x = reshape(ind_x,size(img));
ind_y = reshape(ind_y,size(img));
ind = ind_x.*ind_y;

figure, imagesc(ind); axis equal tight xy

假设您将HSV空间(0-1)量化为256个箱子。将有256*256*256种可能的颜色。我们可以确定一个维度(比如饱和度)并生成矩阵。然后将有256*256种颜色

[x1,x2]=meshgrid(linspace(0,1,256),linspace(0,1,256));
img(:,:,1)=x1;
img(:,:,2)=1;  %fully saturated colors
img(:,:,3)=x2;

imgRGB=hsv2rgb(img); %for display purposes
imshow(imgRGB,[])
它在RGB中看起来会有所不同(这是您将可视化的地方)。如果可视化HSV矩阵,它看起来与您的图像相似(即,不将其转换为RGB,但MATLAB不知道其HSV)

您发布的第二张图像可以通过以下方式获得:

[x1,x2]=meshgrid(linspace(0,1,256),linspace(0,1,256));
img(:,:,1)=x1;
img(:,:,2)=0;
img(:,:,3)=x2;
imshow(img,[]) %visualizing HSV

谢谢你的回答。你的代码正在产生一些非常接近我需要的东西,我只需要增加饱和度。我怎么能做到?我的意思是,输出图像非常平滑!两个方面:一,。您可以通过更改
img(:,:,2)
来增加饱和度。我已经将它设置为零(最后5行代码),增加它,您将增加饱和度。2.通过将256更改为更大的值,可以使输出图像更平滑。实际上我不想使输出更平滑!我想让它们像我发布的那些图像一样清晰。你认为增加饱和度会使输出“不太”平滑吗?如果是的话,那就不会了。要降低图像的平滑度,请将该值从256(例如128甚至64)减小。
[x1,x2]=meshgrid(linspace(0,1,256),linspace(0,1,256));
img(:,:,1)=x1;
img(:,:,2)=0;
img(:,:,3)=x2;
imshow(img,[]) %visualizing HSV