afr_fsdkinte***ce engine=new
afr_fsdkengine
();//用來存放提取到的人臉資訊, face_1 是註冊的人臉,face_2 是要識別的人臉
afr_fsdkface face1
=new
afr_fsdkface
();afr_fsdkface face2
=new
afr_fsdkface
();afr_fsdkerror error
=engine
.afr_fsdk_initialengine(,
"sdkkey"
);log.d
("com.arcsoft"
,"afr_fsdk_initialengine = "
+error
.getcode
());
//輸入的 data 資料為 nv21 格式(如 camera 裡 nv21 格式的 preview 資料);人臉座標一般使用人臉檢測返回的 rect 傳入;人臉角度請按照人臉檢測引擎返回的值傳入。
error
=engine
.afr_fsdk_extractfrfeature
(data1
,width
,height
,afr_fsdkengine
.cp_paf_nv21
,new
rect
(210
,178
,478
,446
),afr_fsdkengine
.afr_foc_0
,face1
);log.d
("com.arcsoft"
,"face="
+face1
.getfeaturedata
()[0
]+","
+face1
.getfeaturedata
()[1]+
","+
face1
.getfeaturedata
()[2]+
","+
error
.getcode
());
error
=engine
.afr_fsdk_extractfrfeature
(data1
,width
,height
,afr_fsdkengine
.cp_paf_nv21
,new
rect
(210
,170
,470
,440
),afr_fsdkengine
.afr_foc_0
,face2
);log.d
("com.arcsoft"
,"face="
+face2
.getfeaturedata
()[0
]+","
+face2
.getfeaturedata
()[1]+
","+
face2
.getfeaturedata
()[2]+
","+
error
.getcode
());
//score 用於存放人臉對比的相似度值
afr_fsdkmatching score
=new
afr_fsdkmatching
();error
=engine
.afr_fsdk_facepairmatching
(face1
,face2
,score
);log.d
("com.arcsoft"
,"afr_fsdk_facepairmatching="
+error
.getcode
());
log.d(
"com.arcsoft"
,"score:"
+score
.getscore
());
//銷毀人臉識別引擎
error
=engine
.afr_fsdk_uninitialengine
();log.d
("com.arcsoft"
,"afr_fsdk_uninitialengine : "
+error
.getcode
());
虹軟人臉識別C demo
同理新增附加庫目錄,如下圖所示 附加依賴項 將兩個dll複製到程式執行的目錄裡面 按照上面的步驟配置完環境後,接下來進行測試 的讀取要用到opencv,我就假設大家opencv配置均不存在問題 下面的 為我參考的官方給的一些資料,但是我用的opencv是3.4的,因此程式有些小小的改動,具體可參考如...
虹軟人臉識別Android Sample Code
afr fsdkinte ce engine new afr fsdkengine 用來存放提取到的人臉資訊,face 1 是註冊的人臉,face 2 是要識別的人臉 afr fsdkface face1 new afr fsdkface afr fsdkface face2 new afr fsd...
C 實現人臉識別一 (運用虹軟人臉識別引擎)
arcsoft.com.cn ai arcfa ce.html 動態呼叫 p invoke 我們可以將c或者c 的函式封裝成com元件,在c 中呼叫時比較方便,但是com元件需要註冊,而且多次註冊可能也會導致一些問題,同時在處理c或者c 的型別與com元件的型別轉換的時候也可能有些麻煩 採用動態的方...