update face comparison
This commit is contained in:
@@ -175,6 +175,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $listManagement->id,
|
||||
"object_id" => $listManagement->staff_id,
|
||||
"name" => common::convert_vi_to_en($listManagement->name),
|
||||
"features" => $listManagement->allFeatures
|
||||
]);
|
||||
@@ -282,6 +283,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
@@ -300,6 +302,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "delete",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => []
|
||||
]);
|
||||
@@ -326,6 +329,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
@@ -356,6 +360,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "delete",
|
||||
"id" => $staff->id,
|
||||
"object_id" => $staff->staff_id,
|
||||
"name" => common::convert_vi_to_en($staff->name),
|
||||
"features" => []
|
||||
]);
|
||||
@@ -565,6 +570,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
@@ -597,6 +603,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "create",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
@@ -653,6 +660,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
@@ -673,6 +681,7 @@ class ListManagementController extends Controller {
|
||||
common::updateFeature([
|
||||
"cmd" => "create",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
@@ -918,4 +927,39 @@ class ListManagementController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function actionFaceComparison() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
Yii::$app->response->format = "json";
|
||||
$results = json_decode(file_get_contents("http://192.168.1.43:2305/compare", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"type" => "base64",
|
||||
"img0" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face1'])),
|
||||
"img1" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face2']))
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
return [
|
||||
"type1" => number_format($results['type1']['percent'] * 100, 2),
|
||||
"type2" => number_format($results['type2']['percent'] * 100, 2)
|
||||
];
|
||||
} else {
|
||||
$this->view->title = Yii::t("app", "SO_SANH_MAT");
|
||||
return $this->render('face-comparison', [
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionUploadFace() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$model = new \app\models\UploadForm();
|
||||
$url = $model->UploadGlobal("image" . $post['imageIndex'], ["PNG", "JPG", "JPEG", "GIF"], "comparison");
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user