feat: [video] 좌표 검증 및 영상 메타데이터를 analysis_data에 저장
- 각 step별 검증 결과 저장 (accurate/corrected + 원본 좌표) - 스크린 단위 검증 통계 저장 (정확/보정 수, 검증 시각) - 영상 완료 시 _output 메타데이터 저장 (경로, GCS, 비용, 슬라이드수, 총 재생시간)
This commit is contained in:
@@ -624,9 +624,28 @@ private function runCoordinateVerification(string $imagePath, array $parsed): ar
|
||||
// Gemini 2-pass 검증 호출
|
||||
$verifiedSteps = $this->verifyCoordinates($verificationImagePath, $stepsWithElement);
|
||||
|
||||
// 보정 적용
|
||||
// 보정 적용 + 검증 메타데이터 저장
|
||||
$parsed = $this->applyVerifiedCoordinates($parsed, $verifiedSteps);
|
||||
|
||||
// 스크린 단위 검증 통계 저장
|
||||
$accurateCount = 0;
|
||||
$correctedCount = 0;
|
||||
if ($verifiedSteps) {
|
||||
foreach ($verifiedSteps as $v) {
|
||||
if ($v['accurate'] ?? true) {
|
||||
$accurateCount++;
|
||||
} else {
|
||||
$correctedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$parsed['_verification'] = [
|
||||
'verified_at' => now()->toIso8601String(),
|
||||
'total_steps' => count($stepsWithElement),
|
||||
'accurate' => $accurateCount,
|
||||
'corrected' => $correctedCount,
|
||||
];
|
||||
|
||||
// 검증 이미지 정리
|
||||
if (file_exists($verificationImagePath)) {
|
||||
@unlink($verificationImagePath);
|
||||
@@ -916,7 +935,9 @@ private function applyVerifiedCoordinates(array $parsed, ?array $verifiedSteps):
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! ($verification['accurate'] ?? true)) {
|
||||
$isAccurate = $verification['accurate'] ?? true;
|
||||
|
||||
if (! $isAccurate) {
|
||||
$oldX = $step['focused_element']['x'];
|
||||
$oldY = $step['focused_element']['y'];
|
||||
$oldW = $step['focused_element']['w'];
|
||||
@@ -927,11 +948,21 @@ private function applyVerifiedCoordinates(array $parsed, ?array $verifiedSteps):
|
||||
$step['focused_element']['w'] = $verification['corrected_w'] ?? $oldW;
|
||||
$step['focused_element']['h'] = $verification['corrected_h'] ?? $oldH;
|
||||
|
||||
// 보정 전 좌표를 메타데이터로 저장
|
||||
$step['focused_element']['_verification'] = [
|
||||
'accurate' => false,
|
||||
'original' => ['x' => $oldX, 'y' => $oldY, 'w' => $oldW, 'h' => $oldH],
|
||||
];
|
||||
|
||||
Log::info("ScreenAnalysis: 좌표 보정 Step {$stepNum}", [
|
||||
'label' => $step['focused_element']['label'] ?? '?',
|
||||
'before' => "x={$oldX}, y={$oldY}, w={$oldW}, h={$oldH}",
|
||||
'after' => "x={$step['focused_element']['x']}, y={$step['focused_element']['y']}, w={$step['focused_element']['w']}, h={$step['focused_element']['h']}",
|
||||
]);
|
||||
} else {
|
||||
$step['focused_element']['_verification'] = [
|
||||
'accurate' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
unset($step);
|
||||
|
||||
Reference in New Issue
Block a user