我需要使用Android OpenCV将彩色图像转换为灰度。我需要在ImageView中显示灰度图像。我在drawable文件夹中的示例图像为我提供了简单的代码。
我已经在模拟器中安装并配置了SDK,NDK,OpenCV和OpenCVManager。
答案 0 :(得分:0)
制作饱和度为0的colormatrixlter,然后将其设置为imageview
yourImageView.setImageResource(R.drawable.your_drawable_name);
ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.setSaturation(0);
ColorMatrixColorFilter colorFilter = new ColorMatrixColorFilter(colorMatrix);
yourImageView.setColorFilter(filter);