[Java]/*** convert image to grayscale ** @ param bmSrc * @ return */public static Bitmap bitmap2Gray (Bitmap bmSrc) {int width, height; height = bmSrc. getHeight (); width = bmSrc. getWidth (); Bitmap BMP gray = null; BMP gray = Bitmap. createBitmap (width, height, Bitmap. config. RGB_565); Canvas c = new Canvas (BMP gray); Paint paint = new Paint (); ColorMatrix cm = new ColorMatrix (); cm. setSaturation (0); ColorMatrixColorFilter f = new ColorMatrixColorFilter (cm); paint. setColorFilter (f); c. drawBitmap (bmSrc, 0, 0, paint); return BMP gray;}/*** convert the image to grayscale ** @ param bmSrc * @ return */public static Bitmap bitmap2Gray (Bitmap bmSrc) {int width, height; height = bmSrc. getHeight (); width = bmSrc. getWidth (); Bitmap BMP gray = null; BMP gray = Bitmap. createBitmap (width, height, Bitmap. config. RGB_565); Canvas c = new Canvas (BMP gray); Paint paint = new Paint (); ColorMatrix cm = new ColorMatrix (); cm. setSaturation (0); ColorMatrixColorFilter f = new ColorMatrixColorFilter (cm); paint. setColorFilter (f); c. drawBitmap (bmSrc, 0, 0, paint); return BMP ;}: