1
我想使用openImaj對齊我在這裏使用的幾個面。我想閱讀一張jpg臉部照片,對齊它,最後在對齊後保存爲jpg格式。這裏是我卡住的地方。見下面使用openImaj API庫進行面對齊
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 openImaj
//This is where I am stuck on doing face alignment. I tried doing the following
AffineAligner imgAlign = new AffineAligner();
//but I could not 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 f = new File("D:\\face_aligned.jpg");
ImageIO.write(imgAligned, "JPEG", f);
}
}
我需要什麼代碼才能將face_test.jpg對齊到face_aligned.jpg?
謝謝@Jon的例子。我在我的java netbeans IDE 8.0平臺中導入了以下類。他們是 ; 'import java.io.File; import java.io.IOException; import org.openimaj.image.FImage; import org.openimaj.image.ImageUtilities; import org.openimaj.image.processing.face.alignment.AffineAligner; import org.openimaj.image.processing.face.alignment.FaceAligner; import org.openimaj.image.processing.face.detection.keypoints.FKEFaceDetector; import org.openimaj.image.processing.face.detection.keypoints.KEDetectedFace;'但我一直在修復其他依賴關係。這是正常的嗎? –
我可以錯過任何其他openImaj API嗎?當我編譯時,我沒有看到任何錯誤,但是當我運行時,我發現一個新的類,我必須修復,當我清理並再次運行另一個類,需要我添加另一個Java API拋出異常。過去我一直這樣做了5個小時,直到我認爲我必須做出這樣錯誤的事情。對於上述導入,我從1.3.1文件夾中的openImaj提供的API庫中完成了它們。請推薦我可以從哪裏獲取最新的openImaj API庫,而不是2014年9月25日的庫。我會感激。 –
你真的需要使用一個自動的依賴管理器 - 閱讀它:http://stackoverflow.com/questions/25602141/openimaj-jar-files – Jon