删除图像的纯色背景

时间:2012-11-08 05:12:26

标签: android image camera chromakey

我希望实现一种功能,用户可以通过相机捕捉图像并删除纯色背景(绿色/蓝色)。  我已经使用了色度键来删除背景,但它没有达到标记。色度键也消除了图像颜色并且图像质量受到干扰。 我已经搜索了很多以获得更好的选择,但找不到它。如果任何人有想法删除背景颜色,请与我们分享。 提前谢谢。

1 个答案:

答案 0 :(得分: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循环迭代整个位图。