Face compare on report : ps

This commit is contained in:
VE10-Sanjeev 2022-09-16 14:03:04 +05:30
parent 923d9ef57d
commit 12f73bceb1
4 changed files with 312 additions and 234 deletions

View File

@ -893,6 +893,7 @@ class PD_Controller extends REST_Controller
$pd_details['completed_on'] = date('Y-m-d H:i:s'); $pd_details['completed_on'] = date('Y-m-d H:i:s');
log_message('ERROR', "In PD Controller (When Completed status means calling to Make FaceBoundingBox fns below"); log_message('ERROR', "In PD Controller (When Completed status means calling to Make FaceBoundingBox fns below");
// $this->toMakeFaceBoundingBox($exist_pd_details); // $this->toMakeFaceBoundingBox($exist_pd_details);
$this->toMakeFaceBoundingBox($pd_details['pd_id'],$exist_pd_details[0]['fk_lender_id']);
if(isset($pd_details['is_this_smc_pd']) && $pd_details['is_this_smc_pd'] == 1 && $pd_details['pd_status'] == COMPLETED){ if(isset($pd_details['is_this_smc_pd']) && $pd_details['is_this_smc_pd'] == 1 && $pd_details['pd_status'] == COMPLETED){
$this->load->helper('smc_creditpd'); $this->load->helper('smc_creditpd');
if(isset($pd_details['random_string'])){ if(isset($pd_details['random_string'])){
@ -4644,6 +4645,11 @@ class PD_Controller extends REST_Controller
} else { } else {
$data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid, null, null, 'common', null, 'report'); $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid, null, null, 'common', null, 'report');
} }
$db_result = $this->PD_Model->selectCustomRecords(array('facecrop'), array('fk_pd_id' => $pdid,'isactive'=>1), PDAPPLICANTSDETAILS);
$string = $db_result[0]['facecrop'];
// echo gettype($string);
$my_array = json_decode($string, true);
$data['facecrop'] = $my_array;
// echo "i ahve image"; // echo "i ahve image";
// print_r($data['pd_images']);die(); // print_r($data['pd_images']);die();
$t = 'DEFAULT DATA'; $t = 'DEFAULT DATA';
@ -5795,23 +5801,25 @@ class PD_Controller extends REST_Controller
} }
} }
$db_result = $this->PD_Model->selectCustomRecords(array('faceapi_result'), array('pd_id' => $pdid), PDTRIGGER); $db_result = $this->PD_Model->selectCustomRecords(array('facecrop'), array('fk_pd_id' => $pdid,'isactive'=>1), PDAPPLICANTSDETAILS);
$string = $db_result[0]['faceapi_result']; $string = $db_result[0]['facecrop'];
// echo gettype($string); // echo gettype($string);
$my_array = json_decode($string, true); $my_array = json_decode($string, true);
$data['facecrop'] = $my_array;
// echo gettype($my_array); // echo gettype($my_array);
if (!empty($my_array) && !empty($my_array["FaceMatches"])) { // print_r($my_array);
$data['faceapi_result'] = $my_array; // if (!empty($my_array) && !empty($my_array["FaceMatches"])) {
$arr = $my_array["FaceMatches"]; // $data['faceapi_result'] = $my_array;
log_message('ERROR', "In PD Controller to Make FaceBoundingBox FaceMatches array cnt : " . count($arr)); // $arr = $my_array["FaceMatches"];
for ($i = 0; $i < count($arr); $i++) { // log_message('ERROR', "In PD Controller to Make FaceBoundingBox FaceMatches array cnt : " . count($arr));
$data['bounding_box'][$i] = $arr[$i]['Face']['BoundingBox']; // for ($i = 0; $i < count($arr); $i++) {
$data['bounding_box'][$i]['Similarity'] = $arr[$i]['Similarity']; // $data['bounding_box'][$i] = $arr[$i]['Face']['BoundingBox'];
} // $data['bounding_box'][$i]['Similarity'] = $arr[$i]['Similarity'];
}else{ // }
$data['faceapi_result'] = array(); // }else{
$data['bounding_box'] = array(); // $data['faceapi_result'] = array();
} // $data['bounding_box'] = array();
// }
// print_r($data['add_on_pd_images']); // print_r($data['add_on_pd_images']);
// die(); // die();
@ -5827,10 +5835,6 @@ class PD_Controller extends REST_Controller
} else if ($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-RI') { } else if ($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-RI') {
$t = $this->load->view('report_templates/JSONTOREPORT_RI', $data, true); $t = $this->load->view('report_templates/JSONTOREPORT_RI', $data, true);
} else if ($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-DI' || $data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-AI' || $data['pd_master_details'][0]['customer_segment_abbr'] == 'SEP_INDV') { } else if ($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-DI' || $data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-AI' || $data['pd_master_details'][0]['customer_segment_abbr'] == 'SEP_INDV') {
// $fields = array('facecompare_result');
// $where_condition_array = array('pd_id' => $pdid);
// $data['face_compare'] = json_decode($this->PD_Model->selectCustomRecords($fields, $where_condition_array, PDTRIGGER), true);
// print_r($data['face_compare']);
$t = $this->load->view('report_templates/JSONTOREPORT_DI_AI', $data, true); $t = $this->load->view('report_templates/JSONTOREPORT_DI_AI', $data, true);
} else if ($data['pd_master_details'][0]['customer_segment_abbr'] == 'SAL') { } else if ($data['pd_master_details'][0]['customer_segment_abbr'] == 'SAL') {
$t = $this->load->view('report_templates/JSONTOREPORT_SAL', $data, true); $t = $this->load->view('report_templates/JSONTOREPORT_SAL', $data, true);
@ -10494,19 +10498,43 @@ class PD_Controller extends REST_Controller
// public function toMakeFaceBoundingBox_get(){ // public function toMakeFaceBoundingBox_get(){
public function toMakeFaceBoundingBox($master_details) public function toMakeFaceBoundingBox($pdid,$len_id){
{ // $pdid = $this->get('pd');//comment this bcoz test purpose
// $pdid = $this->get('pd');//pdid 3184 comment this // $master_details = $this->PD_Model->getPDMasterDetails($pdid);//comment this bcoz test purpose
$pdid = $master_details[0]['pd_id']; // $len_id = $master_details[0]['fk_lender_id'];//comment this bcoz test purpose
log_message('ERROR', "In PD Controller (to Make FaceBoundingBox called ) PDID : " . $pdid); log_message('ERROR', "In PD Controller (to Make FaceBoundingBox called ) PDID : " . $pdid);
$where = array('isactive' => 1, 'fk_form_id' => 18, 'fk_pd_id' => $pdid);
$details = $this->PD_Model->selectCustomRecords(array('json'), $where, PDFORMDETAILSJSON);
// echo "I have";
// print_r($rec);die();
$applicant_id_arr = array();
if (isset($details[0]['json'])) {
$json = json_decode($details[0]['json'], true);
foreach ($json['individuals'] as $key => $value) {
if ($value['is_person_met'] == 1) {
array_push($applicant_id_arr, $value['pd_co_applicant_id']);
}
}
}
$where_condition_array = array('fk_pd_id' => $pdid, 'isactive' => 1);
$where_condition_array['faceapi_result is NOT NULL'] = null;
if(!empty($applicant_id_arr)){
$where_condition_array['pd_co_applicant_id in ('.implode(",",$applicant_id_arr).')'] = null;
}
$applicants_details = $this->PD_Model->selectCustomRecords(array('pd_co_applicant_id', 'applicant_name', 'faceapi_result', 'facemark_image_generated', 'facecrop'), $where_condition_array, PDAPPLICANTSDETAILS);
if (!empty($applicants_details) && !empty($pdid)) {
log_message('ERROR', "In PD Controller (to Make FaceBoundingBox called ) Total Applicant : " . count($applicants_details));
for ($j = 0; $j < count($applicants_details); $j++) {
$bounding_box = array(); $bounding_box = array();
$img_response = array(); $img_response = array();
if (!empty($pdid)) { $apcntid = $applicants_details[$j]['pd_co_applicant_id'];
//$master_details = $this->PD_Model->getPDMasterDetails($pdid);//comment this //$master_details = $this->PD_Model->getPDMasterDetails($pdid);//comment this
if ($master_details[0]['facemark_image_generated']) { if ($applicants_details[$j]['facemark_image_generated']) {
log_message('ERROR', "In PD Controller Facemark Image Generated : " . $master_details[0]['facemark_image_generated']); log_message('ERROR', "In PD Controller Facemark Image Generated : " . $applicants_details[$j]['facemark_image_generated']);
$db_result = $this->PD_Model->selectCustomRecords(array('faceapi_result'), array('pd_id' => $pdid), PDTRIGGER); $string = $applicants_details[$j]['faceapi_result'];
$string = $db_result[0]['faceapi_result'];
// echo gettype($string); // echo gettype($string);
$my_array = json_decode($string, true); $my_array = json_decode($string, true);
// echo gettype($my_array); // echo gettype($my_array);
@ -10529,7 +10557,7 @@ class PD_Controller extends REST_Controller
if (count($img_result) > 0) { if (count($img_result) > 0) {
for ($i = 0; $i < count($img_result); $i++) { for ($i = 0; $i < count($img_result); $i++) {
$bucketname = LENDER_BUCKET_NAME_PREFIX . $master_details[0]['fk_lender_id']; $bucketname = LENDER_BUCKET_NAME_PREFIX . $len_id;
$file_name = $img_result[$i]['pd_document_name']; $file_name = $img_result[$i]['pd_document_name'];
$key = 'pd' . $pdid . '/' . $file_name; $key = 'pd' . $pdid . '/' . $file_name;
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname, $key, '+30 minutes'); $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname, $key, '+30 minutes');
@ -10560,35 +10588,37 @@ class PD_Controller extends REST_Controller
// } // }
} }
$this->db->WHERE('pd_id', $pdid)->UPDATE(PDTRIGGER, array('facecompare_result' => json_encode($img_response))); $update_where = array('pd_id', $pdid,'pd_co_applicant_id'=>$apcntid);
// $this->PD_Model->updateRecords(['facecompare_result' => json_encode($res_data)],PDTRIGGER,$where_condition_array); $this->PD_Model->updateRecords(['facecompare_result' => json_encode($img_response)], PDAPPLICANTSDETAILS, $update_where);
$data['dataStatus'] = true; log_message('ERROR', "In PD Controller to Make FaceBoundingBox Done");
$data['status'] = REST_Controller::HTTP_OK; // $data['dataStatus'] = true;
$data['msg'] = 'Success '; // $data['status'] = REST_Controller::HTTP_OK;
$data['dbRecords'] = $img_result; // $data['msg'] = 'Success ';
$data['arrDetails'] = $bounding_box; // $data['dbRecords'] = $img_result;
$data['imgResponse'] = $img_response; // $data['arrDetails'] = $bounding_box;
// $data['imgResponse'] = $img_response;
} else { } else {
log_message('ERROR', "In PD Controller to Make FaceBoundingBox No Images On DB"); log_message('ERROR', "In PD Controller to Make FaceBoundingBox No Images On DB");
$data['dataStatus'] = false; // $data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT; // $data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Faceapi Image Already Generated'; // $data['msg'] = 'Faceapi Image Already Generated';
} }
} else { } else {
log_message('ERROR', "In PD Controller to Make FaceBoundingBox Faceapi Image Already Generated"); log_message('ERROR', "In PD Controller to Make FaceBoundingBox Faceapi Image Already Generated");
//$data['dataStatus'] = false; //$data['dataStatus'] = false;
//$data['status'] = REST_Controller::HTTP_NO_CONTENT; //$data['status'] = REST_Controller::HTTP_NO_CONTENT;
//$data['msg'] = 'Faceapi Image Already Generated'; //$data['msg'] = 'Faceapi Image Already Generated';
} }
}
} else { } else {
log_message('ERROR', "In PD Controller to Make FaceBoundingBox PDID is Not Available"); log_message('ERROR', "In PD Controller to Make FaceBoundingBox Applicant is Not Available");
//$data['dataStatus'] = false; //$data['dataStatus'] = false;
//$data['status'] = REST_Controller::HTTP_NO_CONTENT; //$data['status'] = REST_Controller::HTTP_NO_CONTENT;
//$data['msg'] = 'PDID is Not Available'; //$data['msg'] = 'Applicant is Not Available';
} }
$this->response($data,REST_Controller::HTTP_OK);
// $this->response($data, REST_Controller::HTTP_OK);
} }
public function uploadPicInS3($pdid,$destination_path,$bucketname,$extension){ public function uploadPicInS3($pdid,$destination_path,$bucketname,$extension){

View File

@ -84,6 +84,7 @@ class Test extends REST_Controller {
$pdid = $this->post('pdid'); $pdid = $this->post('pdid');
$src = $this->post('src'); $src = $this->post('src');
$dest = $this->post('dest'); $dest = $this->post('dest');
$coapplicant = $this->post('applicant_id');
$src_url_type = $this->post('src_url_type'); $src_url_type = $this->post('src_url_type');
$dest_url_type = $this->post('dest_url_type'); $dest_url_type = $this->post('dest_url_type');
$res_data = array('nxt_action' => null); $res_data = array('nxt_action' => null);
@ -135,8 +136,9 @@ class Test extends REST_Controller {
} }
} }
//update face api result in main table //update face api result in main table
$where_condition_array = array('pd_id' => $pdid); //$where_condition_array = array('pd_id' => $pdid);// pdid coapplicant id get store in coapp
$this->PD_Model->updateRecords(['faceapi_result' => json_encode($res_data)],PDTRIGGER,$where_condition_array); $where_condition_array = array('pd_id' => $pdid,'isactive' => 1,'pd_co_applicant_id' => $coapplicant);
$this->PD_Model->updateRecords(['faceapi_result' => json_encode($res_data)],PDAPPLICANTSDETAILS,$where_condition_array);
//delete local files if created //delete local files if created
if($dest_url_type == 'base64') if($dest_url_type == 'base64')

