资源描述:
《基于Dragonboard 410c android系统实现人的眼球识别功能.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、基于Dragonboard410candroid系统实现人的眼球识别功能 图1.Dragonboard410c开发板(android系统) 图2.显示器 图3.HDMI线 图4.罗技C525(usbcamera)二移植opencv库: 1.下载地址:http://opencv.org/downloads.html 2.移植步骤:大家可以参照Android使用OpenCV的方法案例,包括如何可以通过省略openncv_manger.apk的方式实现整体移植。 3.搭好环境后,最主要是加入我们上传的例程:Eye_rec
2、ogniTIon.rar,并编译运行(官网的opencv可不提供这个功能,笔者可是无私奉献给大家哈)。三关键代码:#include#include#include#include#include#include#defineLOG_TAG“FaceDetecTIon/DetectionBasedTracker”#defineLOGD(...)((void)__android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__))usingnamespacestd;usingnamespacecv;in
3、linevoidvector_Rect_to_Mat(vectorRect>&v_rect,Mat&mat){mat=Mat(v_rect,true);}JNIEXPORTjlongJNICALLJava_org_opencv_samples_fd_DetectionBasedTracker_nativeCreateObject(JNIEnv*jenv,jclass,jstringjFileName,jintfaceSize){constchar*jnamestr=jenv->GetStringUTFChars(jFileName,NULL);
4、stringstdFileName(jnamestr);jlongresult=0;try{DetectionBasedTracker::ParametersDetectorParams;if(faceSize>0)DetectorParams.minObjectSize=faceSize;result=(jlong)newDetectionBasedTracker(stdFileName,DetectorParams);}catch(cv::Exceptione){LOGD(“nativeCreateObjectcatchedcv::Exce
5、ption:%s”,e.what());jclassje=jenv->FindClass(“org/opencv/core/CvException”);if(!je)je=jenv->FindClass(“java/lang/Exception”);jenv->ThrowNew(je,e.what());}catch(...){LOGD(“nativeCreateObjectcatchedunknownexception”);jclassje=jenv->FindClass(“java/lang/Exception”);jenv->ThrowN
6、ew(je,“UnknownexceptioninJNIcode{highgui::VideoCapture_n_1VideoCapture__()}”);return0;}returnresult;}JNIEXPORTvoidJNICALLJava_org_opencv_samples_fd_DetectionBasedTracker_nativeDestroyObject(JNIEnv*jenv,jclass,jlongthiz){try{((DetectionBasedTracker*)thiz)->stop();delete(Detec
7、tionBasedTracker*)thiz;}catch(cv::Exceptione){LOGD(“nativeestroyObjectcatchedcv::Exception:%s”,e.what());jclassje=jenv->FindClass(“org/opencv/core/CvException”);if(!je)je=jenv->FindClass(“java/lang/Exception”);jenv->ThrowNew(je,e.what());}catch(...){LOGD(“nativeDestroyObject
8、catchedunknownexception”);jclassje=jenv->FindClass(“java/lang/Exception”);j