0

我有两张图片,一张包含没有脸的身体,一张包含只有脸的图片...

现在我想合并这两个图像......第一个只包含没有脸的身体的图像是因为脸是透明的......

那么我怎样才能检测到透明区域并将脸放在透明区域中

我正在将两个图像与下面的代码组合在一起。但是将脸放在透明区域上不是正确的方法

下面是我的代码

 public Bitmap combineImages(Bitmap c, Bitmap s) {
    Bitmap cs = null;

    int width, height = 0;

    if (c.getWidth() > s.getWidth()) {
        width = c.getWidth() + s.getWidth();
        height = c.getHeight();
    } else {
        width = s.getWidth() + s.getWidth();
        height = c.getHeight();
    }

    cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

    Canvas comboImage = new Canvas(cs);

    comboImage.drawBitmap(c, 0f, 0f, null);
    comboImage.drawBitmap(s, 0f, 0f, null);

    return cs;
}
4

1 回答 1

0

你的意思是身体图像的面部区域是透明的吗?即身体图像某些部分的 alpha 值低?

于 2012-10-02T06:12:51.483 回答