久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何實(shí)現(xiàn)人臉對(duì)比

      php實(shí)現(xiàn)人臉對(duì)比的方法:1、創(chuàng)建一個(gè)PHP示例文件;2、查詢?nèi)四槍?duì)比接口地址;3、請(qǐng)求人臉對(duì)比接口數(shù)據(jù);4、解析數(shù)據(jù)并通過(guò)“function base64EncodeImage(){…}”和“function request(){…}”方法進(jìn)行網(wǎng)絡(luò)請(qǐng)求及圖片對(duì)比即可。

      php如何實(shí)現(xiàn)人臉對(duì)比

      php入門到就業(yè)線上直播課:進(jìn)入學(xué)習(xí)
      Apipost = Postman + Swagger + Mock + Jmeter 超好用的API調(diào)試工具:點(diǎn)擊使用

      本教程操作環(huán)境:Windows7系統(tǒng)、PHP8.1版、DELL G3電腦

      php如何實(shí)現(xiàn)人臉對(duì)比?

      人臉比對(duì)-PHP版本

      人臉對(duì)比接口查詢地址: https://www.juhe.cn/docs/api/id/264?s=cpphpcn

      用于對(duì)上傳的圖片與庫(kù)中的實(shí)際身份證照片進(jìn)行比對(duì)。

      PHP代碼如下:

      <?php  $url = "http://apis.juhe.cn/verifyface/verify";//接口地址 $key = "******************";//密鑰 $idcard = "******************";//身份證 $realname = "***";//姓名 $image_path = "E:/ocr/cc.jpg";//圖片地址 $image = base64EncodeImage($image_path);//圖片轉(zhuǎn)base64 $params = compact(['key', 'idcard', 'realname', 'image']);//組合參數(shù) $result = request($url, $params, 'post');//請(qǐng)求 var_dump($result);//結(jié)果  //圖片base64 function base64EncodeImage($img_file) {     $app_img_file = $img_file; // 圖片路徑     $fp = fopen($app_img_file, "r"); // 圖片是否可讀權(quán)限     $image_data = fread($fp, filesize($app_img_file));     $base64_image = base64_encode($image_data);     fclose($fp);     return $base64_image; }  /**網(wǎng)絡(luò)請(qǐng)求  * @param string $url 地址  * @param array $params 參數(shù)  * @param string $method 請(qǐng)求方法  * @param array $headers 請(qǐng)求頭  * @return array  */ function request($url, $params = array(), $method = "get", $headers = array()) {     if (strtolower($method) != "post") {         $method = "get";     }     if ($params) {         if (is_array($params)) {             $paramsString = http_build_query($params);         } else {             $paramsString = $params;         }     } else {         $paramsString = "";     }     if ($method == "get" && !empty($paramsString)) {         $url = $url . "?" . $paramsString;     }     // 初始化     $ch = curl_init();     curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);     curl_setopt($ch, CURLOPT_TIMEOUT, 10);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);      if (strtolower(substr($url, 0, 8)) == 'https://') {         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳過(guò)證書(shū)檢查         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 從證書(shū)中檢查SSL加密算法是否存在     }      // 請(qǐng)求頭     if (!empty($headers)) {         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);     }      // 指定post方式     if ($method == "post") {         curl_setopt($ch, CURLOPT_POST, true);         curl_setopt($ch, CURLOPT_POSTFIELDS, $paramsString);     }     curl_setopt($ch, CURLOPT_URL, $url);      // 請(qǐng)求網(wǎng)絡(luò)     $httpContent = curl_exec($ch);     $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);     // 關(guān)閉     curl_close($ch);      return array(         'httpCode' => $httpCode, // http狀態(tài)碼         'content' => $httpContent, // 網(wǎng)絡(luò)返回內(nèi)容     ); }
      登錄后復(fù)制

      接口備注:按格式提交1張人臉圖片與身份證庫(kù)中圖片進(jìn)行對(duì)比,返回相似度評(píng)分,人臉圖像100K以內(nèi),jpeg格式,最長(zhǎng)邊像素為800pi最佳。

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)