View File

@ -2,47 +2,79 @@
class faceapi class faceapi
{ {
public static function toMakeFaceBoundingBox($image_name,$BoundingBox,$destination_path){ public static function toMakeFaceBoundingBox($bounding_box, $path, $file_name, $key)
log_message('ERROR',"In faceapi helper @ line no : 6 to Make FaceBoundingBox"); {
$get_image_format = explode(".",$image_name); // ($image_name,$BoundingBox,$destination_path,$extension){
$image_format = $get_image_format[1];
log_message('ERROR','In faceapi helper @ line no : 9 to Make FaceBoundingBox image_format :'.$image_format);
// print_r($get_image_format);die();
$img = imagecreatefrompng($destination_path);
// if($image_format == 'png'){
// $img = imagecreatefrompng($destination_path);
// }else if($image_format == 'jpeg'){
// $img = imagecreatefromjpeg($destination_path);
// }else if($image_format == 'jpg'){
// $img = imagecreatefromjpg($destination_path);
// }
$red = imagecolorallocate($img, 255, 0, 0); log_message('ERROR', "In faceapi helper @ line no : 6 to Make FaceBoundingBox", $path, $file_name);
$black = imagecolorallocate($img, 0, 0, 0); $file_path = $path . $file_name;
$white = imagecolorallocate($img, 255, 255, 255);
list($imagewidth, $imageheight) = getimagesize($destination_path); // $red = imagecolorallocate($img, 255, 0, 0);
// $black = imagecolorallocate($img, 0, 0, 0);
// $white = imagecolorallocate($img, 255, 255, 255);
list($imagewidth, $imageheight) = getimagesize($file_path);
log_message('ERROR', 'In faceapi helper @ line no : 25 to Make FaceBoundingBox image_width' . $imagewidth . 'image_height' . $imageheight); log_message('ERROR', 'In faceapi helper @ line no : 25 to Make FaceBoundingBox image_width' . $imagewidth . 'image_height' . $imageheight);
for($i=0;$i<count($BoundingBox);$i++){
$Left_coordinate = ($BoundingBox[$i]['Left'] * $imagewidth) ; if (count($bounding_box) > 0) {
$Top_coordinate = ($BoundingBox[$i]['Top'] * $imageheight) ; $response = array();
$Face_width = ($BoundingBox[$i]['Width'] * $imagewidth) ; $CmpBoundingBox = $bounding_box['compare_image'];
$Face_height = ($BoundingBox[$i]['Height'] * $imageheight) ; $file_path = $path . $file_name;
$Similarity = $BoundingBox[$i]['Similarity']; $info = getimagesize($file_path);
$extension = image_type_to_extension($info[2]);
$SrcBoundingBox = $bounding_box['source_image'];
if (count($CmpBoundingBox) > 0 && ($key == 'selfie_with_person_met')) {
$destination_path = $path . 'face_api_image' . $extension;
if (!copy($file_path, $destination_path)) {
log_message('ERROR', 'failed to copy');
}
$img = imagecreatefrompng($destination_path);
for ($i = 0; $i < count($CmpBoundingBox); $i++) {
$Left_coordinate = ($CmpBoundingBox[$i]['Left'] * $imagewidth);
$Top_coordinate = ($CmpBoundingBox[$i]['Top'] * $imageheight);
$Face_width = ($CmpBoundingBox[$i]['Width'] * $imagewidth);
$Face_height = ($CmpBoundingBox[$i]['Height'] * $imageheight);
$Similarity = $CmpBoundingBox[$i]['Similarity'];
$x1 = $Left_coordinate; $x1 = $Left_coordinate;
$y1 = $Top_coordinate; $y1 = $Top_coordinate;
$data = self::imgCrop($x1, $y1, $Face_width, $Face_height, $Similarity, $img, $destination_path, $i);
self::DrawLine($x1, $y1, $Face_width, $Face_height, $Similarity, $img, $destination_path); self::DrawLine($x1, $y1, $Face_width, $Face_height, $Similarity, $img, $destination_path);
self::imgCrop($x1,$y1,$Face_width,$Face_height,$Similarity,$img,$destination_path,$i); array_push($response,$data);
} }
$d['compare_image'] = $response;
return $d;
} else {
$destination_path = $path . 'src_image' . $extension;
if (!copy($file_path, $destination_path)) {
log_message('ERROR', 'failed to copy');
}
$img = imagecreatefrompng($destination_path);
$Left_coordinate = ($SrcBoundingBox['Left'] * $imagewidth);
$Top_coordinate = ($SrcBoundingBox['Top'] * $imageheight);
$Face_width = ($SrcBoundingBox['Width'] * $imagewidth);
$Face_height = ($SrcBoundingBox['Height'] * $imageheight);
$Similarity = 0;
$x1 = $Left_coordinate;
$y1 = $Top_coordinate;
$i = null;
// self::imgCrop($x1,$y1,$Face_width,$Face_height,$path,$file_name,$i);
$data = self::imgCrop($x1, $y1, $Face_width, $Face_height, $Similarity, $img, $destination_path, $i);
unlink($destination_path);
$response['source_image'] = $data;
return $response;
}
}
} }
public static function DrawLine($x1,$y1,$Face_width,$Face_height,$Similarity,$img,$destination_path){ public static function DrawLine($x1, $y1, $Face_width, $Face_height, $Similarity, $img, $destination_path)
{
log_message('ERROR', 'In faceapi helper @ line no : 45 Draw Line x1 : ' . $x1 . ' y1 : ' . $y1 . ' Face_width : ' . $Face_width . ' Face_height : ' . $Face_height . ' Similarity : ' . $Similarity . ' img : ' . $img . ' destination_path : ' . $destination_path); log_message('ERROR', 'In faceapi helper @ line no : 45 Draw Line x1 : ' . $x1 . ' y1 : ' . $y1 . ' Face_width : ' . $Face_width . ' Face_height : ' . $Face_height . ' Similarity : ' . $Similarity . ' img : ' . $img . ' destination_path : ' . $destination_path);
$Similarity_split = explode(".", $Similarity); $Similarity_split = explode(".", $Similarity);
$Similarity_value = $Similarity_split[0]; $Similarity_value = $Similarity_split[0];
@ -92,7 +124,9 @@ class faceapi
// $destination_path = $get_image_format[0].".jpeg"; // $destination_path = $get_image_format[0].".jpeg";
imagejpg($img, $destination_path); imagejpg($img, $destination_path);
} }
// $image_data = file_get_contents($destination_path);
// $base64 = base64_encode($image_data);
// return array('name' => $temp_image_name, 'base64' => $base64, 'Similarity' => $Similarity);
} }
public static function imagelinethick($image, $x1, $y1, $x2, $y2, $color, $thick = 1) public static function imagelinethick($image, $x1, $y1, $x2, $y2, $color, $thick = 1)
@ -120,8 +154,9 @@ class faceapi
return imagepolygon($image, $points, 4, $color); return imagepolygon($image, $points, 4, $color);
} }
public static function imgCrop($x1,$y1,$Face_width,$Face_height,$Similarity,$img,$destination_path,$i){ public static function imgCrop($x1, $y1, $Face_width, $Face_height, $Similarity, $img, $destination_path, $i)
$temp_image_name = "face_crop_".$i.".jpeg"; {
$temp_image_name = $i === null ? "id_proof_crop.png" : "face_crop_" . $i . ".png";
log_message('ERROR', 'In faceapi helper - imgCrop @ line no : 126 x1 : ' . $x1 . ' y1 : ' . $y1 . ' Face_width : ' . $Face_width . ' Face_height : ' . $Face_height . ' Similarity : ' . $Similarity . ' img : ' . $img . ' destination_path : ' . $destination_path); log_message('ERROR', 'In faceapi helper - imgCrop @ line no : 126 x1 : ' . $x1 . ' y1 : ' . $y1 . ' Face_width : ' . $Face_width . ' Face_height : ' . $Face_height . ' Similarity : ' . $Similarity . ' img : ' . $img . ' destination_path : ' . $destination_path);
$destination_path_2 = preg_replace('#/\w+(\.\w+)$#', '/' . $temp_image_name, $destination_path); $destination_path_2 = preg_replace('#/\w+(\.\w+)$#', '/' . $temp_image_name, $destination_path);
log_message('ERROR', 'In faceapi helper - imgCrop @ line no : 126 destination_path b4 : ' . $destination_path . ' destination_path after : ' . $destination_path_2); log_message('ERROR', 'In faceapi helper - imgCrop @ line no : 126 destination_path b4 : ' . $destination_path . ' destination_path after : ' . $destination_path_2);
@ -136,8 +171,15 @@ public static function imgCrop($x1,$y1,$Face_width,$Face_height,$Similarity,$img
} else if ($image_format == 'jpg') { } else if ($image_format == 'jpg') {
imagejpg($dest, $destination_path_2); imagejpg($dest, $destination_path_2);
} }
$image_data = file_get_contents($destination_path_2);
$base64 = base64_encode($image_data);
unlink($destination_path_2);
// if($i === null){
return array('name' => $temp_image_name, 'base64' => $base64, 'Similarity' => $Similarity);
// }else{
// return array($i => array('name' => $temp_image_name, 'base64' => $base64, 'Similarity' => $Similarity));
// }
// return array('name' => $temp_image_name, 'base64' => $base64, 'Similarity' => $Similarity);
// unlink($destination_path);
} }
} }
?>

