Android Bitmap去噪
fun Bitmap.toGray(): Bitmap? { // 得到图片的长和宽 // 创建目标灰度图像 val bmpGray = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565) // 创建画布 val c = Canvas(bmpGray) val paint = Paint() val cm = ColorMatrix() cm.setSaturation(0f) val f = ColorMatrixColorFilter(cm) paint.colorFilter = f c.drawBitmap(this, 0f, 0f, paint) return bmpGray }