- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是一名学生。最近我一直在使用 opencv 构建一个人脸识别项目,但我不知道从哪里开始。
通过阅读 opencv 人脸检测示例,我成功地使用 OpenCv4Android 构建了我的人脸检测。
现在我开始构建 人脸识别 (使用 LBPH 算法)部分,我阅读了 Opencv 文档并在谷歌搜索我可以实际遵循的教程,但我失败了(有很多使用 javacv 的教程,但我想改用 OpenCv4Android):(
任何人都可以帮助我一步一步地指导我应该如何在 OpenCV4Android SDK 中使用人脸识别?非常感谢你。
额外的:
最佳答案
在 java 包装器代码生成过程中跳过了 createFisherFaceRecognizer() 方法(以及其他 2 个 createXXXFaceRecognizer()),这是一个已知但尚未解决的问题。
最好的解决方案可能是使用 jni/ndk 来实现它。您将必须构建:
#include "jni.h"
#include "opencv2/contrib/contrib.hpp"
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT jlong JNICALL Java_FisherFaceRecognizer_createFisherFaceRecognizer_10(JNIEnv* env, jclass);
JNIEXPORT jlong JNICALL Java_FisherFaceRecognizer_createFisherFaceRecognizer_10(JNIEnv* env, jclass) {
try {
cv::Ptr<cv::FaceRecognizer> pfr = cv::createFisherFaceRecognizer();
pfr.addref(); // this is for the 2.4 branch, 3.0 would need a different treatment here
return (jlong) pfr.obj;
} catch (...) {
jclass je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, "sorry, dave..");
}
return 0;
}
JNIEXPORT jlong JNICALL Java_FisherFaceRecognizer_createFisherFaceRecognizer_11(JNIEnv* env, jclass, jint num_components);
JNIEXPORT jlong JNICALL Java_FisherFaceRecognizer_createFisherFaceRecognizer_11(JNIEnv* env, jclass, jint num_components) {
try {
cv::Ptr<cv::FaceRecognizer> pfr = cv::createFisherFaceRecognizer(num_components);
pfr.addref();
return (jlong) pfr.obj;
} catch (...) {
jclass je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, "sorry, dave..");
}
return 0;
}
JNIEXPORT jlong JNICALL Java_FisherFaceRecognizer_createFisherFaceRecognizer_12(JNIEnv* env, jclass, jint num_components, jdouble threshold);
JNIEXPORT jlong JNICALL Java_FisherFaceRecognizer_createFisherFaceRecognizer_12(JNIEnv* env, jclass, jint num_components, jdouble threshold) {
try {
cv::Ptr<cv::FaceRecognizer> pfr = cv::createFisherFaceRecognizer(num_components,threshold);
pfr.addref();
return (jlong) pfr.obj;
} catch (...) {
jclass je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, "sorry, dave..");
}
return 0;
}
#ifdef __cplusplus
}
#endif
import org.opencv.contrib.FaceRecognizer;
import org.opencv.core.Core;
public class FisherFaceRecognizer extends FaceRecognizer {
static{ System.loadLibrary("facerec"); }
private static native long createFisherFaceRecognizer_0();
private static native long createFisherFaceRecognizer_1(int num_components);
private static native long createFisherFaceRecognizer_2(int num_components, double threshold);
public FisherFaceRecognizer () {
super(createFisherFaceRecognizer_0());
}
public FisherFaceRecognizer (int num_components) {
super(createFisherFaceRecognizer_1(num_components));
}
public FisherFaceRecognizer (int num_components, double threshold) {
super(createFisherFaceRecognizer_2(num_components, threshold));
}
}
FaceRecognizer facerec = new FisherFaceRecognizer();
facerec.load("/sdcard/smile.yml"); // note, that it can't read from apk or zip, so you need to copy it somewhere
Mat img = ...//test face
int [] label = new int[1];
double [] conf = new double[1];
facerec.predict(img, label, conf);
关于android - 人脸识别使用Opencv4Android SDK教程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25830660/
我正在寻找一种用C# 编写的人脸、情感和语音识别方法。对于人脸识别,我早期使用的是 Emgu CV,它不准确,而且在弱光条件下性能非常低。我还需要找到用户的情绪。不管是悲伤还是快乐。但我发现使用 Em
我正在尝试使用 Apple 的 ARKit 3.0(Reality Kit)设置面部 anchor 但失败了。1. 以前只支持前置摄像头。现在还是这样吗?2.如何让Reality Kit的ARView
当我调试人脸 API 时抛出以下错误。 UnknownHostException@830035410936}“java.net.UnknownHostException:无法解析主机“api.proj
用例如下 我们的系统中有面孔列表 用户将上传一张图片 我们希望显示与上传图像匹配的面孔列表,例如置信度 >0.8 现在查看how to ,我的理解如下 使用人脸检测API,我们需要首先上传所有图像,包
用例如下 我们的系统中有面孔列表 用户将上传一张图片 我们希望显示与上传图像匹配的面孔列表,例如置信度 >0.8 现在查看how to ,我的理解如下 使用人脸检测API,我们需要首先上传所有图像,包
我正在寻找一种完美的方法来平滑二进制图像的边缘。问题是二值图像似乎是一个阶梯状的边界,这对我进一步的掩蔽过程来说非常不愉快。 我附加了一个原始二进制图像,该图像将被转换为平滑边缘,并且我还提供了预期的
我需要一个 java 库来确定哪个图像是“人体”;这是一张“人脸”;这是一个“动物”;这是一个“风景”等等。 有这样的东西吗? 谢谢 最佳答案 我不认为那里有什么方便的东西。特别是因为你在这里有非常广
自从过去 2 天以来,我一直在努力弄清楚出了什么问题?我正在使用 Microsoft 认知服务开发用于人脸识别的 Cordova android 应用程序。为了拍摄图像,我使用了 Cordova Ca
我是一名优秀的程序员,十分优秀!