您好, 歡迎來到智能制造網(wǎng)! 登錄| 免費(fèi)注冊| 產(chǎn)品展廳| 收藏商鋪|
當(dāng)前位置:廣東東控智能科技有限公司>>人臉識別比對系統(tǒng)>>人臉識別比對算法>> 3.3ZK人臉識別算法
參 考 價(jià) | 面議 |
產(chǎn)品型號
品 牌
廠商性質(zhì)代理商
所 在 地
更新時(shí)間:2023-02-23 07:13:51瀏覽次數(shù):241次
聯(lián)系我時(shí),請告知來自 智能制造網(wǎng) com.zkteco.android.biometric.ZKLiveFaceService
static { System.loadLibrary("zkdnnapi"); System.loadLibrary("zkdnnfd"); System.loadLibrary("zkipbase"); System.loadLibrary("msvcr100"); System.loadLibrary("msvcp100"); System.loadLibrary("opencv_highgui2410"); System.loadLibrary("opencv_core2410"); System.loadLibrary("zksface"); System.loadLibrary("ZKLiveFace"); }
[函數(shù)] public native static int getHardwareId(byte[] hwid, int[] size); [功能] 獲取機(jī)器碼 [參數(shù)] hwId[out] 返回機(jī)器碼(建議預(yù)分配256字節(jié),足夠使用) size[in/out] [in]:hwId內(nèi)存大小(字節(jié)數(shù)) [out]:實(shí)際返回hwId長度 [返回值] 錯(cuò)誤碼(見附錄1) [示例] byte[] hwid = new byte[256]; int[] size = new int[1]; size[0] = 256; if (0 == ZKLiveFaceService.getHardwareId(hwid, size)) { String hwidStr = new String(hwid, 0, size[0]); } [備注] 暫不支持
[函數(shù)] public native static int getLastError(long context,byte[] lasterror, int[] size); [功能] 返回最近一次的錯(cuò)誤信息 [參數(shù)] context[in] 算法實(shí)例指針(允許傳NULL),當(dāng)傳的不為NULL時(shí)為該實(shí)例的最近一次錯(cuò)誤(錯(cuò)誤碼為11時(shí)可調(diào)用該接口獲取錯(cuò)誤描述) lasterror[out] 錯(cuò)誤信息(建議預(yù)分配512字節(jié),足夠使用) size[in/out] [in]:version內(nèi)存大小(字節(jié)數(shù)) [out]:實(shí)際返回lasterror長度 [返回值] 錯(cuò)誤碼(見附錄1)(該接口返回失敗,一般錯(cuò)誤原因是分配的內(nèi)存不足) [備注] 暫不支持
[函數(shù)] public native static int version(byte[] version, int[] size); [功能] 獲取版本號 [參數(shù)] version[out] 返回版本號(建議預(yù)分配32字節(jié)以上) size[in/out] [in]:version內(nèi)存大小(字節(jié)數(shù)) [out]:實(shí)際返回version長度 [返回值] 錯(cuò)誤碼(見附錄1) [示例] byte[] version = new byte[256]; int[] size = new int[1]; size[0] = 256; if (0 == ZKLiveFaceService.version(version, size)) { String verStr = new String(version, 0, size[0]); }
[函數(shù)] public native static int loadImage(String fileName, byte[] rawImage, int[] width, int[] height, int[] size); [功能] 加載圖片文件并轉(zhuǎn)換為BGR格式圖像數(shù)據(jù) [參數(shù)] fileName[in] 文件全路徑(支持的格式有:png, bmp, tif, jpg) rawImage[out] BGR格式圖像數(shù)據(jù),請參考備注1的說明,得到要預(yù)分配的內(nèi)存長度。返回原始圖數(shù)據(jù) width[out] 返回圖像寬 height[out] 返回圖像高 size[in/out] [in]:rawImage分配內(nèi)存大小 [out]:實(shí)際返回rawImage數(shù)據(jù)長度 [返回值] 錯(cuò)誤碼(見附錄1) [示例] byte[] rawImage = null; int[] width = new int[1]; int[] height = new int[1]; int[] size = new int[1]; int ret = 0; if (0 == (ret = ZKLiveFaceService.loadImage(fileName, rawImage, width, height, size))) { rawImage = new byte[size[0]]; ret = ZKLiveFaceService.loadImage(fileName, rawImage, width, height, size); ... } [備注] 1、rawImage為NULL時(shí),接口調(diào)用成功則width,height返回原始圖像的寬和高,size即為圖像大小(應(yīng)分配的內(nèi)存大小) 2、默認(rèn)獲取到的原始圖像數(shù)據(jù)為:BGR圖像位深度為24位的原始圖像數(shù)據(jù)
[函數(shù)] public native static int loadImageFromMemoryExt(byte[] ImageFileData ,int cbImageFileData,byte[] rawImage, int[] width, int[] height, int[] size); [功能] 加載圖片文件數(shù)據(jù)轉(zhuǎn)并轉(zhuǎn)換為BGR格式圖像數(shù)據(jù) [參數(shù)] ImageFileData[in] 圖像的文件數(shù)據(jù)(支持的格式有:png, bmp, jpg) cbImageFileData[in] 圖像的文件數(shù)據(jù)的大小 rawImage[out] BGR格式圖像數(shù)據(jù),請參考備注1的說明,得到要預(yù)分配的內(nèi)存長度。 width[out] 返回圖像寬 height[out] 返回圖像高 size[in/out] [in]:rawImage分配內(nèi)存大小 [out]:實(shí)際返回rawImage數(shù)據(jù)長度 [返回值] 錯(cuò)誤碼(見附錄1) [備注] 1、rawImage為NULL時(shí),接口調(diào)用成功則width,height返回原始圖像的寬和高,size即為圖像大小(應(yīng)分配的內(nèi)存大小) 2、默認(rèn)獲取到的原始圖像數(shù)據(jù)為:BGR圖像位深度為24位的原始圖像數(shù)據(jù)
[函數(shù)] public native static int init(long[] context); [功能] 初始化算法庫 [參數(shù)] context[out] 返回算法實(shí)例指針(context[0]) [返回值] 錯(cuò)誤碼(見附錄1) [示例] long context[] = new long[1]; int ret = ZKFaceService.init(context); if (0 == ret) { System.out.print("Init succ, context=" + context[0]); } else { System.out.print("Init failed, error code=" + ret); } [返回值] 錯(cuò)誤碼 [示例] long[] retContext = new long[1]; int ret = ZKLiveFaceService.init(retContext); if (0 == ret) { context = retContext[0]; } ... [備注] 1、調(diào)用初始接口成功后可以調(diào)用setParameter來設(shè)置探測人臉數(shù)、、1:1比對閥值具體設(shè)置步驟及相關(guān)參數(shù)說明可以參考setParameter接口說明
[函數(shù)] public native static int setParameter(long context, int code, byte[] value, int size); [功能] 設(shè)置參數(shù) [參數(shù)] context[in] 算法實(shí)例指針 code[in] 參數(shù)代碼(見附錄2) value[in] 參數(shù)值 size[in] 數(shù)據(jù)長度(字節(jié)數(shù)) [返回值] 錯(cuò)誤碼(見附錄1) [備注] 1、設(shè)置探測人臉數(shù)(默認(rèn)為10)、1:1比對閥值、參數(shù)值為純數(shù)字字符串。例如設(shè)置的參數(shù)值為:"8"。 2、如果調(diào)用設(shè)置許可文件路徑或者許可文件數(shù)據(jù),在初始化前調(diào)用,此時(shí)算法句柄context傳0。 3、相關(guān)的參數(shù)說明和參數(shù)代碼可見附錄2詳細(xì)說明 [示例] String maxFaceCnt = "8"; int ret = ZKLiveFaceService.setParameter(context, 1008, maxFaceCnt.getBytes(), maxFaceCnt.length());
[函數(shù)] public native static int getParameter(long context, int code, byte[] value, int[] size); [功能] 獲取參數(shù) [參數(shù)] context[in] 算法實(shí)例指針 code[in] 參數(shù)代碼(見附錄2) value[out] 參數(shù)值 size[in/out] [in]:value分配數(shù)據(jù)長度 [out]:實(shí)際返回參數(shù)數(shù)據(jù)長度 [返回值] 錯(cuò)誤碼(見附錄1) [備注] 1、獲取探測人臉數(shù)、1:1比對閥值,獲取到的參數(shù)值為純數(shù)字字符串。例如獲取探測人臉數(shù),返回的參數(shù)值為:"10"。
[函數(shù)] public native static int detectFaces(long context, byte[] rawImage, int width, int height, int[] detectedFaces); [功能] 探測人臉 [參數(shù)] context[in] 算法實(shí)例指針 rawImage[in] 原始圖像數(shù)據(jù)(見loadImage) width[in] 圖像寬 height[in] 圖像高 detectedFaces[out] 探測到人臉數(shù)(<=探測人臉數(shù)(PARAM_CODE_MAX_FACE)) [返回] 錯(cuò)誤碼(見附錄1) [備注] 1、rawImage默認(rèn)為:BGR圖像位深度為24位的原始圖像數(shù)據(jù) 2、該接口為非線程安全接口。 [示例] int[] detectedFaces = new int[1]; int ret = ZKLiveFaceService.detectFaces(context, rawImage, width, height, detectedFaces); ...
[函數(shù)] public native static int detectFacesExt(long context, byte[] rawImage, int width, int height, int[] detectedFaces,int colortype); [功能] 探測人臉 [參數(shù)] context[in] 算法實(shí)例指針 rawImage[in] 原始圖像數(shù)據(jù)(見loadImage) width[in] 圖像寬 height[in] 圖像高 detectedFaces[out] 探測到人臉數(shù)(<=探測人臉數(shù)(PARAM_CODE_MAX_FACE)) colortype[in] 圖片色彩類型(備注:0:表示灰度圖像位深度為8位 1:表示BGR圖像位深度為24位 ) 建議使用BGR圖像位深度為24位的圖片 [返回] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int terminate(long context); [功能] 釋放算法資源 [參數(shù)] context[in] 算法實(shí)例指針 [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int getFaceContext(long context, int faceIdx, long[] faceContext); [功能] 獲取人臉實(shí)例指針 [參數(shù)] context[in] 算法實(shí)例指針 faceIdx[in] 人臉?biāo)饕?見ZKFace_DetectFaces,0~[detectedFaces-1]) faceContext[out] 返回人臉實(shí)例指針 [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int setThumbnailParameter(long context, int thumbnailWidth, int thumbnailHeight, float thumbnailScale, float thumbnailQuality); [功能] 設(shè)置小圖像壓縮參數(shù) [參數(shù)] context[in] 算法實(shí)例指針 thumbnailWidth[in] 縮略圖圖像寬度((范圍:32~1024)默認(rèn)值為:192(建議使用該值)) thumbnailHeight[in] 縮略圖圖像高度((范圍:32~1024) 默認(rèn)值為:256(建議使用該值)) thumbnailScale[in] 要縮略的尺度(范圍:0.1~1)默認(rèn)值為:0.6(建議使用該值) thumbnailScale[in] 縮略圖的質(zhì)量(范圍:0~100)默認(rèn)值為:32(建議使用該值) [返回值] 錯(cuò)誤碼(見附錄1) [備注] 該函數(shù)應(yīng)該在調(diào)用探測人臉數(shù)接口(detectFaces或者detectFacesExt)前調(diào)用方可生效 [備注] 暫不支持
[函數(shù)] public native static int getCropImageData(long faceContext, int[] cropWidth, int[] cropHeight, int[] cropLength, byte[] rawCroppedImage); [功能] 獲取小圖像數(shù)據(jù)(RGB圖像位深度為24位圖像數(shù)據(jù)) [參數(shù)] faceContext[in] 人臉實(shí)例指針 cropWidth[out] 縮略圖圖像寬度 cropHeight[out] 縮略圖圖像高度 cropLength[in/out] [in]:rawCroppedImage內(nèi)存大小 [out]:實(shí)際返回圖像數(shù)據(jù)大小 rawCroppedImage 返回圖像數(shù)據(jù)(RGB圖像位深度為24位圖像數(shù)據(jù)) [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int getFaceFeature(long faceContext, int featureID, int[] pX, int[] pY, int[] score); [功能] 獲取特征 [參數(shù)] faceContext[in] 人臉實(shí)例指針 featureID[in] 特征ID(見附錄4) pX[out] 返回X坐標(biāo) pY[out] 返回Y坐標(biāo) score[out] 返回分?jǐn)?shù)(預(yù)留參數(shù)) [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int getFaceICaoFeature(long faceContext, int featureID, int[] score); [功能] 獲取ICao特征 [參數(shù)] faceContext[in] 人臉實(shí)例指針 featureID[in] 特征ID(見附錄3) score[out] 返回對應(yīng)的特征值 [返回值] 錯(cuò)誤碼(見附錄1) [備注] 該接口僅供參考,有可能存在誤差
[函數(shù)] public native static int extractTemplate(long faceContext, byte[] template, int[] size, int[] resverd); [功能] 提取人臉模板 [參數(shù)] faceContext[in] 人臉實(shí)例指針 temlpate[out] (建議預(yù)分配2048個(gè)字節(jié),足夠使用) 人臉模板 size[in/out] [in]:template內(nèi)存分配大小 [out]:實(shí)際返回template數(shù)據(jù)長度 resverd[out] 該參數(shù)為預(yù)留參數(shù) [返回值] 錯(cuò)誤碼(見附錄1) [示例] int ret = 0; byte[] template = new byte[2048]; int[] size = new int[1]; int[] resverd = new int[1]; size[0] = 2048; ret = ZKLiveFaceService.extractTemplate(faceContext, template, size, resverd); ...
[函數(shù)] public native static int getFaceRect(long faceContext, int[] points, int cntPx); [功能] 獲取探測到人臉的矩形框 [參數(shù)] faceContext[in] 人臉實(shí)例指針 points[out] 矩形框四個(gè)坐標(biāo)點(diǎn)p0.x p0.y p1.x p1.y p2.x p2.y p3.x p3.y順序排列(順時(shí)針方向) cntPx[in] points數(shù)組大小(8) [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int closeFaceContext(long faceContext); [功能] 釋放人臉實(shí)例對象 [參數(shù)] faceContext[in] 人臉實(shí)例指針 [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int verify(long context, byte[] regTemplate, byte[] verTemplate, int[] score) [功能] 人臉1:1比對 [參數(shù)] context[in] 算法實(shí)例指針 regTemplate[in] 登記模板 verTemplate[in] 比對模板 score[out] 返回分?jǐn)?shù) [返回值] 錯(cuò)誤碼(見附錄1) [備注] 1、默認(rèn)1:1的比對閥值為60。超過即為比對成功。 2、比對分?jǐn)?shù)范圍:0~120 3、人證合一時(shí)閥值可以設(shè)置為:55~60 。普通照片時(shí):1:1人臉閥值可以設(shè)置為:80 [示例] int ret = 0; int[] score = new int[1]; ret = ZKLiveFaceService.verify(context, regTemplate, verTemplate, score);
[函數(shù)] public native static int dbAdd(long context, String faceID, byte[] regTemplate) [功能] 添加人臉模板到默認(rèn)的1:N高速緩沖區(qū) [參數(shù)] context[in] 算法實(shí)例指針 faceID[in] 人臉I(yè)D regTemplate[in] 登記模板 [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int dbDel(long context, String faceID) [功能] 從默認(rèn)的1:N高速緩沖區(qū)刪除一個(gè)人臉模板 [參數(shù)] context[in] 算法實(shí)例指針 faceID[in] 人臉I(yè)D [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbClear(long context) [功能] 清空默認(rèn)的1:N高速緩沖區(qū) [參數(shù)] context[in] 算法實(shí)例指針 [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int dbCount(long context, int[] count) [功能] 獲取默認(rèn)的1:N高速緩沖區(qū)的模板數(shù) [參數(shù)] context[in] 算法實(shí)例指針 count[out] 返回的模板個(gè)數(shù) [返回值] 錯(cuò)誤碼(見附錄1)
[函數(shù)] public native static int dbIdentify(long context, byte[] verTemplate, byte[] faceIDs, int[] score, int[] maxRetCount, int minScore, int maxScore) [功能] 1:N識別 [參數(shù)] context[in] 算法實(shí)例指針 verTemplate[in] 比對模板 faceID[out] 返回人臉I(yè)D數(shù)組 score[out] 返回比對分?jǐn)?shù) maxRetCount[in/out] [in]:返回多少個(gè) [out]:實(shí)際返回多少個(gè) minScore[in] 匹配分?jǐn)?shù)。只有要識別的人臉與數(shù)據(jù)庫中 的某一人臉模板的相似度達(dá)到該值時(shí),才能識別 成功 maxScore[in] 當(dāng)要識別人臉與數(shù)據(jù)庫中的某一人臉模板的相似 度達(dá)到該值時(shí),識別成功立即返回 [返回值] 錯(cuò)誤碼(見附錄1) [示例] int ret = 0; int[] score = new int[1]; byte[] faceIDS = new byte[256]; int[] maxRetCount = new int[1]; maxRetCount[0] = 1; //只返回1個(gè)人臉 ret = ZKLiveFaceService.dbIdentify(context, verTemplate, faceIDS, score, maxRetCount, 80, 110); ... [備注] 1、比對分?jǐn)?shù)范圍:0~160 2、匹配分?jǐn)?shù)一般設(shè)置為:80
[函數(shù)] public native static int bayerToBGR24(byte[] bayer, int width, int height, byte[] imgData) [參數(shù)] bayer bayer數(shù)據(jù) width 圖像寬 height 圖像高 imgData 圖像數(shù)據(jù) [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbVerifyByID(long context,String faceID,byte[]verTemplate,int[] score); [功能] 在默認(rèn)的1:N高速緩沖區(qū)中通過人臉I(yè)D號進(jìn)行1:1比對 [參數(shù)] context[in] 算法實(shí)例指針 faceID[in] 人臉I(yè)D verTemplate[in] 比對的模板 score[out] 返回比對分?jǐn)?shù) [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbInitExt(long context,long[] dbcontext); [功能] 初始化并創(chuàng)建1:N高速緩沖區(qū) (可以創(chuàng)建多個(gè)高速緩沖區(qū)) [參數(shù)] context[in] 算法實(shí)例指針 dbcontext[out] 返回1:N高速緩沖區(qū)實(shí)例指針 [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbAddExt(long dbcontext,String faceID,byte[] regTemplate); [功能] 添加人臉模板到1:N高速緩沖區(qū) [參數(shù)] dbcontext[in] 1:N高速緩沖區(qū)實(shí)例指針 faceID[in] 人臉I(yè)D regTemplate[in] 登記模板 [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbDelExt(long dbcontext,String faceID); [功能] 從1:N高速緩沖區(qū)中刪除一個(gè)人臉模板 [參數(shù)] dbcontext[in] 1:N高速緩沖區(qū)實(shí)例指針 faceID[in] 要?jiǎng)h除的人臉I(yè)D [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbCountExt(long dbcontext,int[] count); [功能] 獲取1:N高速緩沖區(qū)的模板數(shù) [參數(shù)] dbcontext[in] 1:N高速緩沖區(qū)實(shí)例指針 count[out] 返回模板個(gè)數(shù) [返回值] 錯(cuò)誤碼(見附錄1)。 [備注] 暫不支持
[函數(shù)] public native static int dbIdentifyExt(long dbcontext, byte[] verTemplate, byte[] faceIDs, int[] score, int[] maxRetCount, int minScore, int maxScore); [功能] 在1:N高速緩沖區(qū)中進(jìn)行1:N識別 [參數(shù)] dbcontext[in] 1:N高速緩沖區(qū)實(shí)例指針 verTemplate[in] 比對模板 faceID[out] 返回人臉I(yè)D數(shù)組 score[out] 返回比對分?jǐn)?shù) maxRetCount[in/out] [in]:返回多少個(gè) [out]:實(shí)際返回多少個(gè) minScore[in] 匹配分?jǐn)?shù)。只有要識別的人臉與數(shù)據(jù)庫中 的某一人臉模板的相似度達(dá)到該值時(shí),才能識別 成功 maxScore[in] 當(dāng)要識別人臉與數(shù)據(jù)庫中的某一人臉模板的相似 度達(dá)到該值時(shí),識別成功立即返回 [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbVerifyByIDExt(long dbcontext,String faceID,byte[] verTemplate,int[] score); [功能] 在1:N高速緩沖區(qū)中通過人臉I(yè)D號進(jìn)行1:1比對 [參數(shù)] dbcontext[in] 1:N高速緩沖區(qū)實(shí)例指針 faceID[in] 人臉I(yè)D verTemplate[in] 比對模板 cbVerTemplate[in] 比對模板長度 score[out] 返回分?jǐn)?shù) [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
[函數(shù)] public native static int dbFreeExt(long dbcontext); [功能] 釋放1:N高速緩沖區(qū)資源 [參數(shù)] dbcontext[in] 1:N高速緩沖區(qū)實(shí)例指針 [返回值] 錯(cuò)誤碼(見附錄1) [備注] 暫不支持
錯(cuò)誤碼如下表所示
錯(cuò)誤碼 | 說明 |
---|---|
-35 | 1:N比對分?jǐn)?shù)低于匹配分?jǐn)?shù) |
-1 | 未知錯(cuò)誤 |
0 | 成功 |
1 | 分配的內(nèi)存不足 |
2 | 參數(shù)出錯(cuò) |
3 | 分配內(nèi)存失敗 |
4 | 無效句柄 |
5 | 無效參數(shù)代碼 |
6 | 獲取眼間距出錯(cuò) |
7 | 人臉?biāo)饕枱o效 |
8 | 比對分?jǐn)?shù)過低 |
9 | 實(shí)際人臉的模板長度大于預(yù)分配的人臉模板長度 |
10 | 接口不支持 |
11 | 其它錯(cuò)誤 |
12 | 無效人臉I(yè)D號 |
13 | 1:N比對失敗,未找到對應(yīng)的人臉模板 |
14 | 加載動(dòng)態(tài)庫失敗 |
15 | 圖像類型參數(shù)錯(cuò)誤 |
16 | 超過1:N的容量 |
17 | 實(shí)際人臉縮略圖長度大于預(yù)分配的人臉縮略圖長度 |
22 | 初始化算法庫失敗 |
請輸入賬號
請輸入密碼
請輸驗(yàn)證碼
以上信息由企業(yè)自行提供,信息內(nèi)容的真實(shí)性、準(zhǔn)確性和合法性由相關(guān)企業(yè)負(fù)責(zé),智能制造網(wǎng)對此不承擔(dān)任何保證責(zé)任。
溫馨提示:為規(guī)避購買風(fēng)險(xiǎn),建議您在購買產(chǎn)品前務(wù)必確認(rèn)供應(yīng)商資質(zhì)及產(chǎn)品質(zhì)量。