Here you can find the source of rgb2gray(int r, int g, int b)
public static double rgb2gray(int r, int g, int b)
//package com.java2s; //License from project: Open Source License public class Main { public static double rgb2gray(int r, int g, int b) { return 0.3 * r + 0.59 * g + 0.11 * b; }/*w ww.java 2 s . c o m*/ }