shikeying
2024-01-30 1a56cbb4cc61382d67be150acb2c3a91a679a808
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.walker.openocr;
 
import com.baidu.aip.face.AipFace;
import com.walker.openocr.support.BaiduFaceRecognize;
import org.junit.Test;
 
public class BaiduFaceTest {
 
    public static final String APP_ID = "18547554";
    public static final String API_KEY = "epNhm4LRAhSpDTCB6Wfc8VQO";
    public static final String SECRET_KEY = "ICwmmmVQB7A89dhtiPfu0q8OiwDh1Qpb";
 
    private AipFace client = null;
    private BaiduFaceRecognize faceRecognize = null;
 
    @Test
    public void faceMatch(){
        this.faceRecognize = new BaiduFaceRecognize();
        this.faceRecognize.setAppId(APP_ID);
        this.faceRecognize.setApiKey(API_KEY);
        this.faceRecognize.setSecretKey(SECRET_KEY);
        this.faceRecognize.checkFaceClient();
 
        // 人脸对比(两张图片)
//        double score = faceRecognize.matchTwoImageFile("F:/图片/sfz01.jpg", "F:/图片/shl01.jpg");
        double score = faceRecognize.matchTwoImageFile("F:/图片/mike.jpg", "F:/图片/mike_card.jpg");
        System.out.println("score = " + score);
    }
}