首页 文章

删除图像的纯色背景

提问于
浏览
1

我想实现一个用户可以 capture image through camera and remove the solid background (green/blue) 的功能 . 我已经使用了色度键来删除背景,但它没有达到标记 . 色度键也消除了图像颜色和图像质量受到干扰 . 我已经搜索了很多以获得更好的选择,但找不到它 . 如果任何人有想法删除背景颜色,请与我们分享 . 提前致谢 .

1 回答

  • 1

    这非常简单,下面是图像视图的示例,用于从图像和内部获取像素,条件是您可以用透明像素替换任何像素 .

    Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap();
    int pixel = bitmap.getPixel(x,y);
    int redValue = Color.red(pixel);
    int blueValue = Color.blue(pixel);
    int greenValue = Color.green(pixel);
    if(pixel == Color.RED){
        textViewCol.setText("It is RED");
    }
    

    还使用for循环迭代整个位图 .

相关问题