Browse Source

返回车牌识别率

master
wanghongjun 1 month ago
parent
commit
0e550dbf36
  1. 7
      app/Console/Commands/VehicleEntryAndExit.php
  2. 16
      app/Services/Device/CameraDeviceService.php

7
app/Console/Commands/VehicleEntryAndExit.php

@ -36,11 +36,14 @@ class VehicleEntryAndExit extends Command
$ip = $item['camera_ip'];
$ParkingNo = '';
$imageData = '';
$confidenceLevel = '';
$date_time = date('Y-m-d H:i:s', time());
try {
$MNPRData = CameraDeviceService::query($ip)->getTrafficMNPR();
if ($MNPRData['licensePlate']) {
$ParkingNo = $MNPRData['licensePlate'];
$imageData = $MNPRData['images_data'];
$confidenceLevel = $MNPRData['confidenceLevel'];
}
} catch (\Exception $e) {
continue;
@ -50,8 +53,10 @@ class VehicleEntryAndExit extends Command
'number' => $item['number'],
'license_plate_number' => $ParkingNo,
'image_data' => base64_encode($imageData),
'date_time' => date('Y-m-d H:i:s', time()),
'confidenceLevel' => $confidenceLevel,
'date_time' => $date_time,
];
dd($data);
}
// 返回告诉设备状态情况
CameraApiService::query()->putCameraPlateNoBody(['list' => $data]);

16
app/Services/Device/CameraDeviceService.php

@ -111,8 +111,10 @@ class CameraDeviceService extends BaseService
// 抓拍车位车牌及现场图片
#[ArrayShape([
'licensePlate' => "mixed|string",
'images_data' => "mixed|string"
'licensePlate' => "mixed|string", // 车牌号码
'images_data' => "mixed|string", // 场景图
'confidenceLevel' => "mixed|string", // 识别度
'dateTime' => "mixed|string" //
])] public function getTrafficMNPR(int $channels_id = 1): array
{
$url = $this->getUrl($this->TRAFFIC_MNPR . $channels_id);
@ -120,8 +122,10 @@ class CameraDeviceService extends BaseService
$body = $response->body();
$parsed = CommonService::parseMultipart($body);
$data = [
'licensePlate' => '',
'images_data' => ''
'licensePlate' => '',
'images_data' => '',
'confidenceLevel' => '',
'dateTime' => ''
];
if ($parsed['xml'] && is_array($parsed['xml'])) {
if (isset($parsed['xml']['ANPR']['licensePlate'])) {
@ -129,6 +133,10 @@ class CameraDeviceService extends BaseService
if ($licensePlate != '无车牌') {
$data['licensePlate'] = $licensePlate;
}
$data['confidenceLevel'] = $parsed['xml']['ANPR']['confidenceLevel'];
}
if (isset($parsed['xml']['dateTime'])) {
$data['dateTime'] = $parsed['xml']['dateTime'];
}
}
if ($data['licensePlate'] && $parsed['images'] && is_array($parsed['images'])) {

Loading…
Cancel
Save