View File

@ -1,7 +1,6 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') OR exit('No direct script access allowed');
$loan_word = $pd_master_details[0]['lender_short_name'] != 'CFPL' ? 'Loan' : 'Facility'; $loan_word = $pd_master_details[0]['lender_short_name'] != 'CFPL' ? 'Loan' : 'Facility';
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -474,7 +473,10 @@ $loan_word = $pd_master_details[0]['lender_short_name'] != 'CFPL' ? 'Loan' : 'Fa
padding: 5px; padding: 5px;
/*margin: 10px;*/ /*margin: 10px;*/
} }
.facecrop {
height: 100px;
width: 600px;
}
/* ######### TOOLTIP CSS END ######### */ /* ######### TOOLTIP CSS END ######### */
@ -732,6 +734,32 @@ if ( isset($pdf) ) {
?> ?>
<br> <br>
<?php
if(!empty($facecrop)){
$ci = !empty($facecrop[0]['compare_image']) ? $facecrop[0]['compare_image'] :array() ;
$si = !empty($facecrop[1]['source_image']) ? $facecrop[1]['source_image'] : array();
// ########################### Percentage Bar Section #########################################
echo "<h3>Face Comparison</h3>" ;
$notequal_mark ='<span style="font-family: DejaVu Sans; sans-serif;">≠</span>';
$equal_mark ='<span style="font-family: DejaVu Sans; sans-serif;">=</span>';
for ($i = 0; $i < count($ci); $i++) {
$symbol = (round($ci[$i]["Similarity"]) > 50) ? '<center><h1>'.$equal_mark.'</h1></center>': '<center><h1>'.$notequal_mark.'</h1></center>';
echo '<div><div class="facecrop">';
echo '<img src="data:image/png;base64,'. $si["base64"].'" width="50" height="50" alt="'.$si["name"].'" align="left"/>';
echo $symbol;
// if(round($ci[$i]["Similarity"]) > 50){ echo '<center><h1>'.$equal_mark.'</h1></center>'; }else{ echo '<center><h1>'.$notequal_mark.'</h1></center>'; }
echo '<img src="data:image/png;base64,'. $ci[$i]["base64"].'" width="50" height="50" alt="'.$ci[$i]["name"].'" align="right"/>';
echo '</div></div>';
echo '<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:'.round($ci[$i]["Similarity"]).'%">
'.round($ci[$i]["Similarity"]).'
</div>
</div>';
}
// echo '<div class="container"></div>';
// ########################### End of Percentage Bar Section #########################################
}
?>
<p contenteditable="true"><b><?php echo $loan_word;?> Applicants:</b></p> <p contenteditable="true"><b><?php echo $loan_word;?> Applicants:</b></p>
<table class="scorecard_table"> <table class="scorecard_table">
@ -5113,30 +5141,6 @@ if($total_no_of_business > 0) {
echo "</table>"; echo "</table>";
} }
// ########################### End Of Score Card Section ######################################### // ########################### End Of Score Card Section #########################################
// ########################### Percentage Bar Section #########################################
// print_r($faceapi_result);
// echo "**********************";
// print_r($bounding_box);
echo '<div class="container">
<h2>Face Comparison</h2>';
$equal_mark ='<span style="font-family: DejaVu Sans; sans-serif;font-size:12px">≠</span>';
$notequal_mark ='<span style="font-family: DejaVu Sans; sans-serif;font-size:12px">=</span>';
echo '<img src="admin:///opt/lampp/htdocs/ssa_external_data/testing/pd_reports/3287/IDproofV1.jpg" width="300" height="200" alt=""/>';
echo $equal_mark;
echo '<img src="admin:///opt/lampp/htdocs/ssa_external_data/testing/pd_reports/3287/face_crop_0.jpeg" width="300" height="200" alt=""/>';
echo '<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:70%">
70%
</div>
</div>';
echo '<img src="admin:///opt/lampp/htdocs/ssa_external_data/testing/pd_reports/3287/IDproofV1.jpg" width="300" height="200" alt=""/>';
echo $notequal_mark;
echo '<img src="admin:///opt/lampp/htdocs/ssa_external_data/testing/pd_reports/3287/face_crop_1.jpeg" width="300" height="200" alt=""/>';
echo'</div>';
// ########################### End of Percentage Bar Section #########################################
?> ?>