帮我如下的程序中问号的部分加上注释和解释 //////////////////灰度转换\\\\\\\\\\\\\\\\\\\\\\\private int[] RGBtoGray(int[] ImageSource){ int[]grayArray=new int[h*w];ColorModel colorModel=ColorModel.getRGBdefault(); int i ,j,k,r,g

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 21:34:01
帮我如下的程序中问号的部分加上注释和解释 //////////////////灰度转换\\\\\\\\\\\\\\\\\\\\\\\private int[] RGBtoGray(int[] ImageSource){ int[]grayArray=new int[h*w];ColorModel colorModel=ColorModel.getRGBdefault(); int i ,j,k,r,g

帮我如下的程序中问号的部分加上注释和解释 //////////////////灰度转换\\\\\\\\\\\\\\\\\\\\\\\private int[] RGBtoGray(int[] ImageSource){ int[]grayArray=new int[h*w];ColorModel colorModel=ColorModel.getRGBdefault(); int i ,j,k,r,g
帮我如下的程序中问号的部分加上注释和解释
//////////////////灰度转换\\\\\\\\\\\\\\\\\\\\\\\
private int[] RGBtoGray(int[] ImageSource){
int[]grayArray=new int[h*w];
ColorModel colorModel=ColorModel.getRGBdefault();
int i ,j,k,r,g,b;
for(i = 0; i < h;i++){//?(这里问的是循环的功能和作用)
for(j = 0;j < w;j++){
k = i*w+j;
r = colorModel.getRed(ImageSource[k]);
g = colorModel.getGreen(ImageSource[k]);
b = colorModel.getBlue(ImageSource[k]);
int gray=(int)(r*0.3+g*0.59+b*0.11); //?(这问的是为什么乘以这样的系数)
r=g=b=gray;
grayArray[i*w+j]=(255

帮我如下的程序中问号的部分加上注释和解释 //////////////////灰度转换\\\\\\\\\\\\\\\\\\\\\\\private int[] RGBtoGray(int[] ImageSource){ int[]grayArray=new int[h*w];ColorModel colorModel=ColorModel.getRGBdefault(); int i ,j,k,r,g
我认为是:
1.按像素高度,宽度进行循环计算每个像素点的灰度
2.系数为RGB颜色转换为灰度的算法
3.按像素高度,宽度进行循环计算每个像素数组的图像均衡值