Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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生成彩色图像 我想在Matlab中绘制一个大小为200×200像素的彩色图像,在中间IE 76行和125列中键入RGB和一个正方形大小的绿色。_Image_Matlab_Matlab Guide - Fatal编程技术网

Image 用Matlab生成彩色图像 我想在Matlab中绘制一个大小为200×200像素的彩色图像,在中间IE 76行和125列中键入RGB和一个正方形大小的绿色。

Image 用Matlab生成彩色图像 我想在Matlab中绘制一个大小为200×200像素的彩色图像,在中间IE 76行和125列中键入RGB和一个正方形大小的绿色。,image,matlab,matlab-guide,Image,Matlab,Matlab Guide,然后我想在同一幅图像的角上画20*20像素的红色、绿色、蓝色和黑色正方形。我不知道如何在MATLAB中绘制颜色框(RGB) 如下图所示,我已经用二进制完成了这项工作:您需要定义您提到的3个组件:R、G、B。此外,如果您希望使用颜色通道作为整数0..255,则需要将矩阵类型转换为整数: img = ones(256,256,3) * 255; % 3 channels: R G B img = uint8(img); % we are using integer

然后我想在同一幅图像的角上画20*20像素的红色、绿色、蓝色和黑色正方形。我不知道如何在MATLAB中绘制颜色框(RGB)


如下图所示,我已经用二进制完成了这项工作:

您需要定义您提到的3个组件:R、G、B。此外,如果您希望使用颜色通道作为整数0..255,则需要将矩阵类型转换为整数:

img = ones(256,256,3) * 255;    % 3 channels: R G B
img = uint8(img);               % we are using integers 0 .. 255
% top left square:
img(1:20, 1:20, 1) = 255;       % set R component to maximum value
img(1:20, 1:20, [2 3]) = 0;     % clear G and B components
% top right square:
img(1:20, 237:256, [1 3]) = 0;  % clear R and B components
img(1:20, 237:256, 2) = 255;    % set G component to its maximum
% bottom left square:
img(237:256, 1:20, [1 2]) = 0;
img(237:256, 1:20, 3) = 255;
% bottom right square:
img(237:256, 237:256, [1 2 3]) = 0;

imshow(img);

希望它能帮助您理解这个想法。

您需要定义您提到的3个组件:R、G、B。此外,如果您想将颜色通道作为整数0..255使用,您需要将矩阵类型转换为整数:

img = ones(256,256,3) * 255;    % 3 channels: R G B
img = uint8(img);               % we are using integers 0 .. 255
% top left square:
img(1:20, 1:20, 1) = 255;       % set R component to maximum value
img(1:20, 1:20, [2 3]) = 0;     % clear G and B components
% top right square:
img(1:20, 237:256, [1 3]) = 0;  % clear R and B components
img(1:20, 237:256, 2) = 255;    % set G component to its maximum
% bottom left square:
img(237:256, 1:20, [1 2]) = 0;
img(237:256, 1:20, 3) = 255;
% bottom right square:
img(237:256, 237:256, [1 2 3]) = 0;

imshow(img);

希望它能帮助您理解这个想法。

您需要定义您提到的3个组件:R、G、B。此外,如果您想将颜色通道作为整数0..255使用,您需要将矩阵类型转换为整数:

img = ones(256,256,3) * 255;    % 3 channels: R G B
img = uint8(img);               % we are using integers 0 .. 255
% top left square:
img(1:20, 1:20, 1) = 255;       % set R component to maximum value
img(1:20, 1:20, [2 3]) = 0;     % clear G and B components
% top right square:
img(1:20, 237:256, [1 3]) = 0;  % clear R and B components
img(1:20, 237:256, 2) = 255;    % set G component to its maximum
% bottom left square:
img(237:256, 1:20, [1 2]) = 0;
img(237:256, 1:20, 3) = 255;
% bottom right square:
img(237:256, 237:256, [1 2 3]) = 0;

imshow(img);

希望它能帮助您理解这个想法。

您需要定义您提到的3个组件:R、G、B。此外,如果您想将颜色通道作为整数0..255使用,您需要将矩阵类型转换为整数:

img = ones(256,256,3) * 255;    % 3 channels: R G B
img = uint8(img);               % we are using integers 0 .. 255
% top left square:
img(1:20, 1:20, 1) = 255;       % set R component to maximum value
img(1:20, 1:20, [2 3]) = 0;     % clear G and B components
% top right square:
img(1:20, 237:256, [1 3]) = 0;  % clear R and B components
img(1:20, 237:256, 2) = 255;    % set G component to its maximum
% bottom left square:
img(237:256, 1:20, [1 2]) = 0;
img(237:256, 1:20, 3) = 255;
% bottom right square:
img(237:256, 237:256, [1 2 3]) = 0;

imshow(img);

希望它能帮助您了解这个想法。

在二维矩阵中标记区域,然后使用颜色贴图来使用
ind2rgb
。在二维矩阵中标记区域,然后使用颜色贴图来使用
ind2rgb
。在二维矩阵中标记区域,然后使用颜色贴图来使用
ind2rgb
。在二维矩阵中标记区域,然后使用
ind2rgb
带有彩色地图。谢谢。我想知道“一”这个关键词的用途是什么!一(m,n,p)创建了一个满1的矩阵,大小为m x n x p。您也可以使用zeros(),它的作用相同,但会用0填充矩阵。谢谢。我想知道“一”这个关键词的用途是什么!一(m,n,p)创建了一个满1的矩阵,大小为m x n x p。您也可以使用zeros(),它的作用相同,但会用0填充矩阵。谢谢。我想知道“一”这个关键词的用途是什么!一(m,n,p)创建了一个满1的矩阵,大小为m x n x p。您也可以使用zeros(),它的作用相同,但会用0填充矩阵。谢谢。我想知道“一”这个关键词的用途是什么!一(m,n,p)创建了一个满1的矩阵,大小为m x n x p。您也可以使用zeros(),它也可以使用zeros(),但用0填充矩阵。