opencv获取人脸眼镜位置_使用带有眼睛和嘴角点的OpenCV进行面部特征检测

I'm working on a face feature detection project and I do detect the eyes, nose and mouth using OpenCv withHaarcascade xml files. But, I want to have the eyes and mouth corners points and the nose center. The goal is using it to predict emotions. I found this link that shows how it works, and I need to get to this result using JAVA. Could any one help me?

Thanks in advance.

in this part we receve the face image and we drawRect on the face:

public void drawFaces(BufferedImage image) {

final List faces = FacialRecognition.run(image, db);

if (faces.isEmpty()) {

return;

}

Graphics2D g2 = image.createGraphics();

g2.setStroke(new BasicStroke(2));

currentFaces.clear();

for (PotentialFace face : faces) {

final Rectangle r = face.box;

final Color c1, c2;

final String msg;

if (face.name == null) {

c1 = c2 = new Color(scale(r.x, getWidth(), 255d), scale(r.y, getHeight(), 255d), 0).brighter();

msg = "Click to tag";

} else {

c1 = new Color(face.name.hashCode()).brighter();

c2 = new Color((int) (c1.getRGB() - 10*face.confidence));

msg = String.format("%s: %f", face.name, face.confidence);

}

g2.setColor(c1);

g2.drawRect(r.x, r.y, r.width, r.height);

g2.setColor(c2);

g2.drawString(msg, r.x + 5, r.y - 5);

currentFaces.add(r);

}

解决方案

since flandmark is the C++ library which does exactly what you want (finds corner points for eyes, mouth and center/tip of nose), I think you should just look for the mechanism of how to run this library from within JAVA. flandmark itself is OpenCV independent, only examples included in this library are using it (for face detection and displaying the results).

I found some nice-looking tutorials on how to use C++ libraries from JAVA:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值