How would I do Face Alignment on JPEG face images in OpenCv while using Java?

asked 2015-06-29 10:39:11 -0600

muithi gravatar image

I want to align several faces I have at my disposal here using openCv. I want to read a jpg face photo, align it and finally save it as in jpg after alignment. Here is where I am stuck. See below

public class FaceImageAlignment {

/**
 * @Param args the command line arguments
 */
public static void main(String[] args) throws IOException {
    // TODO code application logic here

    BufferedImage img = null;
    img = ImageIO.read(new File("D:/face_test.jpg"));

    //How to align face image using openCv
    //This is where I am stuck on doing face alignment. I want to do Affine alignment on face images as  follows
    //I want to be able to use e.g. an opencv Affine alignement function assuming that function is AffineAlignment()
    //I want to achieve the following assuming there is such a function for affine alignment in OpenCv with Java
    AffineAlignment imgAlign = new AffineAlignment();
    //but I do not seem to figure out how to do face alignment with it



    BufferedImage imgAligned = new BufferedImage(//I will need to put aligned Image here as a BufferedImage);
    File outPutFile = new File("D:\\face_aligned.jpg");
    ImageIO.write(imgAligned, "JPEG", outPutFile );

}

}

Please I need your help on how to implement this in Java. Someone please show me how to do this?

edit retag flag offensive close merge delete

Comments

Stuck at the same issue any updates ?

siddharthshah gravatar imagesiddharthshah ( 2020-10-16 04:36:18 -0600 )edit