0

I have a two image one image is containing body without face and one image contain with face only...

now i want to merge this two images.... the first image which contain only body without face is in that the face is transparent.....

so how can i detect that transparent area and place face over there in transparent area

i am combining two images with below code.. but it is not proper way to place face over transparent area

below is my code

 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;
}
Siddhpura Amit
  • 14,534
  • 16
  • 91
  • 150

1 Answers1

0

Do you mean the face area of the body image is transparent? I.e. the alpha value in some part of the body image is low?

DXM
  • 1,249
  • 1
  • 14
  • 22
  • If you do a connected component labeling on the body image, you should be able to find with the face should be, and the size of the face from the bounding box. – DXM Oct 02 '12 at 20:09
  • here's a link on combining bitmap. http://stackoverflow.com/questions/10616777/how-to-merge-to-two-bitmap-one-over-another – DXM Oct 02 '12 at 20:12