001/* 002 * =========================================================================================== 003 * = COPYRIGHT 004 * PAX Computer Technology (Shenzhen) Co., Ltd. PROPRIETARY INFORMATION 005 * This software is supplied under the terms of a license agreement or nondisclosure 006 * agreement with PAX Computer Technology (Shenzhen) Co., Ltd. and may not be copied or 007 * disclosed except in accordance with the terms in that agreement. 008 * Copyright (C) 2017-2023 PAX Computer Technology (Shenzhen) Co., Ltd. All rights reserved. 009 * Description: // Detail description about the function of this module, 010 * // interfaces with the other modules, and dependencies. 011 * Revision History: 012 * Date Author Action 013 * 2017/04/01 PAX Create/Add/Modify/Delete 014 * =========================================================================================== 015 */ 016package com.pax.dal; 017 018import java.util.List; 019 020import com.pax.dal.entity.FaceConfig; 021import com.pax.dal.entity.FaceInfo; 022import com.pax.dal.exceptions.FaceDetectException; 023 024import android.graphics.Bitmap; 025 026/** 027 * <div class="zh">人脸识别。</div> <div class="en">Face detector.</div> 028 * 029 * @since V3.14.00 030 */ 031public interface IFaceDetector { 032 /** 033 * <div class="zh">初始化人脸识别。</div> <div class="en">Initialize face recognition.</div> 034 * 035 * @param type <div class="zh">算法类型。 036 * <ul><li>0:百富。</li> 037 * <li>1:腾讯。</li> 038 * <li>2:云从。</li> 039 * </ul></div> <div class="en">Algorithm type. 040 * <ul><li>0:Pax.</li> 041 * <li>1:Tencent.</li> 042 * </ul>2:CloudWalk.</div> 043 * 044 * @throws FaceDetectException 045 * @since V3.14.00 046 */ 047 void init(int type) throws FaceDetectException; 048 049 /** 050 * <div class="zh">配置检测项。</div> <div class="en">Configure detection item.</div> 051 * 052 * @param config <div class="zh">检测项。{@link FaceConfig}</div> <div class="en">detection item. {@link FaceConfig}</div> 053 * 054 * @throws FaceDetectException 055 * @since V3.14.00 056 */ 057 void setConfig(FaceConfig config) throws FaceDetectException; 058 059 /** 060 * <div class="zh">提取人脸特征值。</div> <div class="en">Extract face feature values.</div> 061 * 062 * @param face <div class="zh">待检测的人脸。最大支持1080p。</div> <div class="en">Face to be tested.Maximum 1080p support.</div> 063 * 064 * @return <div class="zh">人脸特征值。</div> <div class="en">Face feature values.</div> 065 * 066 * @throws FaceDetectException 067 * @since V3.14.00 068 */ 069 float[] extractFeature(Bitmap face) throws FaceDetectException; 070 071 /** 072 * <div class="zh">人脸特征对比。</div> <div class="en">Face feature comparison.</div> 073 * 074 * @param face <div class="zh">待检测的人脸。最大支持1080p。</div> <div class="en">Face to be tested.Maximum 1080p support.</div> 075 * 076 * @param feature <div class="zh">人脸特征值。</div> <div class="en">Face feature values.</div> 077 * 078 * @return <div class="zh">人脸相似度。(0, 1]。建议大于0.63表示同一个人。</div> 079 * <div class="en">Face similarity.(0, 1]. A recommendation greater than 0.63 indicates the same person.</div> 080 * 081 * @throws FaceDetectException 082 * @since V3.14.00 083 */ 084 float compare(Bitmap face, float[] feature) throws FaceDetectException; 085 086 /** 087 * <div class="zh">人脸特征对比。</div> <div class="en">Face feature comparison.</div> 088 * 089 * @param face1 <div class="zh">待检测的人脸。最大支持1080p。</div> <div class="en">Face to be tested.Maximum 1080p support.</div> 090 * 091 * @param face2 <div class="zh">待检测的人脸。最大支持1080p。</div> <div class="en">Face to be tested.Maximum 1080p support.</div> 092 * 093 * @return <div class="zh">人脸相似度。(0, 1]。建议大于0.63表示同一个人。</div> 094 * <div class="en">Face similarity.(0, 1]. A recommendation greater than 0.63 indicates the same person.</div> 095 * 096 * @throws FaceDetectException 097 * @since V3.14.00 098 */ 099 float compare(Bitmap face1, Bitmap face2) throws FaceDetectException; 100 101 /** 102 * <div class="zh">人脸特征对比。</div> <div class="en">Face feature comparison.</div> 103 * 104 * @param feature1 <div class="zh">人脸特征值。</div> <div class="en">Face feature values.</div> 105 * 106 * @param feature2 <div class="zh">人脸特征值。</div> <div class="en">Face feature values.</div> 107 * 108 * @return<div class="zh">人脸相似度。(0, 1]。建议大于0.63表示同一个人。</div> 109 * <div class="en">Face similarity.(0, 1]. A recommendation greater than 0.63 indicates the same person.</div> 110 * 111 * @throws FaceDetectException 112 * @since V3.14.00 113 */ 114 float compare(float[] feature1, float[] feature2) throws FaceDetectException; 115 116 /** 117 * <div class="zh">进行人脸检测。</div> <div class="en">Face detection.</div> 118 * 119 * @param face <div class="zh">待检测的人脸。最大支持1080p。</div> <div class="en">Face to be tested.Maximum 1080p support.</div> 120 * 121 * @return <div class="zh">人脸信息。{@link FaceInfo}</div> <div class="en">Face information.{@link FaceInfo}</div> 122 * 123 * @throws FaceDetectException 124 * @since V3.14.00 125 */ 126 List<FaceInfo> detect(Bitmap face) throws FaceDetectException; 127 128 /** 129 * <div class="zh">设置AppID。若未设置,则使用默认AppID("000001")。</div> 130 * <div class="en">Set the AppID.If not, the default AppID("000001") is used.</div> 131 * 132 * @param appId <div class="zh">6位AppID。</div> <div class="en">6 bit length AppID.</div> 133 * @throws FaceDetectException 134 * @since V3.14.00 135 */ 136 void setAppId(String appId) throws FaceDetectException; 137 138 /** 139 * <div class="zh">释放人脸识别资源。</div> <div class="en">Free face recognition resources.</div> 140 * 141 * @throws FaceDetectException 142 * @since V3.14.00 143 */ 144 void release() throws FaceDetectException; 145}