clear;
clc;
%读png图片的alpha通道:alpha_2
[I,map,alpha_2] = imread('grey_n_trans_999.png');
%%
%图像的初始化
%定义一个包含rgb值的三维向量I=(row,column,3)
%r的值在I(:,:,1),g的值在I(:,:,2),b的值在I(:,:,3)
%单位是毫米
height=300;
width=2560;
I=zeros(height,width,3);
%Alpha — Transparency of each pixel
%matrix of values in the range [0,1]
alpha=ones(height,width)*255;
%%
%通过reshape函数将rgb三个值分别放入到各自的二维矩阵(行列)当中
%红色R部分
for i=1:100
for j=1:256
for k=1:10
%设置像素点的RGB值
I(i,(j-1)*10+k,:)=reshape([255 0 0],1,1,3);
%设置像素点的alpha值
alpha(i,(j-1)*10+k)=255-(j-1);
&n