Spaces:
Sleeping
Sleeping
first commit
Browse files- .dockerignore +11 -0
- .editorconfig +9 -0
- .gitattributes +1 -35
- .gitignore +30 -0
- .prettierrc.json +6 -0
- .vscode/extensions.json +8 -0
- .vscode/settings.json +13 -0
- Dockerfile +17 -0
- README.md +35 -10
- eslint.config.js +26 -0
- index.html +13 -0
- jsconfig.json +8 -0
- package-lock.json +0 -0
- package.json +29 -0
- public/favicon.ico +0 -0
- src/App.vue +26 -0
- src/assets/base.css +109 -0
- src/assets/logo.svg +1 -0
- src/assets/main.css +24 -0
- src/components/CalibrationArea.vue +717 -0
- src/components/FootballField.vue +328 -0
- src/components/KeyboardShortcuts.vue +273 -0
- src/main.js +14 -0
- src/router/index.js +20 -0
- src/services/api.js +195 -0
- src/stores/calibration.js +107 -0
- src/stores/upload.js +159 -0
- src/views/HomeView.vue +1837 -0
- src/views/ManualView.vue +438 -0
- vite.config.js +18 -0
.dockerignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# .dockerignore
|
| 2 |
+
node_modules
|
| 3 |
+
npm-debug.log
|
| 4 |
+
.git
|
| 5 |
+
.gitignore
|
| 6 |
+
README.md
|
| 7 |
+
.env
|
| 8 |
+
.nyc_output
|
| 9 |
+
coverage
|
| 10 |
+
.coverage
|
| 11 |
+
dist
|
.editorconfig
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
|
| 2 |
+
charset = utf-8
|
| 3 |
+
indent_size = 2
|
| 4 |
+
indent_style = space
|
| 5 |
+
insert_final_newline = true
|
| 6 |
+
trim_trailing_whitespace = true
|
| 7 |
+
|
| 8 |
+
end_of_line = lf
|
| 9 |
+
max_line_length = 100
|
.gitattributes
CHANGED
|
@@ -1,35 +1 @@
|
|
| 1 |
-
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
* text=auto eol=lf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Logs
|
| 2 |
+
logs
|
| 3 |
+
*.log
|
| 4 |
+
npm-debug.log*
|
| 5 |
+
yarn-debug.log*
|
| 6 |
+
yarn-error.log*
|
| 7 |
+
pnpm-debug.log*
|
| 8 |
+
lerna-debug.log*
|
| 9 |
+
|
| 10 |
+
node_modules
|
| 11 |
+
.DS_Store
|
| 12 |
+
dist
|
| 13 |
+
dist-ssr
|
| 14 |
+
coverage
|
| 15 |
+
*.local
|
| 16 |
+
|
| 17 |
+
/cypress/videos/
|
| 18 |
+
/cypress/screenshots/
|
| 19 |
+
|
| 20 |
+
# Editor directories and files
|
| 21 |
+
.vscode/*
|
| 22 |
+
!.vscode/extensions.json
|
| 23 |
+
.idea
|
| 24 |
+
*.suo
|
| 25 |
+
*.ntvs*
|
| 26 |
+
*.njsproj
|
| 27 |
+
*.sln
|
| 28 |
+
*.sw?
|
| 29 |
+
|
| 30 |
+
*.tsbuildinfo
|
.prettierrc.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://json.schemastore.org/prettierrc",
|
| 3 |
+
"semi": false,
|
| 4 |
+
"singleQuote": true,
|
| 5 |
+
"printWidth": 100
|
| 6 |
+
}
|
.vscode/extensions.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"recommendations": [
|
| 3 |
+
"Vue.volar",
|
| 4 |
+
"dbaeumer.vscode-eslint",
|
| 5 |
+
"EditorConfig.EditorConfig",
|
| 6 |
+
"esbenp.prettier-vscode"
|
| 7 |
+
]
|
| 8 |
+
}
|
.vscode/settings.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"explorer.fileNesting.enabled": true,
|
| 3 |
+
"explorer.fileNesting.patterns": {
|
| 4 |
+
"tsconfig.json": "tsconfig.*.json, env.d.ts",
|
| 5 |
+
"vite.config.*": "jsconfig*, vitest.config.*, cypress.config.*, playwright.config.*",
|
| 6 |
+
"package.json": "package-lock.json, pnpm*, .yarnrc*, yarn*, .eslint*, eslint*, .oxlint*, oxlint*, .prettier*, prettier*, .editorconfig"
|
| 7 |
+
},
|
| 8 |
+
"editor.codeActionsOnSave": {
|
| 9 |
+
"source.fixAll": "explicit"
|
| 10 |
+
},
|
| 11 |
+
"editor.formatOnSave": true,
|
| 12 |
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
| 13 |
+
}
|
Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dockerfile - Pour Hugging Face Spaces
|
| 2 |
+
FROM node:22.14.0-alpine AS build-stage
|
| 3 |
+
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
COPY package*.json ./
|
| 6 |
+
RUN npm ci --only=production=false
|
| 7 |
+
COPY . .
|
| 8 |
+
RUN npm run build
|
| 9 |
+
|
| 10 |
+
FROM nginx:alpine AS production-stage
|
| 11 |
+
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
| 12 |
+
|
| 13 |
+
# Configuration minimale pour SPA
|
| 14 |
+
RUN echo 'server { listen 7860; location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; } }' > /etc/nginx/conf.d/default.conf
|
| 15 |
+
|
| 16 |
+
EXPOSE 7860
|
| 17 |
+
CMD ["nginx", "-g", "daemon off;"]
|
README.md
CHANGED
|
@@ -1,10 +1,35 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# soccer-field-app
|
| 2 |
+
|
| 3 |
+
This template should help get you started developing with Vue 3 in Vite.
|
| 4 |
+
|
| 5 |
+
## Recommended IDE Setup
|
| 6 |
+
|
| 7 |
+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
| 8 |
+
|
| 9 |
+
## Customize configuration
|
| 10 |
+
|
| 11 |
+
See [Vite Configuration Reference](https://vite.dev/config/).
|
| 12 |
+
|
| 13 |
+
## Project Setup
|
| 14 |
+
|
| 15 |
+
```sh
|
| 16 |
+
npm install
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
### Compile and Hot-Reload for Development
|
| 20 |
+
|
| 21 |
+
```sh
|
| 22 |
+
npm run dev
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
### Compile and Minify for Production
|
| 26 |
+
|
| 27 |
+
```sh
|
| 28 |
+
npm run build
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### Lint with [ESLint](https://eslint.org/)
|
| 32 |
+
|
| 33 |
+
```sh
|
| 34 |
+
npm run lint
|
| 35 |
+
```
|
eslint.config.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
| 2 |
+
import globals from 'globals'
|
| 3 |
+
import js from '@eslint/js'
|
| 4 |
+
import pluginVue from 'eslint-plugin-vue'
|
| 5 |
+
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
|
| 6 |
+
|
| 7 |
+
export default defineConfig([
|
| 8 |
+
{
|
| 9 |
+
name: 'app/files-to-lint',
|
| 10 |
+
files: ['**/*.{js,mjs,jsx,vue}'],
|
| 11 |
+
},
|
| 12 |
+
|
| 13 |
+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
|
| 14 |
+
|
| 15 |
+
{
|
| 16 |
+
languageOptions: {
|
| 17 |
+
globals: {
|
| 18 |
+
...globals.browser,
|
| 19 |
+
},
|
| 20 |
+
},
|
| 21 |
+
},
|
| 22 |
+
|
| 23 |
+
js.configs.recommended,
|
| 24 |
+
...pluginVue.configs['flat/essential'],
|
| 25 |
+
skipFormatting,
|
| 26 |
+
])
|
index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<link rel="icon" href="/favicon.ico">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Vite App</title>
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div id="app"></div>
|
| 11 |
+
<script type="module" src="/src/main.js"></script>
|
| 12 |
+
</body>
|
| 13 |
+
</html>
|
jsconfig.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"paths": {
|
| 4 |
+
"@/*": ["./src/*"]
|
| 5 |
+
}
|
| 6 |
+
},
|
| 7 |
+
"exclude": ["node_modules", "dist"]
|
| 8 |
+
}
|
package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "soccer-field-app",
|
| 3 |
+
"version": "0.0.0",
|
| 4 |
+
"private": true,
|
| 5 |
+
"type": "module",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"dev": "vite",
|
| 8 |
+
"build": "vite build",
|
| 9 |
+
"preview": "vite preview",
|
| 10 |
+
"lint": "eslint . --fix",
|
| 11 |
+
"format": "prettier --write src/"
|
| 12 |
+
},
|
| 13 |
+
"dependencies": {
|
| 14 |
+
"pinia": "^3.0.1",
|
| 15 |
+
"vue": "^3.5.13",
|
| 16 |
+
"vue-router": "^4.5.0"
|
| 17 |
+
},
|
| 18 |
+
"devDependencies": {
|
| 19 |
+
"@eslint/js": "^9.22.0",
|
| 20 |
+
"@vitejs/plugin-vue": "^5.2.3",
|
| 21 |
+
"@vue/eslint-config-prettier": "^10.2.0",
|
| 22 |
+
"eslint": "^9.22.0",
|
| 23 |
+
"eslint-plugin-vue": "~10.0.0",
|
| 24 |
+
"globals": "^16.0.0",
|
| 25 |
+
"prettier": "3.5.3",
|
| 26 |
+
"vite": "^6.2.4",
|
| 27 |
+
"vite-plugin-vue-devtools": "^7.7.2"
|
| 28 |
+
}
|
| 29 |
+
}
|
public/favicon.ico
ADDED
|
|
src/App.vue
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script setup>
|
| 2 |
+
import { RouterView } from 'vue-router'
|
| 3 |
+
</script>
|
| 4 |
+
|
| 5 |
+
<template>
|
| 6 |
+
<div id="app">
|
| 7 |
+
|
| 8 |
+
<main class="app-main">
|
| 9 |
+
<RouterView />
|
| 10 |
+
</main>
|
| 11 |
+
</div>
|
| 12 |
+
</template>
|
| 13 |
+
|
| 14 |
+
<style scoped>
|
| 15 |
+
#app {
|
| 16 |
+
min-height: 100vh;
|
| 17 |
+
display: flex;
|
| 18 |
+
flex-direction: column;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.app-main {
|
| 22 |
+
flex: 1;
|
| 23 |
+
background-color: var(--background-color);
|
| 24 |
+
|
| 25 |
+
}
|
| 26 |
+
</style>
|
src/assets/base.css
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* color palette personnalisée */
|
| 2 |
+
:root {
|
| 3 |
+
--vt-c-white: #ffffff;
|
| 4 |
+
--vt-c-white-soft: #f8f8f8;
|
| 5 |
+
--vt-c-white-mute: #f2f2f2;
|
| 6 |
+
|
| 7 |
+
--vt-c-black: #000000;
|
| 8 |
+
--vt-c-black-soft: #1a1a1a;
|
| 9 |
+
--vt-c-black-mute: #2d2d2d;
|
| 10 |
+
|
| 11 |
+
--vt-c-lime: #33FF6B;
|
| 12 |
+
--vt-c-lime-soft: #08c4d1cf;
|
| 13 |
+
--vt-c-lime-mute: #08c4d185;
|
| 14 |
+
/* --vt-c-lime: #08C5D1;
|
| 15 |
+
--vt-c-lime-soft: #08c4d1cf;
|
| 16 |
+
--vt-c-lime-mute: #08c4d185; */
|
| 17 |
+
/* --vt-c-lime: #FF00BF;
|
| 18 |
+
--vt-c-lime-soft: #ff00bfe2;
|
| 19 |
+
--vt-c-lime-mute: #ff00bfe9; */
|
| 20 |
+
|
| 21 |
+
--vt-c-gray: #707070;
|
| 22 |
+
--vt-c-gray-soft: #8a8a8a;
|
| 23 |
+
--vt-c-gray-light: #a0a0a0;
|
| 24 |
+
|
| 25 |
+
--vt-c-divider-light-1: rgba(112, 112, 112, 0.29);
|
| 26 |
+
--vt-c-divider-light-2: rgba(112, 112, 112, 0.12);
|
| 27 |
+
--vt-c-divider-dark-1: #ff00bfb1;
|
| 28 |
+
--vt-c-divider-dark-2: #ff00bf83;
|
| 29 |
+
|
| 30 |
+
--vt-c-text-light-1: var(--vt-c-black);
|
| 31 |
+
--vt-c-text-light-2: var(--vt-c-gray);
|
| 32 |
+
--vt-c-text-dark-1: var(--vt-c-white);
|
| 33 |
+
--vt-c-text-dark-2: var(--vt-c-gray-light);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/* semantic color variables for this project */
|
| 37 |
+
:root {
|
| 38 |
+
--color-background: var(--vt-c-white);
|
| 39 |
+
--color-background-soft: var(--vt-c-white-soft);
|
| 40 |
+
--color-background-mute: var(--vt-c-white-mute);
|
| 41 |
+
|
| 42 |
+
--color-border: var(--vt-c-divider-light-2);
|
| 43 |
+
--color-border-hover: var(--vt-c-divider-light-1);
|
| 44 |
+
|
| 45 |
+
--color-heading: var(--vt-c-text-light-1);
|
| 46 |
+
--color-text: var(--vt-c-text-light-1);
|
| 47 |
+
|
| 48 |
+
/* Nouvelles variables personnalisées */
|
| 49 |
+
--color-primary: var(--vt-c-lime);
|
| 50 |
+
--color-primary-soft: var(--vt-c-lime-soft);
|
| 51 |
+
--color-primary-mute: var(--vt-c-lime-mute);
|
| 52 |
+
|
| 53 |
+
--color-secondary: var(--vt-c-black);
|
| 54 |
+
--color-secondary-soft: var(--vt-c-black-soft);
|
| 55 |
+
|
| 56 |
+
--color-accent: var(--vt-c-gray);
|
| 57 |
+
--color-accent-soft: var(--vt-c-gray-soft);
|
| 58 |
+
--color-accent-light: var(--vt-c-gray-light);
|
| 59 |
+
|
| 60 |
+
--section-gap: 160px;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
@media (prefers-color-scheme: dark) {
|
| 64 |
+
:root {
|
| 65 |
+
--color-background: var(--vt-c-black);
|
| 66 |
+
--color-background-soft: var(--vt-c-black-soft);
|
| 67 |
+
--color-background-mute: var(--vt-c-black-mute);
|
| 68 |
+
|
| 69 |
+
--color-border: var(--vt-c-divider-dark-2);
|
| 70 |
+
--color-border-hover: var(--vt-c-divider-dark-1);
|
| 71 |
+
|
| 72 |
+
--color-heading: var(--vt-c-text-dark-1);
|
| 73 |
+
--color-text: var(--vt-c-text-dark-2);
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
*,
|
| 78 |
+
*::before,
|
| 79 |
+
*::after {
|
| 80 |
+
box-sizing: border-box;
|
| 81 |
+
margin: 0;
|
| 82 |
+
font-weight: normal;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
body {
|
| 86 |
+
min-height: 100vh;
|
| 87 |
+
color: var(--color-text);
|
| 88 |
+
background: var(--color-secondary);
|
| 89 |
+
transition:
|
| 90 |
+
color 0.5s;
|
| 91 |
+
line-height: 1.6;
|
| 92 |
+
font-family:
|
| 93 |
+
Inter,
|
| 94 |
+
-apple-system,
|
| 95 |
+
BlinkMacSystemFont,
|
| 96 |
+
'Segoe UI',
|
| 97 |
+
Roboto,
|
| 98 |
+
Oxygen,
|
| 99 |
+
Ubuntu,
|
| 100 |
+
Cantarell,
|
| 101 |
+
'Fira Sans',
|
| 102 |
+
'Droid Sans',
|
| 103 |
+
'Helvetica Neue',
|
| 104 |
+
sans-serif;
|
| 105 |
+
font-size: 15px;
|
| 106 |
+
text-rendering: optimizeLegibility;
|
| 107 |
+
-webkit-font-smoothing: antialiased;
|
| 108 |
+
-moz-osx-font-smoothing: grayscale;
|
| 109 |
+
}
|
src/assets/logo.svg
ADDED
|
|
src/assets/main.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import './base.css';
|
| 2 |
+
|
| 3 |
+
#app {
|
| 4 |
+
max-width: 1280px;
|
| 5 |
+
margin: 0 auto;
|
| 6 |
+
font-weight: normal;
|
| 7 |
+
background: var(--color-secondary);
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
a,
|
| 11 |
+
.green {
|
| 12 |
+
text-decoration: none;
|
| 13 |
+
color: hsla(160, 100%, 37%, 1);
|
| 14 |
+
transition: 0.4s;
|
| 15 |
+
padding: 3px;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@media (min-width: 1024px) {
|
| 20 |
+
body {
|
| 21 |
+
display: flex;
|
| 22 |
+
place-items: center;
|
| 23 |
+
}
|
| 24 |
+
}
|
src/components/CalibrationArea.vue
ADDED
|
@@ -0,0 +1,717 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div
|
| 3 |
+
class="video-frame-container"
|
| 4 |
+
tabindex="0"
|
| 5 |
+
ref="container"
|
| 6 |
+
@keydown="handleKeyDown"
|
| 7 |
+
@focus="handleFocus"
|
| 8 |
+
@blur="handleBlur">
|
| 9 |
+
<div class="video-frame"
|
| 10 |
+
ref="imageContainer"
|
| 11 |
+
:style="frameStyle"
|
| 12 |
+
@contextmenu.prevent
|
| 13 |
+
@wheel.prevent="handleZoom"
|
| 14 |
+
@mousedown="handleMouseDown"
|
| 15 |
+
@mousemove="handleMouseMove"
|
| 16 |
+
@mouseup="stopPan"
|
| 17 |
+
@mouseleave="stopPan">
|
| 18 |
+
<div class="image-container" :style="transformStyle">
|
| 19 |
+
<img v-if="thumbnail"
|
| 20 |
+
:src="thumbnail"
|
| 21 |
+
alt="Video frame"
|
| 22 |
+
@load="initializeImage"
|
| 23 |
+
ref="image"
|
| 24 |
+
class="video-image" />
|
| 25 |
+
<div v-for="(point, index) in calibrationPoints"
|
| 26 |
+
:key="index"
|
| 27 |
+
class="calibration-point"
|
| 28 |
+
:class="{ 'selected-point': selectedFieldPoint && Number(selectedFieldPoint.index) === Number(index) }"
|
| 29 |
+
:style="{
|
| 30 |
+
left: `${point.x}px`,
|
| 31 |
+
top: `${point.y}px`
|
| 32 |
+
}">
|
| 33 |
+
</div>
|
| 34 |
+
<div v-for="(line, id) in calibrationLines"
|
| 35 |
+
:key="'line-'+id"
|
| 36 |
+
class="calibration-polyline">
|
| 37 |
+
<svg class="polyline-svg">
|
| 38 |
+
<g v-for="(line, id) in calibrationLines" :key="id">
|
| 39 |
+
<polyline
|
| 40 |
+
:points="formatPoints(line.points)"
|
| 41 |
+
:class="{ 'selected-line': selectedFieldLine && selectedFieldLine.id === id }"
|
| 42 |
+
fill="none"
|
| 43 |
+
stroke="#00FF15"
|
| 44 |
+
stroke-width="2"
|
| 45 |
+
/>
|
| 46 |
+
<circle v-for="(point, index) in line.points"
|
| 47 |
+
:key="'point-'+index"
|
| 48 |
+
:cx="point.x"
|
| 49 |
+
:cy="point.y"
|
| 50 |
+
r="2"
|
| 51 |
+
class="polyline-point"
|
| 52 |
+
:class="{
|
| 53 |
+
'selected-line-point': selectedFieldLine && selectedFieldLine.id === id,
|
| 54 |
+
'dragging': isDraggingPoint && draggedLineId === id && selectedPointIndex === index,
|
| 55 |
+
'shared-point': sharedPoints.has(`${id}-${index}`),
|
| 56 |
+
'hoverable': isCtrlPressed && selectedFieldLine
|
| 57 |
+
}"
|
| 58 |
+
/>
|
| 59 |
+
</g>
|
| 60 |
+
</svg>
|
| 61 |
+
</div>
|
| 62 |
+
<div v-for="(point, index) in currentLinePoints"
|
| 63 |
+
:key="'temp-'+index"
|
| 64 |
+
class="calibration-point temp-point"
|
| 65 |
+
:style="{
|
| 66 |
+
left: `${point.x}px`,
|
| 67 |
+
top: `${point.y}px`
|
| 68 |
+
}" />
|
| 69 |
+
<svg class="temp-polyline-svg" v-if="currentLinePoints.length > 0">
|
| 70 |
+
<polyline
|
| 71 |
+
:points="getPolylinePoints(currentLinePoints)"
|
| 72 |
+
stroke="#FFC107"
|
| 73 |
+
stroke-dasharray="5,5"
|
| 74 |
+
fill="none"
|
| 75 |
+
stroke-width="2"
|
| 76 |
+
/>
|
| 77 |
+
</svg>
|
| 78 |
+
</div>
|
| 79 |
+
</div>
|
| 80 |
+
<div class="save-section">
|
| 81 |
+
<KeyboardShortcuts />
|
| 82 |
+
<button
|
| 83 |
+
class="action-btn clear-btn"
|
| 84 |
+
:disabled="Object.keys(calibrationLines).length === 0 && Object.keys(calibrationPoints).length === 0"
|
| 85 |
+
@click="clearCalibration"
|
| 86 |
+
>
|
| 87 |
+
Clear
|
| 88 |
+
</button>
|
| 89 |
+
<button
|
| 90 |
+
class="action-btn process-btn"
|
| 91 |
+
:disabled="Object.keys(calibrationLines).length === 0 && Object.keys(calibrationPoints).length === 0"
|
| 92 |
+
@click="processCalibration"
|
| 93 |
+
>
|
| 94 |
+
Traiter la calibration
|
| 95 |
+
</button>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
</template>
|
| 99 |
+
|
| 100 |
+
<script setup>
|
| 101 |
+
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
| 102 |
+
import KeyboardShortcuts from './KeyboardShortcuts.vue'
|
| 103 |
+
|
| 104 |
+
// Props
|
| 105 |
+
const props = defineProps({
|
| 106 |
+
thumbnail: {
|
| 107 |
+
type: String,
|
| 108 |
+
default: null
|
| 109 |
+
},
|
| 110 |
+
calibrationPoints: {
|
| 111 |
+
type: Object,
|
| 112 |
+
default: () => ({})
|
| 113 |
+
},
|
| 114 |
+
calibrationLines: {
|
| 115 |
+
type: Object,
|
| 116 |
+
default: () => ({})
|
| 117 |
+
},
|
| 118 |
+
selectedFieldPoint: {
|
| 119 |
+
type: Object,
|
| 120 |
+
default: null
|
| 121 |
+
},
|
| 122 |
+
selectedFieldLine: {
|
| 123 |
+
type: Object,
|
| 124 |
+
default: null
|
| 125 |
+
}
|
| 126 |
+
})
|
| 127 |
+
|
| 128 |
+
// Emits
|
| 129 |
+
const emit = defineEmits([
|
| 130 |
+
'update:calibrationPoints',
|
| 131 |
+
'update:calibrationLines',
|
| 132 |
+
'update:selectedFieldPoint',
|
| 133 |
+
'update:selectedFieldLine',
|
| 134 |
+
'clear-calibration',
|
| 135 |
+
'process-calibration'
|
| 136 |
+
])
|
| 137 |
+
|
| 138 |
+
// Refs
|
| 139 |
+
const container = ref(null)
|
| 140 |
+
const imageContainer = ref(null)
|
| 141 |
+
const image = ref(null)
|
| 142 |
+
|
| 143 |
+
// Data
|
| 144 |
+
const scale = ref(1)
|
| 145 |
+
const translation = ref({ x: 0, y: 0 })
|
| 146 |
+
const aspectRatio = ref(1)
|
| 147 |
+
const imageSize = ref({ width: 0, height: 0 })
|
| 148 |
+
const isPanning = ref(false)
|
| 149 |
+
const isMiddleMouseDown = ref(false)
|
| 150 |
+
const lastMousePosition = ref({ x: 0, y: 0 })
|
| 151 |
+
const currentLinePoints = ref([])
|
| 152 |
+
const isDrawingLine = ref(false)
|
| 153 |
+
const isDraggingPoint = ref(false)
|
| 154 |
+
const selectedPointIndex = ref(null)
|
| 155 |
+
const draggedLineId = ref(null)
|
| 156 |
+
const proximityThreshold = ref(10)
|
| 157 |
+
const tempPoint = ref(null)
|
| 158 |
+
const isCtrlPressed = ref(false)
|
| 159 |
+
const sharedPoints = ref(new Set())
|
| 160 |
+
const draggedPoints = ref([])
|
| 161 |
+
const isCreatingLine = ref(false)
|
| 162 |
+
|
| 163 |
+
// Computed
|
| 164 |
+
const frameStyle = computed(() => {
|
| 165 |
+
if (!aspectRatio.value) return {}
|
| 166 |
+
|
| 167 |
+
const container = imageContainer.value?.parentElement
|
| 168 |
+
if (!container) return {}
|
| 169 |
+
|
| 170 |
+
const parentWidth = container.clientWidth
|
| 171 |
+
const parentHeight = container.clientHeight
|
| 172 |
+
|
| 173 |
+
let width, height
|
| 174 |
+
|
| 175 |
+
if (parentWidth / parentHeight > aspectRatio.value) {
|
| 176 |
+
height = parentHeight
|
| 177 |
+
width = height * aspectRatio.value
|
| 178 |
+
} else {
|
| 179 |
+
width = parentWidth
|
| 180 |
+
height = width / aspectRatio.value
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
return {
|
| 184 |
+
width: `${width}px`,
|
| 185 |
+
height: `${height}px`
|
| 186 |
+
}
|
| 187 |
+
})
|
| 188 |
+
|
| 189 |
+
const transformStyle = computed(() => {
|
| 190 |
+
return {
|
| 191 |
+
transform: `translate(${translation.value.x}px, ${translation.value.y}px) scale(${scale.value})`,
|
| 192 |
+
transformOrigin: '0 0'
|
| 193 |
+
}
|
| 194 |
+
})
|
| 195 |
+
|
| 196 |
+
// Methods
|
| 197 |
+
const initializeImage = (event) => {
|
| 198 |
+
const img = event.target
|
| 199 |
+
|
| 200 |
+
imageSize.value = {
|
| 201 |
+
width: img.naturalWidth,
|
| 202 |
+
height: img.naturalHeight
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
aspectRatio.value = imageSize.value.width / imageSize.value.height
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
const handleZoom = (event) => {
|
| 209 |
+
const zoomFactor = 0.1
|
| 210 |
+
const delta = Math.sign(event.deltaY) * -1
|
| 211 |
+
const newScale = scale.value + delta * zoomFactor
|
| 212 |
+
|
| 213 |
+
const oldScale = scale.value
|
| 214 |
+
scale.value = Math.min(Math.max(newScale, 1), 15)
|
| 215 |
+
|
| 216 |
+
if (scale.value === 1) {
|
| 217 |
+
translation.value = { x: 0, y: 0 }
|
| 218 |
+
return
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
if (scale.value !== oldScale) {
|
| 222 |
+
const rect = imageContainer.value.getBoundingClientRect()
|
| 223 |
+
const mouseX = event.clientX - rect.left
|
| 224 |
+
const mouseY = event.clientY - rect.top
|
| 225 |
+
|
| 226 |
+
const pointX = (mouseX - translation.value.x) / oldScale
|
| 227 |
+
const pointY = (mouseY - translation.value.y) / oldScale
|
| 228 |
+
|
| 229 |
+
translation.value = {
|
| 230 |
+
x: mouseX - (pointX * scale.value),
|
| 231 |
+
y: mouseY - (pointY * scale.value)
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
const handleMouseDown = (event) => {
|
| 237 |
+
if (event.button === 1) { // Clic molette
|
| 238 |
+
isMiddleMouseDown.value = true
|
| 239 |
+
lastMousePosition.value = {
|
| 240 |
+
x: event.clientX,
|
| 241 |
+
y: event.clientY
|
| 242 |
+
}
|
| 243 |
+
event.preventDefault()
|
| 244 |
+
return
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// Gestion des points
|
| 248 |
+
if (event.button === 0 && props.selectedFieldPoint) {
|
| 249 |
+
const rect = imageContainer.value.getBoundingClientRect()
|
| 250 |
+
const x = event.clientX - rect.left
|
| 251 |
+
const y = event.clientY - rect.top
|
| 252 |
+
|
| 253 |
+
const newPoints = { ...props.calibrationPoints }
|
| 254 |
+
newPoints[props.selectedFieldPoint.index] = {
|
| 255 |
+
x: (x - translation.value.x) / scale.value,
|
| 256 |
+
y: (y - translation.value.y) / scale.value
|
| 257 |
+
}
|
| 258 |
+
emit('update:calibrationPoints', newPoints)
|
| 259 |
+
return
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// Gestion des lignes
|
| 263 |
+
if (event.button === 2 && props.selectedFieldLine) {
|
| 264 |
+
if (currentLinePoints.value.length >= 2) {
|
| 265 |
+
const newLines = { ...props.calibrationLines }
|
| 266 |
+
newLines[props.selectedFieldLine.id] = {
|
| 267 |
+
points: [...currentLinePoints.value]
|
| 268 |
+
}
|
| 269 |
+
emit('update:calibrationLines', newLines)
|
| 270 |
+
currentLinePoints.value = []
|
| 271 |
+
isCreatingLine.value = false
|
| 272 |
+
}
|
| 273 |
+
return
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
if (event.button === 0) {
|
| 277 |
+
const rect = imageContainer.value.getBoundingClientRect()
|
| 278 |
+
const mouseX = event.clientX - rect.left
|
| 279 |
+
const mouseY = event.clientY - rect.top
|
| 280 |
+
|
| 281 |
+
const x = (mouseX - translation.value.x) / scale.value
|
| 282 |
+
const y = (mouseY - translation.value.y) / scale.value
|
| 283 |
+
|
| 284 |
+
if (isDraggingPoint.value) {
|
| 285 |
+
const newLines = { ...props.calibrationLines }
|
| 286 |
+
draggedPoints.value.forEach(({ lineId, pointIndex }) => {
|
| 287 |
+
if (newLines[lineId] && Array.isArray(newLines[lineId].points)) {
|
| 288 |
+
newLines[lineId].points[pointIndex] = { x, y }
|
| 289 |
+
}
|
| 290 |
+
})
|
| 291 |
+
emit('update:calibrationLines', newLines)
|
| 292 |
+
|
| 293 |
+
isDraggingPoint.value = false
|
| 294 |
+
draggedPoints.value = []
|
| 295 |
+
tempPoint.value = null
|
| 296 |
+
return
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
if (!isCreatingLine.value) {
|
| 300 |
+
if (isCtrlPressed.value) {
|
| 301 |
+
const nearestPoint = findLineByPoint(x, y)
|
| 302 |
+
|
| 303 |
+
if (nearestPoint) {
|
| 304 |
+
if (currentLinePoints.value.length === 0) {
|
| 305 |
+
isCreatingLine.value = true
|
| 306 |
+
currentLinePoints.value.push(nearestPoint.point)
|
| 307 |
+
sharedPoints.value.add(`${nearestPoint.lineId}-${nearestPoint.pointIndex}`)
|
| 308 |
+
return
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
const nearestPoint = findLineByPoint(x, y)
|
| 314 |
+
if (nearestPoint) {
|
| 315 |
+
isDraggingPoint.value = true
|
| 316 |
+
const sharedLines = findAllLinesWithPoint(nearestPoint.point.x, nearestPoint.point.y)
|
| 317 |
+
draggedPoints.value = sharedLines.map(line => ({
|
| 318 |
+
lineId: line.lineId,
|
| 319 |
+
pointIndex: line.pointIndex
|
| 320 |
+
}))
|
| 321 |
+
tempPoint.value = { ...nearestPoint.point }
|
| 322 |
+
return
|
| 323 |
+
} else if (props.selectedFieldLine) {
|
| 324 |
+
isCreatingLine.value = true
|
| 325 |
+
currentLinePoints.value = [{ x, y }]
|
| 326 |
+
}
|
| 327 |
+
} else {
|
| 328 |
+
if (isCtrlPressed.value) {
|
| 329 |
+
const nearestPoint = findLineByPoint(x, y)
|
| 330 |
+
if (nearestPoint && nearestPoint.lineId !== props.selectedFieldLine.id) {
|
| 331 |
+
currentLinePoints.value.push(nearestPoint.point)
|
| 332 |
+
sharedPoints.value.add(`${nearestPoint.lineId}-${nearestPoint.pointIndex}`)
|
| 333 |
+
return
|
| 334 |
+
}
|
| 335 |
+
}
|
| 336 |
+
currentLinePoints.value.push({ x, y })
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
const handleMouseMove = (event) => {
|
| 342 |
+
if (isMiddleMouseDown.value) {
|
| 343 |
+
const dx = event.clientX - lastMousePosition.value.x
|
| 344 |
+
const dy = event.clientY - lastMousePosition.value.y
|
| 345 |
+
|
| 346 |
+
const container = imageContainer.value
|
| 347 |
+
const img = image.value
|
| 348 |
+
|
| 349 |
+
if (!container || !img) return
|
| 350 |
+
|
| 351 |
+
const containerRect = container.getBoundingClientRect()
|
| 352 |
+
const imageRect = img.getBoundingClientRect()
|
| 353 |
+
|
| 354 |
+
const minX = containerRect.width - imageRect.width * scale.value
|
| 355 |
+
const minY = containerRect.height - imageRect.height * scale.value
|
| 356 |
+
|
| 357 |
+
const newX = Math.min(0, Math.max(minX, translation.value.x + dx))
|
| 358 |
+
const newY = Math.min(0, Math.max(minY, translation.value.y + dy))
|
| 359 |
+
|
| 360 |
+
translation.value.x = newX
|
| 361 |
+
translation.value.y = newY
|
| 362 |
+
|
| 363 |
+
lastMousePosition.value = {
|
| 364 |
+
x: event.clientX,
|
| 365 |
+
y: event.clientY
|
| 366 |
+
}
|
| 367 |
+
return
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
if (isDraggingPoint.value && draggedPoints.value.length > 0) {
|
| 371 |
+
const rect = imageContainer.value.getBoundingClientRect()
|
| 372 |
+
const mouseX = event.clientX - rect.left
|
| 373 |
+
const mouseY = event.clientY - rect.top
|
| 374 |
+
|
| 375 |
+
const x = (mouseX - translation.value.x) / scale.value
|
| 376 |
+
const y = (mouseY - translation.value.y) / scale.value
|
| 377 |
+
|
| 378 |
+
const newLines = { ...props.calibrationLines }
|
| 379 |
+
draggedPoints.value.forEach(({ lineId, pointIndex }) => {
|
| 380 |
+
if (newLines[lineId] && Array.isArray(newLines[lineId].points)) {
|
| 381 |
+
newLines[lineId].points[pointIndex] = { x, y }
|
| 382 |
+
}
|
| 383 |
+
})
|
| 384 |
+
|
| 385 |
+
emit('update:calibrationLines', newLines)
|
| 386 |
+
}
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
const stopPan = () => {
|
| 390 |
+
isMiddleMouseDown.value = false
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
const handleKeyDown = (event) => {
|
| 394 |
+
if (event.key === 'Control') {
|
| 395 |
+
isCtrlPressed.value = true
|
| 396 |
+
} else if (event.key === 'Delete' || event.key === 'Backspace') {
|
| 397 |
+
deleteLine()
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
const handleKeyUp = (event) => {
|
| 402 |
+
if (event.key === 'Control') {
|
| 403 |
+
isCtrlPressed.value = false
|
| 404 |
+
}
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
const handleFocus = () => {
|
| 408 |
+
console.log('Container focused')
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
const handleBlur = () => {
|
| 412 |
+
console.log('Container lost focus')
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
const getPolylinePoints = (points) => {
|
| 416 |
+
if (!points) return ''
|
| 417 |
+
return points.map(p => `${p.x},${p.y}`).join(' ')
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
const formatPoints = (points) => {
|
| 421 |
+
if (!points) return ''
|
| 422 |
+
return points.map(p => `${p.x},${p.y}`).join(' ')
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
const findLineByPoint = (x, y) => {
|
| 426 |
+
for (const [lineId, line] of Object.entries(props.calibrationLines)) {
|
| 427 |
+
const points = line.points
|
| 428 |
+
for (let i = 0; i < points.length; i++) {
|
| 429 |
+
const point = points[i]
|
| 430 |
+
const dx = point.x - x
|
| 431 |
+
const dy = point.y - y
|
| 432 |
+
const distance = Math.sqrt(dx * dx + dy * dy)
|
| 433 |
+
|
| 434 |
+
if (distance < proximityThreshold.value) {
|
| 435 |
+
return {
|
| 436 |
+
lineId,
|
| 437 |
+
pointIndex: i,
|
| 438 |
+
point
|
| 439 |
+
}
|
| 440 |
+
}
|
| 441 |
+
}
|
| 442 |
+
}
|
| 443 |
+
return null
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
const findAllLinesWithPoint = (x, y) => {
|
| 447 |
+
const sharedLines = []
|
| 448 |
+
for (const [lineId, line] of Object.entries(props.calibrationLines)) {
|
| 449 |
+
const points = line.points
|
| 450 |
+
for (let i = 0; i < points.length; i++) {
|
| 451 |
+
const point = points[i]
|
| 452 |
+
const dx = point.x - x
|
| 453 |
+
const dy = point.y - y
|
| 454 |
+
const distance = Math.sqrt(dx * dx + dy * dy)
|
| 455 |
+
|
| 456 |
+
if (distance < proximityThreshold.value) {
|
| 457 |
+
sharedLines.push({
|
| 458 |
+
lineId,
|
| 459 |
+
pointIndex: i,
|
| 460 |
+
point
|
| 461 |
+
})
|
| 462 |
+
}
|
| 463 |
+
}
|
| 464 |
+
}
|
| 465 |
+
return sharedLines
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
const deleteLine = () => {
|
| 469 |
+
if (props.selectedFieldLine) {
|
| 470 |
+
const newLines = { ...props.calibrationLines }
|
| 471 |
+
if (newLines[props.selectedFieldLine.id]) {
|
| 472 |
+
const points = newLines[props.selectedFieldLine.id].points
|
| 473 |
+
points.forEach((_, index) => {
|
| 474 |
+
sharedPoints.value.delete(`${props.selectedFieldLine.id}-${index}`)
|
| 475 |
+
})
|
| 476 |
+
}
|
| 477 |
+
delete newLines[props.selectedFieldLine.id]
|
| 478 |
+
emit('update:calibrationLines', newLines)
|
| 479 |
+
emit('update:selectedFieldLine', null)
|
| 480 |
+
currentLinePoints.value = []
|
| 481 |
+
isCreatingLine.value = false
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
const clearCalibration = () => {
|
| 486 |
+
emit('clear-calibration')
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
const processCalibration = () => {
|
| 490 |
+
emit('process-calibration')
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
// Lifecycle
|
| 494 |
+
onMounted(() => {
|
| 495 |
+
window.addEventListener('keydown', handleKeyDown)
|
| 496 |
+
window.addEventListener('keyup', handleKeyUp)
|
| 497 |
+
})
|
| 498 |
+
|
| 499 |
+
onUnmounted(() => {
|
| 500 |
+
window.removeEventListener('keydown', handleKeyDown)
|
| 501 |
+
window.removeEventListener('keyup', handleKeyUp)
|
| 502 |
+
})
|
| 503 |
+
|
| 504 |
+
// Expose imageSize for parent component
|
| 505 |
+
defineExpose({
|
| 506 |
+
imageSize
|
| 507 |
+
})
|
| 508 |
+
</script>
|
| 509 |
+
|
| 510 |
+
<style scoped>
|
| 511 |
+
.video-frame-container {
|
| 512 |
+
flex: 2;
|
| 513 |
+
position: relative;
|
| 514 |
+
display: flex;
|
| 515 |
+
flex-direction: column;
|
| 516 |
+
justify-content: center;
|
| 517 |
+
align-items: center;
|
| 518 |
+
min-height: 0;
|
| 519 |
+
border-radius: 4px;
|
| 520 |
+
padding: 10px;
|
| 521 |
+
outline: none;
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
.video-frame {
|
| 525 |
+
position: relative;
|
| 526 |
+
overflow: hidden;
|
| 527 |
+
width: 100%;
|
| 528 |
+
height: calc(100% - 50px);
|
| 529 |
+
margin-bottom: 45px;
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
.image-container {
|
| 533 |
+
position: absolute;
|
| 534 |
+
top: 0;
|
| 535 |
+
left: 0;
|
| 536 |
+
will-change: transform;
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
.video-image {
|
| 540 |
+
display: block;
|
| 541 |
+
max-width: 100%;
|
| 542 |
+
height: auto;
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
.calibration-point {
|
| 546 |
+
position: absolute;
|
| 547 |
+
width: 12px;
|
| 548 |
+
height: 12px;
|
| 549 |
+
background-color: rgb(0, 255, 21);
|
| 550 |
+
border-radius: 50%;
|
| 551 |
+
transform: translate(-50%, -50%);
|
| 552 |
+
pointer-events: none;
|
| 553 |
+
box-shadow: 0 0 6px rgba(76, 175, 80, 0.8),
|
| 554 |
+
0 0 12px rgba(76, 175, 80, 0.5);
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
.selected-point {
|
| 558 |
+
background-color: #FFC107;
|
| 559 |
+
box-shadow: 0 0 8px rgba(255, 193, 7, 0.8),
|
| 560 |
+
0 0 15px rgba(255, 193, 7, 0.5);
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
.save-section {
|
| 564 |
+
position: absolute;
|
| 565 |
+
bottom: 10px;
|
| 566 |
+
left: 10px;
|
| 567 |
+
display: flex;
|
| 568 |
+
gap: 10px;
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
.action-btn {
|
| 572 |
+
display: flex;
|
| 573 |
+
align-items: center;
|
| 574 |
+
padding: 0.5rem 1rem;
|
| 575 |
+
background: rgba(255, 255, 255, 0.1);
|
| 576 |
+
color: #ffffff;
|
| 577 |
+
border: 1px solid #555;
|
| 578 |
+
border-radius: 6px;
|
| 579 |
+
font-weight: 600;
|
| 580 |
+
font-size: 0.9rem;
|
| 581 |
+
cursor: pointer;
|
| 582 |
+
transition: all 0.3s ease;
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
+
.action-btn:hover:not(:disabled) {
|
| 586 |
+
background: rgba(255, 255, 255, 0.15);
|
| 587 |
+
border-color: var(--color-primary);
|
| 588 |
+
color: var(--color-primary);
|
| 589 |
+
transform: translateY(-2px);
|
| 590 |
+
box-shadow: 0 4px 15px rgba(217, 255, 4, 0.2);
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
.action-btn:disabled {
|
| 594 |
+
background: rgba(255, 255, 255, 0.05);
|
| 595 |
+
color: #666;
|
| 596 |
+
border-color: #333;
|
| 597 |
+
cursor: not-allowed;
|
| 598 |
+
transform: none;
|
| 599 |
+
box-shadow: none;
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
.process-btn {
|
| 603 |
+
background: var(--color-primary);
|
| 604 |
+
color: var(--color-secondary);
|
| 605 |
+
border-color: var(--color-primary);
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
.process-btn:hover:not(:disabled) {
|
| 609 |
+
background: var(--color-primary-soft);
|
| 610 |
+
border-color: var(--color-primary-soft);
|
| 611 |
+
color: var(--color-secondary);
|
| 612 |
+
box-shadow: 0 4px 15px rgba(217, 255, 4, 0.4);
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
.calibration-polyline {
|
| 616 |
+
position: absolute;
|
| 617 |
+
top: 0;
|
| 618 |
+
left: 0;
|
| 619 |
+
width: 100%;
|
| 620 |
+
height: 100%;
|
| 621 |
+
pointer-events: none;
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
.polyline-svg {
|
| 625 |
+
width: 100%;
|
| 626 |
+
height: 100%;
|
| 627 |
+
position: absolute;
|
| 628 |
+
top: 0;
|
| 629 |
+
left: 0;
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
.polyline-svg polyline {
|
| 633 |
+
transition: stroke-width 0.2s;
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
.selected-line {
|
| 637 |
+
stroke-width: 2;
|
| 638 |
+
stroke: #FFC107 !important;
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
.polyline-point {
|
| 642 |
+
fill: #00FF15;
|
| 643 |
+
stroke: white;
|
| 644 |
+
stroke-width: 0.5;
|
| 645 |
+
transition: all 0.2s ease;
|
| 646 |
+
pointer-events: all;
|
| 647 |
+
cursor: pointer;
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
.polyline-point:hover {
|
| 651 |
+
fill: #FFC107;
|
| 652 |
+
r: 3;
|
| 653 |
+
stroke-width: 2;
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
.selected-line .polyline-point {
|
| 657 |
+
cursor: grab;
|
| 658 |
+
}
|
| 659 |
+
|
| 660 |
+
.polyline-point.dragging {
|
| 661 |
+
fill: #FF4081;
|
| 662 |
+
r: 4;
|
| 663 |
+
stroke-width: 3;
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
.selected-line-point {
|
| 667 |
+
fill: #FFC107;
|
| 668 |
+
r: 2;
|
| 669 |
+
stroke-width: 1;
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
.temp-point {
|
| 673 |
+
background-color: #FFC107;
|
| 674 |
+
width: 8px;
|
| 675 |
+
height: 8px;
|
| 676 |
+
border-radius: 50%;
|
| 677 |
+
border: 2px solid white;
|
| 678 |
+
z-index: 2;
|
| 679 |
+
}
|
| 680 |
+
|
| 681 |
+
.temp-polyline-svg {
|
| 682 |
+
position: absolute;
|
| 683 |
+
top: 0;
|
| 684 |
+
left: 0;
|
| 685 |
+
width: 100%;
|
| 686 |
+
height: 100%;
|
| 687 |
+
pointer-events: none;
|
| 688 |
+
}
|
| 689 |
+
|
| 690 |
+
.polyline-point.shared-point {
|
| 691 |
+
fill: #FFC107;
|
| 692 |
+
stroke: #FF4081;
|
| 693 |
+
stroke-width: 2;
|
| 694 |
+
r: 4;
|
| 695 |
+
animation: pulse 2s infinite;
|
| 696 |
+
}
|
| 697 |
+
|
| 698 |
+
.polyline-point.hoverable {
|
| 699 |
+
cursor: pointer;
|
| 700 |
+
filter: brightness(1.2);
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
@keyframes pulse {
|
| 704 |
+
0% {
|
| 705 |
+
stroke-width: 2;
|
| 706 |
+
stroke-opacity: 1;
|
| 707 |
+
}
|
| 708 |
+
50% {
|
| 709 |
+
stroke-width: 3;
|
| 710 |
+
stroke-opacity: 0.5;
|
| 711 |
+
}
|
| 712 |
+
100% {
|
| 713 |
+
stroke-width: 2;
|
| 714 |
+
stroke-opacity: 1;
|
| 715 |
+
}
|
| 716 |
+
}
|
| 717 |
+
</style>
|
src/components/FootballField.vue
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="football-field">
|
| 3 |
+
<svg viewBox="-7 -2 119 72" preserveAspectRatio="xMidYMid meet" @click="handleBackgroundClick">
|
| 4 |
+
<g>
|
| 5 |
+
<!-- Base field -->
|
| 6 |
+
<rect x="0" y="0" width="105" height="68" fill="none" stroke="#333" stroke-width="0.3"/>
|
| 7 |
+
|
| 8 |
+
<!-- Clickable lines -->
|
| 9 |
+
<g class="lines">
|
| 10 |
+
<line v-for="(line, name) in lineCoordinates"
|
| 11 |
+
:key="name"
|
| 12 |
+
class="field-line"
|
| 13 |
+
:stroke="getLineColor(name)"
|
| 14 |
+
:x1="line.x1"
|
| 15 |
+
:y1="line.y1"
|
| 16 |
+
:x2="line.x2"
|
| 17 |
+
:y2="line.y2"
|
| 18 |
+
@click="selectLine(name)" />
|
| 19 |
+
</g>
|
| 20 |
+
|
| 21 |
+
<!-- Key points -->
|
| 22 |
+
<circle v-for="(point, index) in keypoints"
|
| 23 |
+
:key="index"
|
| 24 |
+
:cx="point[0]"
|
| 25 |
+
:cy="point[1]"
|
| 26 |
+
r="2"
|
| 27 |
+
:fill="getPointColor(index)"
|
| 28 |
+
class="keypoint"
|
| 29 |
+
@click="selectPoint(index)" />
|
| 30 |
+
|
| 31 |
+
<!-- Center circle -->
|
| 32 |
+
<circle
|
| 33 |
+
cx="52.5"
|
| 34 |
+
cy="34"
|
| 35 |
+
r="9.15"
|
| 36 |
+
fill="none"
|
| 37 |
+
:stroke="getLineColor('Circle central')"
|
| 38 |
+
class="field-line"
|
| 39 |
+
@click="selectLine('Circle central')" />
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
<!-- Penalty area arcs -->
|
| 43 |
+
<path
|
| 44 |
+
v-for="arc in circle_left_right"
|
| 45 |
+
:key="'Circle ' + arc.side"
|
| 46 |
+
:d="getPenaltyArc(arc)"
|
| 47 |
+
fill="none"
|
| 48 |
+
:stroke="getLineColor('Circle ' + arc.side)"
|
| 49 |
+
class="field-line"
|
| 50 |
+
@click="selectLine('Circle ' + arc.side)" />
|
| 51 |
+
</g>
|
| 52 |
+
</svg>
|
| 53 |
+
|
| 54 |
+
<!-- Selected line or point info -->
|
| 55 |
+
<div v-if="selectedLine && LINES[selectedLine]" class="info-overlay">
|
| 56 |
+
{{ LINES[selectedLine].name }}
|
| 57 |
+
</div>
|
| 58 |
+
<div v-if="selectedPointIndex !== null" class="info-overlay">
|
| 59 |
+
{{ POINTS[selectedPointIndex].name }}
|
| 60 |
+
</div>
|
| 61 |
+
</div>
|
| 62 |
+
</template>
|
| 63 |
+
|
| 64 |
+
<script>
|
| 65 |
+
// Définition exacte des classes de lignes comme dans SoccerNet
|
| 66 |
+
const LINES = {
|
| 67 |
+
'Big rect. left bottom': { name: 'Big rect. left bottom', description: 'Left penalty area - bottom line' },
|
| 68 |
+
'Big rect. left main': { name: 'Big rect. left main', description: 'Left penalty area - parallel line' },
|
| 69 |
+
'Big rect. left top': { name: 'Big rect. left top', description: 'Left penalty area - top line' },
|
| 70 |
+
'Big rect. right bottom': { name: 'Big rect. right bottom', description: 'Right penalty area - bottom line' },
|
| 71 |
+
'Big rect. right main': { name: 'Big rect. right main', description: 'Right penalty area - parallel line' },
|
| 72 |
+
'Big rect. right top': { name: 'Big rect. right top', description: 'Right penalty area - top line' },
|
| 73 |
+
'Circle central': { name: 'Center circle', description: 'Center circle' },
|
| 74 |
+
'Circle left': { name: 'Left circle', description: 'Left arc' },
|
| 75 |
+
'Circle right': { name: 'Right circle', description: 'Right arc' },
|
| 76 |
+
'Goal left crossbar': { name: 'Goal left crossbar', description: 'Left goal crossbar' },
|
| 77 |
+
'Goal left post left': { name: 'Goal left post left', description: 'Left goal - left post' },
|
| 78 |
+
'Goal left post right': { name: 'Goal left post right', description: 'Left goal - right post' },
|
| 79 |
+
'Goal right crossbar': { name: 'Goal right crossbar', description: 'Right goal crossbar' },
|
| 80 |
+
'Goal right post left': { name: 'Goal right post left', description: 'Right goal - left post' },
|
| 81 |
+
'Goal right post right': { name: 'Goal right post right', description: 'Right goal - right post' },
|
| 82 |
+
'Goal unknown': { name: 'Goal unknown', description: 'Unidentified goal' },
|
| 83 |
+
'Line unknown': { name: 'Line unknown', description: 'Unidentified line' },
|
| 84 |
+
'Middle line': { name: 'Middle line', description: 'Center line' },
|
| 85 |
+
'Side line bottom': { name: 'Side line bottom', description: 'Bottom goal line' },
|
| 86 |
+
'Side line left': { name: 'Side line left', description: 'Left touch line' },
|
| 87 |
+
'Side line right': { name: 'Side line right', description: 'Right touch line' },
|
| 88 |
+
'Side line top': { name: 'Side line top', description: 'Top goal line' },
|
| 89 |
+
'Small rect. left bottom': { name: 'Small rect. left bottom', description: 'Left goal area - bottom line' },
|
| 90 |
+
'Small rect. left main': { name: 'Small rect. left main', description: 'Left goal area - parallel line' },
|
| 91 |
+
'Small rect. left top': { name: 'Small rect. left top', description: 'Left goal area - top line' },
|
| 92 |
+
'Small rect. right bottom': { name: 'Small rect. right bottom', description: 'Right goal area - bottom line' },
|
| 93 |
+
'Small rect. right main': { name: 'Small rect. right main', description: 'Right goal area - parallel line' },
|
| 94 |
+
'Small rect. right top': { name: 'Small rect. right top', description: 'Right goal area - top line' },
|
| 95 |
+
center_circle: {
|
| 96 |
+
name: "Center circle",
|
| 97 |
+
type: "circle",
|
| 98 |
+
color: "#00FF15"
|
| 99 |
+
},
|
| 100 |
+
circle_left: {
|
| 101 |
+
name: "Left circle",
|
| 102 |
+
type: "arc",
|
| 103 |
+
color: "#00FF15"
|
| 104 |
+
},
|
| 105 |
+
circle_right: {
|
| 106 |
+
name: "Right circle",
|
| 107 |
+
type: "arc",
|
| 108 |
+
color: "#00FF15"
|
| 109 |
+
}
|
| 110 |
+
};
|
| 111 |
+
|
| 112 |
+
// Définition des dimensions standard d'un terrain de football
|
| 113 |
+
const FIELD_DIMENSIONS = {
|
| 114 |
+
PITCH_LENGTH: 105,
|
| 115 |
+
PITCH_WIDTH: 68,
|
| 116 |
+
GOAL_LINE_TO_PENALTY_MARK: 11.0,
|
| 117 |
+
PENALTY_AREA_WIDTH: 40.32,
|
| 118 |
+
PENALTY_AREA_LENGTH: 16.5,
|
| 119 |
+
GOAL_AREA_WIDTH: 18.32,
|
| 120 |
+
GOAL_AREA_LENGTH: 5.5,
|
| 121 |
+
CENTER_CIRCLE_RADIUS: 9.15,
|
| 122 |
+
GOAL_HEIGHT: 2.44,
|
| 123 |
+
GOAL_LENGTH: 7.32
|
| 124 |
+
};
|
| 125 |
+
|
| 126 |
+
const POINTS = {
|
| 127 |
+
0: { name: "Center point" },
|
| 128 |
+
1: { name: "Left penalty point" },
|
| 129 |
+
2: { name: "Right penalty point" }
|
| 130 |
+
};
|
| 131 |
+
|
| 132 |
+
export default {
|
| 133 |
+
name: 'FootballField',
|
| 134 |
+
props: {
|
| 135 |
+
positionedLines: {
|
| 136 |
+
type: Object,
|
| 137 |
+
default: () => ({})
|
| 138 |
+
},
|
| 139 |
+
positionedPoints: {
|
| 140 |
+
type: Object,
|
| 141 |
+
default: () => ({})
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
data() {
|
| 145 |
+
return {
|
| 146 |
+
selectedPointIndex: null,
|
| 147 |
+
selectedLine: null,
|
| 148 |
+
LINES,
|
| 149 |
+
FIELD_DIMENSIONS,
|
| 150 |
+
POINTS,
|
| 151 |
+
keypoints: [
|
| 152 |
+
[52.5, 34], // Center point
|
| 153 |
+
[11, 34], // Left penalty point
|
| 154 |
+
[94, 34], // Right penalty point
|
| 155 |
+
],
|
| 156 |
+
lineCoordinates: {
|
| 157 |
+
'Side line top': { x1: 0, y1: 0, x2: 105, y2: 0 },
|
| 158 |
+
'Side line bottom': { x1: 0, y1: 68, x2: 105, y2: 68 },
|
| 159 |
+
'Side line left': { x1: 0, y1: 0, x2: 0, y2: 68 },
|
| 160 |
+
'Side line right': { x1: 105, y1: 0, x2: 105, y2: 68 },
|
| 161 |
+
'Middle line': { x1: 52.5, y1: 0, x2: 52.5, y2: 68 },
|
| 162 |
+
|
| 163 |
+
// Penalty areas
|
| 164 |
+
'Big rect. left bottom': { x1: 0, y1: 54.16, x2: 16.5, y2: 54.16 },
|
| 165 |
+
'Big rect. left main': { x1: 16.5, y1: 13.84, x2: 16.5, y2: 54.16 },
|
| 166 |
+
'Big rect. left top': { x1: 0, y1: 13.84, x2: 16.5, y2: 13.84 },
|
| 167 |
+
'Big rect. right bottom': { x1: 88.5, y1: 54.16, x2: 105, y2: 54.16 },
|
| 168 |
+
'Big rect. right main': { x1: 88.5, y1: 13.84, x2: 88.5, y2: 54.16 },
|
| 169 |
+
'Big rect. right top': { x1: 88.5, y1: 13.84, x2: 105, y2: 13.84 },
|
| 170 |
+
|
| 171 |
+
// Goal areas
|
| 172 |
+
'Small rect. left bottom': { x1: 0, y1: 43.16, x2: 5.5, y2: 43.16 },
|
| 173 |
+
'Small rect. left main': { x1: 5.5, y1: 24.84, x2: 5.5, y2: 43.16 },
|
| 174 |
+
'Small rect. left top': { x1: 0, y1: 24.84, x2: 5.5, y2: 24.84 },
|
| 175 |
+
'Small rect. right bottom': { x1: 99.5, y1: 43.16, x2: 105, y2: 43.16 },
|
| 176 |
+
'Small rect. right main': { x1: 99.5, y1: 24.84, x2: 99.5, y2: 43.16 },
|
| 177 |
+
'Small rect. right top': { x1: 99.5, y1: 24.84, x2: 105, y2: 24.84 },
|
| 178 |
+
|
| 179 |
+
// Goals
|
| 180 |
+
'Goal left post left': { x1: -5, y1: 37.66, x2: 0, y2: 37.66 },
|
| 181 |
+
'Goal left crossbar': { x1: -5, y1: 30.34, x2: -5, y2: 37.66 },
|
| 182 |
+
'Goal left post right': { x1: -5, y1: 30.34, x2: 0, y2: 30.34 },
|
| 183 |
+
'Goal right post left': { x1: 105, y1: 30.34, x2: 110, y2: 30.34 },
|
| 184 |
+
'Goal right crossbar': { x1: 110, y1: 30.34, x2: 110, y2: 37.66 },
|
| 185 |
+
'Goal right post right': { x1: 105, y1: 37.66, x2: 110, y2: 37.66 },
|
| 186 |
+
},
|
| 187 |
+
lastSelected: null, // 'point' or 'line'
|
| 188 |
+
circle_left_right: [
|
| 189 |
+
{ x: 11, y: 34, side: 'left' },
|
| 190 |
+
{ x: 94, y: 34, side: 'right' }
|
| 191 |
+
]
|
| 192 |
+
}
|
| 193 |
+
},
|
| 194 |
+
methods: {
|
| 195 |
+
handleBackgroundClick(event) {
|
| 196 |
+
// Vérifie si le clic vient directement du SVG (pas d'un enfant)
|
| 197 |
+
if (event.target.tagName === 'svg') {
|
| 198 |
+
if (this.selectedPointIndex !== null) {
|
| 199 |
+
this.selectedPointIndex = null;
|
| 200 |
+
this.$emit('point-selected', null);
|
| 201 |
+
}
|
| 202 |
+
if (this.selectedLine) {
|
| 203 |
+
this.selectedLine = null;
|
| 204 |
+
this.$emit('line-selected', null);
|
| 205 |
+
}
|
| 206 |
+
this.lastSelected = null;
|
| 207 |
+
}
|
| 208 |
+
},
|
| 209 |
+
selectPoint(index, event) {
|
| 210 |
+
if (event) {
|
| 211 |
+
event.stopPropagation();
|
| 212 |
+
}
|
| 213 |
+
if (this.selectedLine) this.selectedLine = null;
|
| 214 |
+
this.selectedPointIndex = index;
|
| 215 |
+
this.lastSelected = 'point';
|
| 216 |
+
this.$emit('point-selected', {
|
| 217 |
+
index,
|
| 218 |
+
coordinates: this.keypoints[index],
|
| 219 |
+
name: this.POINTS[index].name
|
| 220 |
+
});
|
| 221 |
+
},
|
| 222 |
+
selectLine(lineName, event) {
|
| 223 |
+
if (event) {
|
| 224 |
+
event.stopPropagation();
|
| 225 |
+
}
|
| 226 |
+
if (this.selectedPointIndex !== null) this.selectedPointIndex = null;
|
| 227 |
+
this.selectedLine = lineName;
|
| 228 |
+
this.lastSelected = 'line';
|
| 229 |
+
if (this.LINES[lineName]) {
|
| 230 |
+
this.$emit('line-selected', {
|
| 231 |
+
id: lineName,
|
| 232 |
+
name: this.LINES[lineName].name,
|
| 233 |
+
description: this.LINES[lineName].description
|
| 234 |
+
});
|
| 235 |
+
}
|
| 236 |
+
},
|
| 237 |
+
getPointColor(index) {
|
| 238 |
+
if (this.selectedPointIndex === index && this.lastSelected === 'point') {
|
| 239 |
+
return index in this.positionedPoints ? '#FFFF00' : 'red';
|
| 240 |
+
}
|
| 241 |
+
return index in this.positionedPoints ? '#00FF15' : 'white';
|
| 242 |
+
},
|
| 243 |
+
getLineColor(lineName) {
|
| 244 |
+
if (this.selectedLine === lineName && this.lastSelected === 'line') {
|
| 245 |
+
return this.positionedLines[lineName] ? '#FFFF00' : 'red';
|
| 246 |
+
}
|
| 247 |
+
return this.positionedLines[lineName] ? '#00FF15' : 'white';
|
| 248 |
+
},
|
| 249 |
+
|
| 250 |
+
getPenaltyArc(arc) {
|
| 251 |
+
const radius = 9.15;
|
| 252 |
+
const startAngle = arc.side === 'left' ? -53 : -127;
|
| 253 |
+
const endAngle = arc.side === 'left' ? 53 : 127;
|
| 254 |
+
|
| 255 |
+
const start = {
|
| 256 |
+
x: arc.x + radius * Math.cos(startAngle * Math.PI / 180),
|
| 257 |
+
y: arc.y + radius * Math.sin(startAngle * Math.PI / 180)
|
| 258 |
+
};
|
| 259 |
+
|
| 260 |
+
const end = {
|
| 261 |
+
x: arc.x + radius * Math.cos(endAngle * Math.PI / 180),
|
| 262 |
+
y: arc.y + radius * Math.sin(endAngle * Math.PI / 180)
|
| 263 |
+
};
|
| 264 |
+
|
| 265 |
+
const largeArc = 0;
|
| 266 |
+
const sweep = arc.side === 'left' ? 1 : 0;
|
| 267 |
+
|
| 268 |
+
return `M ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} ${sweep} ${end.x} ${end.y}`;
|
| 269 |
+
}
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
</script>
|
| 273 |
+
|
| 274 |
+
<style scoped>
|
| 275 |
+
.football-field {
|
| 276 |
+
position: relative;
|
| 277 |
+
width: 100%;
|
| 278 |
+
height: 100%;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
.field-line {
|
| 282 |
+
stroke-width: 0.8;
|
| 283 |
+
cursor: pointer;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
/* Specific style for goal lines */
|
| 287 |
+
.field-line[class*="Goal"] {
|
| 288 |
+
stroke-width: 1; /* Thicker line for goals */
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
.field-line:hover {
|
| 292 |
+
stroke-width: 1.2; /* Even thicker on hover */
|
| 293 |
+
opacity: 0.8;
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
.line-info {
|
| 297 |
+
position: absolute;
|
| 298 |
+
bottom: 10px;
|
| 299 |
+
left: 50%;
|
| 300 |
+
transform: translateX(-50%);
|
| 301 |
+
background-color: rgba(0, 0, 0, 0.7);
|
| 302 |
+
color: white;
|
| 303 |
+
padding: 5px 10px;
|
| 304 |
+
border-radius: 4px;
|
| 305 |
+
font-size: 0.9rem;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
.keypoint {
|
| 309 |
+
filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5)); /* Glow effect for points */
|
| 310 |
+
cursor: pointer;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
.keypoint:hover {
|
| 314 |
+
filter: drop-shadow(0 0 4px rgba(255, 0, 0, 0.8));
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
.info-overlay {
|
| 318 |
+
position: absolute;
|
| 319 |
+
bottom: 10px;
|
| 320 |
+
left: 50%;
|
| 321 |
+
transform: translateX(-50%);
|
| 322 |
+
background-color: rgba(0, 0, 0, 0.7);
|
| 323 |
+
color: white;
|
| 324 |
+
padding: 5px 10px;
|
| 325 |
+
border-radius: 4px;
|
| 326 |
+
font-size: 0.9rem;
|
| 327 |
+
}
|
| 328 |
+
</style>
|
src/components/KeyboardShortcuts.vue
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div>
|
| 3 |
+
<button @click="showModal = true" class="shortcuts-btn">
|
| 4 |
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 5 |
+
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
|
| 6 |
+
<line x1="8" y1="21" x2="16" y2="21"/>
|
| 7 |
+
<line x1="12" y1="17" x2="12" y2="21"/>
|
| 8 |
+
</svg>
|
| 9 |
+
Shortcuts
|
| 10 |
+
</button>
|
| 11 |
+
|
| 12 |
+
<div v-if="showModal" class="modal-overlay" @click="showModal = false">
|
| 13 |
+
<div class="modal-content" @click.stop>
|
| 14 |
+
<div class="modal-header">
|
| 15 |
+
<h2>Guide d'utilisation</h2>
|
| 16 |
+
<button class="close-btn" @click="showModal = false">×</button>
|
| 17 |
+
</div>
|
| 18 |
+
<div class="shortcuts-content">
|
| 19 |
+
<div class="shortcuts-section">
|
| 20 |
+
<h3>Points de calibration</h3>
|
| 21 |
+
<div class="shortcut-item">
|
| 22 |
+
<span class="key">Clic gauche</span>
|
| 23 |
+
<span class="description">Placer un point (sélectionner d'abord un point sur le terrain)</span>
|
| 24 |
+
</div>
|
| 25 |
+
<div class="shortcut-item">
|
| 26 |
+
<span class="key">Glisser</span>
|
| 27 |
+
<span class="description">Déplacer un point existant</span>
|
| 28 |
+
</div>
|
| 29 |
+
</div>
|
| 30 |
+
|
| 31 |
+
<div class="shortcuts-section">
|
| 32 |
+
<h3>Lignes de calibration</h3>
|
| 33 |
+
<div class="shortcut-item">
|
| 34 |
+
<span class="key">Clic gauche</span>
|
| 35 |
+
<span class="description">Ajouter un point à la ligne (sélectionner d'abord une ligne sur le terrain)</span>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="shortcut-item">
|
| 38 |
+
<span class="key">Clic droit</span>
|
| 39 |
+
<span class="description">Terminer la ligne (minimum 2 points)</span>
|
| 40 |
+
</div>
|
| 41 |
+
<div class="shortcut-item">
|
| 42 |
+
<span class="key">Ctrl + Clic</span>
|
| 43 |
+
<span class="description">Utiliser un point d'intersection existant</span>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<div class="shortcuts-section">
|
| 48 |
+
<h3>Navigation</h3>
|
| 49 |
+
<div class="shortcut-item">
|
| 50 |
+
<span class="key">Molette</span>
|
| 51 |
+
<span class="description">Zoomer/Dézoomer (1x à 15x)</span>
|
| 52 |
+
</div>
|
| 53 |
+
<div class="shortcut-item">
|
| 54 |
+
<span class="key">Clic molette + Glisser</span>
|
| 55 |
+
<span class="description">Déplacer l'image</span>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
|
| 59 |
+
<div class="shortcuts-section">
|
| 60 |
+
<h3>Édition</h3>
|
| 61 |
+
<div class="shortcut-item">
|
| 62 |
+
<span class="key">Delete / Backspace</span>
|
| 63 |
+
<span class="description">Supprimer la ligne sélectionnée</span>
|
| 64 |
+
</div>
|
| 65 |
+
<div class="shortcut-item">
|
| 66 |
+
<span class="key">Clear</span>
|
| 67 |
+
<span class="description">Effacer toute la calibration</span>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
|
| 71 |
+
<div class="shortcuts-section">
|
| 72 |
+
<h3>Workflow</h3>
|
| 73 |
+
<div class="shortcut-item">
|
| 74 |
+
<span class="step">1.</span>
|
| 75 |
+
<span class="description">Sélectionner un élément sur le terrain de football (point ou ligne)</span>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="shortcut-item">
|
| 78 |
+
<span class="step">2.</span>
|
| 79 |
+
<span class="description">Placer/Dessiner l'élément correspondant sur l'image</span>
|
| 80 |
+
</div>
|
| 81 |
+
<div class="shortcut-item">
|
| 82 |
+
<span class="step">3.</span>
|
| 83 |
+
<span class="description">Répéter pour tous les éléments nécessaires</span>
|
| 84 |
+
</div>
|
| 85 |
+
<div class="shortcut-item">
|
| 86 |
+
<span class="step">4.</span>
|
| 87 |
+
<span class="description">Cliquer sur "Traiter la calibration"</span>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
</div>
|
| 93 |
+
</div>
|
| 94 |
+
</template>
|
| 95 |
+
|
| 96 |
+
<script>
|
| 97 |
+
export default {
|
| 98 |
+
name: 'KeyboardShortcuts',
|
| 99 |
+
data() {
|
| 100 |
+
return {
|
| 101 |
+
showModal: false
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
</script>
|
| 106 |
+
|
| 107 |
+
<style scoped>
|
| 108 |
+
.shortcuts-btn {
|
| 109 |
+
background: rgba(255, 255, 255, 0.1);
|
| 110 |
+
color: #888;
|
| 111 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 112 |
+
border-radius: 6px;
|
| 113 |
+
padding: 8px 12px;
|
| 114 |
+
cursor: pointer;
|
| 115 |
+
display: flex;
|
| 116 |
+
align-items: center;
|
| 117 |
+
gap: 6px;
|
| 118 |
+
transition: all 0.3s ease;
|
| 119 |
+
font-size: 0.85rem;
|
| 120 |
+
backdrop-filter: blur(10px);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.shortcuts-btn:hover {
|
| 124 |
+
background: rgba(255, 255, 255, 0.15);
|
| 125 |
+
color: var(--color-primary);
|
| 126 |
+
border-color: var(--color-primary);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.shortcuts-btn svg {
|
| 130 |
+
transition: all 0.3s ease;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
.modal-overlay {
|
| 134 |
+
position: fixed;
|
| 135 |
+
top: 0;
|
| 136 |
+
left: 0;
|
| 137 |
+
width: 100%;
|
| 138 |
+
height: 100%;
|
| 139 |
+
background-color: rgba(0, 0, 0, 0.7);
|
| 140 |
+
display: flex;
|
| 141 |
+
justify-content: center;
|
| 142 |
+
align-items: center;
|
| 143 |
+
z-index: 2000;
|
| 144 |
+
backdrop-filter: blur(5px);
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.modal-content {
|
| 148 |
+
background-color: #1a1a1a;
|
| 149 |
+
border: 1px solid #333;
|
| 150 |
+
border-radius: 12px;
|
| 151 |
+
width: 90%;
|
| 152 |
+
max-width: 700px;
|
| 153 |
+
max-height: 85vh;
|
| 154 |
+
overflow-y: auto;
|
| 155 |
+
color: white;
|
| 156 |
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
.modal-header {
|
| 160 |
+
display: flex;
|
| 161 |
+
justify-content: space-between;
|
| 162 |
+
align-items: center;
|
| 163 |
+
padding: 20px 24px;
|
| 164 |
+
border-bottom: 1px solid #333;
|
| 165 |
+
background: #2a2a2a;
|
| 166 |
+
border-radius: 12px 12px 0 0;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.modal-header h2 {
|
| 170 |
+
margin: 0;
|
| 171 |
+
font-size: 1.5rem;
|
| 172 |
+
color: var(--color-primary);
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
.close-btn {
|
| 176 |
+
background: none;
|
| 177 |
+
border: none;
|
| 178 |
+
color: #888;
|
| 179 |
+
font-size: 1.8rem;
|
| 180 |
+
cursor: pointer;
|
| 181 |
+
padding: 0 8px;
|
| 182 |
+
transition: color 0.3s ease;
|
| 183 |
+
line-height: 1;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.close-btn:hover {
|
| 187 |
+
color: var(--color-primary);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.shortcuts-content {
|
| 191 |
+
padding: 24px;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.shortcuts-section {
|
| 195 |
+
margin-bottom: 32px;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
.shortcuts-section:last-child {
|
| 199 |
+
margin-bottom: 0;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
.shortcuts-section h3 {
|
| 203 |
+
color: var(--color-primary);
|
| 204 |
+
margin-bottom: 16px;
|
| 205 |
+
font-size: 1.1rem;
|
| 206 |
+
font-weight: 600;
|
| 207 |
+
border-bottom: 1px solid #333;
|
| 208 |
+
padding-bottom: 8px;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.shortcut-item {
|
| 212 |
+
display: flex;
|
| 213 |
+
justify-content: space-between;
|
| 214 |
+
align-items: center;
|
| 215 |
+
padding: 12px 0;
|
| 216 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
.shortcut-item:last-child {
|
| 220 |
+
border-bottom: none;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
.key {
|
| 224 |
+
background-color: #333;
|
| 225 |
+
color: var(--color-primary);
|
| 226 |
+
padding: 6px 12px;
|
| 227 |
+
border-radius: 6px;
|
| 228 |
+
font-family: monospace;
|
| 229 |
+
font-size: 0.85rem;
|
| 230 |
+
font-weight: 600;
|
| 231 |
+
min-width: 120px;
|
| 232 |
+
text-align: center;
|
| 233 |
+
border: 1px solid #444;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
.step {
|
| 237 |
+
background-color: var(--color-primary);
|
| 238 |
+
color: var(--color-secondary);
|
| 239 |
+
padding: 6px 12px;
|
| 240 |
+
border-radius: 50%;
|
| 241 |
+
font-family: monospace;
|
| 242 |
+
font-size: 0.85rem;
|
| 243 |
+
font-weight: 700;
|
| 244 |
+
min-width: 30px;
|
| 245 |
+
text-align: center;
|
| 246 |
+
margin-right: 10px;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
.description {
|
| 250 |
+
color: #ccc;
|
| 251 |
+
flex: 1;
|
| 252 |
+
margin-left: 16px;
|
| 253 |
+
line-height: 1.4;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
/* Scrollbar styling */
|
| 257 |
+
.modal-content::-webkit-scrollbar {
|
| 258 |
+
width: 8px;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
.modal-content::-webkit-scrollbar-track {
|
| 262 |
+
background: #2a2a2a;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
.modal-content::-webkit-scrollbar-thumb {
|
| 266 |
+
background: #555;
|
| 267 |
+
border-radius: 4px;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
.modal-content::-webkit-scrollbar-thumb:hover {
|
| 271 |
+
background: #666;
|
| 272 |
+
}
|
| 273 |
+
</style>
|
src/main.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import './assets/main.css'
|
| 2 |
+
|
| 3 |
+
import { createApp } from 'vue'
|
| 4 |
+
import { createPinia } from 'pinia'
|
| 5 |
+
|
| 6 |
+
import App from './App.vue'
|
| 7 |
+
import router from './router'
|
| 8 |
+
|
| 9 |
+
const app = createApp(App)
|
| 10 |
+
|
| 11 |
+
app.use(createPinia())
|
| 12 |
+
app.use(router)
|
| 13 |
+
|
| 14 |
+
app.mount('#app')
|
src/router/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { createRouter, createWebHistory } from 'vue-router'
|
| 2 |
+
import HomeView from '../views/HomeView.vue'
|
| 3 |
+
|
| 4 |
+
const router = createRouter({
|
| 5 |
+
history: createWebHistory(import.meta.env.BASE_URL),
|
| 6 |
+
routes: [
|
| 7 |
+
{
|
| 8 |
+
path: '/',
|
| 9 |
+
name: 'home',
|
| 10 |
+
component: HomeView,
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
path: '/manual',
|
| 14 |
+
name: 'manual',
|
| 15 |
+
component: () => import('../views/ManualView.vue'),
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
})
|
| 19 |
+
|
| 20 |
+
export default router
|
src/services/api.js
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// const API_BASE_URL = 'http://localhost:8000'
|
| 2 |
+
const API_BASE_URL = 'https://2nzi-pnlcalib.hf.space'
|
| 3 |
+
|
| 4 |
+
class FootballVisionAPI {
|
| 5 |
+
constructor() {
|
| 6 |
+
this.baseURL = API_BASE_URL
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
async healthCheck() {
|
| 10 |
+
try {
|
| 11 |
+
const response = await fetch(`${this.baseURL}/health`)
|
| 12 |
+
return await response.json()
|
| 13 |
+
} catch (error) {
|
| 14 |
+
throw new Error(`Health check failed: ${error.message}`)
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
async calibrateCamera(imageFile, linesData) {
|
| 19 |
+
const formData = new FormData()
|
| 20 |
+
formData.append('image', imageFile)
|
| 21 |
+
formData.append('lines_data', JSON.stringify(linesData))
|
| 22 |
+
|
| 23 |
+
try {
|
| 24 |
+
const response = await fetch(`${this.baseURL}/calibrate`, {
|
| 25 |
+
method: 'POST',
|
| 26 |
+
body: formData
|
| 27 |
+
})
|
| 28 |
+
|
| 29 |
+
// Toujours retourner un objet de résultat, même en cas d'erreur
|
| 30 |
+
if (!response.ok) {
|
| 31 |
+
let errorMessage = `HTTP error! status: ${response.status}`
|
| 32 |
+
|
| 33 |
+
// Essayer de récupérer le message d'erreur du serveur
|
| 34 |
+
try {
|
| 35 |
+
const errorData = await response.json()
|
| 36 |
+
if (errorData.detail) {
|
| 37 |
+
// Gestion spéciale pour les erreurs Pydantic
|
| 38 |
+
if (typeof errorData.detail === 'string') {
|
| 39 |
+
errorMessage = errorData.detail
|
| 40 |
+
} else if (Array.isArray(errorData.detail)) {
|
| 41 |
+
// Erreurs de validation Pydantic
|
| 42 |
+
errorMessage = errorData.detail.map(err => {
|
| 43 |
+
if (err.msg && err.loc) {
|
| 44 |
+
return `${err.loc.join('.')}: ${err.msg}`
|
| 45 |
+
}
|
| 46 |
+
return err.msg || 'Erreur de validation'
|
| 47 |
+
}).join(', ')
|
| 48 |
+
}
|
| 49 |
+
} else if (errorData.message) {
|
| 50 |
+
errorMessage = errorData.message
|
| 51 |
+
}
|
| 52 |
+
} catch (parseError) {
|
| 53 |
+
// Si on ne peut pas parser la réponse, garder le message d'erreur HTTP
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
return {
|
| 57 |
+
status: 'failed',
|
| 58 |
+
message: errorMessage,
|
| 59 |
+
error: errorMessage
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
const result = await response.json()
|
| 64 |
+
|
| 65 |
+
// S'assurer que le résultat a un status, sinon l'ajouter
|
| 66 |
+
if (!result.status) {
|
| 67 |
+
result.status = 'success'
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
return result
|
| 71 |
+
} catch (error) {
|
| 72 |
+
// En cas d'erreur de réseau ou autre, retourner un objet d'erreur
|
| 73 |
+
return {
|
| 74 |
+
status: 'failed',
|
| 75 |
+
message: `Calibration failed: ${error.message}`,
|
| 76 |
+
error: error.message
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
async inferenceImage(imageFile, options = {}) {
|
| 82 |
+
if (!imageFile) {
|
| 83 |
+
throw new Error('No image file provided')
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
const formData = new FormData()
|
| 87 |
+
formData.append('image', imageFile)
|
| 88 |
+
|
| 89 |
+
const { kpThreshold = 0.15, lineThreshold = 0.15 } = options
|
| 90 |
+
// S'assurer que les valeurs sont des nombres
|
| 91 |
+
const kpThresholdNum = Number(kpThreshold)
|
| 92 |
+
const lineThresholdNum = Number(lineThreshold)
|
| 93 |
+
|
| 94 |
+
formData.append('kp_threshold', kpThresholdNum.toString())
|
| 95 |
+
formData.append('line_threshold', lineThresholdNum.toString())
|
| 96 |
+
|
| 97 |
+
console.log('🔥 Sending inference request with:', {
|
| 98 |
+
fileName: imageFile.name,
|
| 99 |
+
fileType: imageFile.type,
|
| 100 |
+
fileSize: imageFile.size,
|
| 101 |
+
kpThreshold,
|
| 102 |
+
lineThreshold
|
| 103 |
+
})
|
| 104 |
+
|
| 105 |
+
try {
|
| 106 |
+
const response = await fetch(`${this.baseURL}/inference/image`, {
|
| 107 |
+
method: 'POST',
|
| 108 |
+
body: formData
|
| 109 |
+
})
|
| 110 |
+
|
| 111 |
+
if (!response.ok) {
|
| 112 |
+
let errorMessage = `HTTP error! status: ${response.status}`
|
| 113 |
+
|
| 114 |
+
// Essayer de récupérer le message d'erreur détaillé du serveur
|
| 115 |
+
try {
|
| 116 |
+
const errorData = await response.json()
|
| 117 |
+
console.error('🔥 Detailed API error:', errorData)
|
| 118 |
+
|
| 119 |
+
if (errorData.detail) {
|
| 120 |
+
// Gestion spéciale pour les erreurs Pydantic
|
| 121 |
+
if (typeof errorData.detail === 'string') {
|
| 122 |
+
errorMessage = errorData.detail
|
| 123 |
+
} else if (Array.isArray(errorData.detail)) {
|
| 124 |
+
// Erreurs de validation Pydantic
|
| 125 |
+
errorMessage = errorData.detail.map(err => {
|
| 126 |
+
if (err.msg && err.loc) {
|
| 127 |
+
return `${err.loc.join('.')}: ${err.msg}`
|
| 128 |
+
}
|
| 129 |
+
return err.msg || 'Erreur de validation'
|
| 130 |
+
}).join(', ')
|
| 131 |
+
}
|
| 132 |
+
} else if (errorData.message) {
|
| 133 |
+
errorMessage = errorData.message
|
| 134 |
+
}
|
| 135 |
+
} catch (parseError) {
|
| 136 |
+
console.error('🔥 Could not parse error response:', parseError)
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
throw new Error(errorMessage)
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
return await response.json()
|
| 143 |
+
} catch (error) {
|
| 144 |
+
throw new Error(`Image inference failed: ${error.message}`)
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
async inferenceVideo(videoFile, options = {}) {
|
| 149 |
+
const formData = new FormData()
|
| 150 |
+
formData.append('video', videoFile)
|
| 151 |
+
|
| 152 |
+
const { kpThreshold = 0.15, lineThreshold = 0.15, frameStep = 10 } = options
|
| 153 |
+
formData.append('kp_threshold', kpThreshold)
|
| 154 |
+
formData.append('line_threshold', lineThreshold)
|
| 155 |
+
formData.append('frame_step', frameStep)
|
| 156 |
+
|
| 157 |
+
try {
|
| 158 |
+
const response = await fetch(`${this.baseURL}/inference/video`, {
|
| 159 |
+
method: 'POST',
|
| 160 |
+
body: formData
|
| 161 |
+
})
|
| 162 |
+
|
| 163 |
+
if (!response.ok) {
|
| 164 |
+
throw new Error(`HTTP error! status: ${response.status}`)
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
return await response.json()
|
| 168 |
+
} catch (error) {
|
| 169 |
+
throw new Error(`Video inference failed: ${error.message}`)
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
async manualCalibration(file, calibrationData) {
|
| 174 |
+
const formData = new FormData()
|
| 175 |
+
formData.append('file', file)
|
| 176 |
+
formData.append('calibration_data', JSON.stringify(calibrationData))
|
| 177 |
+
|
| 178 |
+
try {
|
| 179 |
+
const response = await fetch(`${this.baseURL}/calibrate/manual`, {
|
| 180 |
+
method: 'POST',
|
| 181 |
+
body: formData
|
| 182 |
+
})
|
| 183 |
+
|
| 184 |
+
if (!response.ok) {
|
| 185 |
+
throw new Error(`HTTP error! status: ${response.status}`)
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
return await response.json()
|
| 189 |
+
} catch (error) {
|
| 190 |
+
throw new Error(`Manual calibration failed: ${error.message}`)
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
export default new FootballVisionAPI()
|
src/stores/calibration.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { defineStore } from 'pinia'
|
| 2 |
+
|
| 3 |
+
export const useCalibrationStore = defineStore('calibration', {
|
| 4 |
+
state: () => ({
|
| 5 |
+
// Flux principal
|
| 6 |
+
mode: null, // 'auto' ou 'manual'
|
| 7 |
+
currentStep: 'mode-selection', // 'mode-selection', 'upload', 'video-type', 'processing', 'results'
|
| 8 |
+
|
| 9 |
+
// Traitement
|
| 10 |
+
processing: false,
|
| 11 |
+
processingProgress: 0,
|
| 12 |
+
processingTask: '',
|
| 13 |
+
|
| 14 |
+
// Résultats
|
| 15 |
+
results: null,
|
| 16 |
+
error: null,
|
| 17 |
+
|
| 18 |
+
// Configuration manuelle
|
| 19 |
+
manualLines: {},
|
| 20 |
+
|
| 21 |
+
// Configuration vidéo dynamique
|
| 22 |
+
videoProcessingParams: {
|
| 23 |
+
kpThreshold: 0.15,
|
| 24 |
+
lineThreshold: 0.15,
|
| 25 |
+
frameStep: 10
|
| 26 |
+
}
|
| 27 |
+
}),
|
| 28 |
+
|
| 29 |
+
getters: {
|
| 30 |
+
isAutoMode: (state) => state.mode === 'auto',
|
| 31 |
+
isManualMode: (state) => state.mode === 'manual',
|
| 32 |
+
hasResults: (state) => state.results !== null,
|
| 33 |
+
isProcessing: (state) => state.processing,
|
| 34 |
+
|
| 35 |
+
// Étapes actives
|
| 36 |
+
isModeSelection: (state) => state.currentStep === 'mode-selection',
|
| 37 |
+
isUploadStep: (state) => state.currentStep === 'upload',
|
| 38 |
+
isVideoTypeStep: (state) => state.currentStep === 'video-type',
|
| 39 |
+
isProcessingStep: (state) => state.currentStep === 'processing',
|
| 40 |
+
isResultsStep: (state) => state.currentStep === 'results'
|
| 41 |
+
},
|
| 42 |
+
|
| 43 |
+
actions: {
|
| 44 |
+
// Navigation entre étapes
|
| 45 |
+
setMode(mode) {
|
| 46 |
+
this.mode = mode
|
| 47 |
+
this.currentStep = 'upload'
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
+
setCurrentStep(step) {
|
| 51 |
+
this.currentStep = step
|
| 52 |
+
},
|
| 53 |
+
|
| 54 |
+
// Traitement
|
| 55 |
+
setProcessing(processing, task = '') {
|
| 56 |
+
this.processing = processing
|
| 57 |
+
this.processingTask = task
|
| 58 |
+
if (processing) {
|
| 59 |
+
this.currentStep = 'processing'
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
|
| 63 |
+
updateProgress(progress, task = '') {
|
| 64 |
+
this.processingProgress = progress
|
| 65 |
+
if (task) this.processingTask = task
|
| 66 |
+
},
|
| 67 |
+
|
| 68 |
+
setResults(results) {
|
| 69 |
+
this.results = results
|
| 70 |
+
this.processing = false
|
| 71 |
+
this.error = null
|
| 72 |
+
this.currentStep = 'results'
|
| 73 |
+
},
|
| 74 |
+
|
| 75 |
+
setError(error) {
|
| 76 |
+
this.error = error
|
| 77 |
+
this.processing = false
|
| 78 |
+
},
|
| 79 |
+
|
| 80 |
+
// Configuration
|
| 81 |
+
setVideoParams(params) {
|
| 82 |
+
this.videoProcessingParams = { ...this.videoProcessingParams, ...params }
|
| 83 |
+
},
|
| 84 |
+
|
| 85 |
+
setManualLines(lines) {
|
| 86 |
+
this.manualLines = lines
|
| 87 |
+
},
|
| 88 |
+
|
| 89 |
+
// Réinitialisation
|
| 90 |
+
reset() {
|
| 91 |
+
this.mode = null
|
| 92 |
+
this.currentStep = 'mode-selection'
|
| 93 |
+
this.processing = false
|
| 94 |
+
this.processingProgress = 0
|
| 95 |
+
this.processingTask = ''
|
| 96 |
+
this.results = null
|
| 97 |
+
this.error = null
|
| 98 |
+
this.manualLines = {}
|
| 99 |
+
},
|
| 100 |
+
|
| 101 |
+
// Passer en mode manuel depuis les résultats
|
| 102 |
+
switchToManual() {
|
| 103 |
+
this.mode = 'manual'
|
| 104 |
+
// On garde les autres données pour perm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
|
|
|
|
|
|
|
| 1 |
+
import { defineStore } from 'pinia'
|
| 2 |
+
|
| 3 |
+
export const useUploadStore = defineStore('upload', {
|
| 4 |
+
state: () => ({
|
| 5 |
+
selectedFile: null,
|
| 6 |
+
fileType: null, // 'image' ou 'video'
|
| 7 |
+
filePreview: null,
|
| 8 |
+
uploadStatus: 'idle', // 'idle', 'uploading', 'success', 'error'
|
| 9 |
+
error: null,
|
| 10 |
+
|
| 11 |
+
// Spécifique aux vidéos
|
| 12 |
+
videoType: null, // 'static' ou 'dynamic'
|
| 13 |
+
extractedFrame: null // Pour les vidéos statiques
|
| 14 |
+
}),
|
| 15 |
+
|
| 16 |
+
getters: {
|
| 17 |
+
isFileSelected: (state) => state.selectedFile !== null,
|
| 18 |
+
isImage: (state) => state.fileType === 'image',
|
| 19 |
+
isVideo: (state) => state.fileType === 'video',
|
| 20 |
+
isUploading: (state) => state.uploadStatus === 'uploading',
|
| 21 |
+
|
| 22 |
+
// Nouveaux getters pour les vidéos
|
| 23 |
+
isStaticVideo: (state) => state.fileType === 'video' && state.videoType === 'static',
|
| 24 |
+
isDynamicVideo: (state) => state.fileType === 'video' && state.videoType === 'dynamic',
|
| 25 |
+
shouldProcessDirectly: (state) => state.fileType === 'image' || state.isStaticVideo,
|
| 26 |
+
needsParameters: (state) => state.isDynamicVideo
|
| 27 |
+
},
|
| 28 |
+
|
| 29 |
+
actions: {
|
| 30 |
+
setFile(file) {
|
| 31 |
+
this.selectedFile = file
|
| 32 |
+
this.fileType = file.type.startsWith('image/') ? 'image' : 'video'
|
| 33 |
+
this.createPreview(file)
|
| 34 |
+
this.uploadStatus = 'idle'
|
| 35 |
+
this.error = null
|
| 36 |
+
|
| 37 |
+
// Reset video-specific data
|
| 38 |
+
this.videoType = null
|
| 39 |
+
this.extractedFrame = null
|
| 40 |
+
},
|
| 41 |
+
|
| 42 |
+
async setVideoType(type) {
|
| 43 |
+
this.videoType = type
|
| 44 |
+
if (type === 'static') {
|
| 45 |
+
console.log('🔥 Starting frame extraction for static video...')
|
| 46 |
+
await this.extractFrameFromVideo()
|
| 47 |
+
console.log('🔥 Frame extraction completed:', {
|
| 48 |
+
hasExtractedFrame: !!this.extractedFrame,
|
| 49 |
+
extractedFrameType: this.extractedFrame?.type,
|
| 50 |
+
extractedFrameName: this.extractedFrame?.name
|
| 51 |
+
})
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
|
| 55 |
+
createPreview(file) {
|
| 56 |
+
if (file.type.startsWith('image/')) {
|
| 57 |
+
this.filePreview = URL.createObjectURL(file)
|
| 58 |
+
} else {
|
| 59 |
+
this.filePreview = URL.createObjectURL(file)
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
|
| 63 |
+
async extractFrameFromVideo() {
|
| 64 |
+
if (!this.selectedFile || !this.isVideo) {
|
| 65 |
+
console.error('🔥 Cannot extract frame: no file or not a video')
|
| 66 |
+
return null
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
try {
|
| 70 |
+
const video = document.createElement('video')
|
| 71 |
+
video.src = URL.createObjectURL(this.selectedFile)
|
| 72 |
+
|
| 73 |
+
return new Promise((resolve, reject) => {
|
| 74 |
+
video.addEventListener('loadedmetadata', () => {
|
| 75 |
+
console.log('🔥 Video metadata loaded, seeking to frame 0')
|
| 76 |
+
video.currentTime = 0 // Première image
|
| 77 |
+
})
|
| 78 |
+
|
| 79 |
+
video.addEventListener('seeked', () => {
|
| 80 |
+
try {
|
| 81 |
+
console.log('🔥 Video seeked, drawing to canvas')
|
| 82 |
+
const canvas = document.createElement('canvas')
|
| 83 |
+
canvas.width = video.videoWidth
|
| 84 |
+
canvas.height = video.videoHeight
|
| 85 |
+
|
| 86 |
+
if (video.videoWidth === 0 || video.videoHeight === 0) {
|
| 87 |
+
throw new Error('Video dimensions are 0')
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
const ctx = canvas.getContext('2d')
|
| 91 |
+
ctx.drawImage(video, 0, 0)
|
| 92 |
+
|
| 93 |
+
canvas.toBlob((blob) => {
|
| 94 |
+
if (!blob) {
|
| 95 |
+
reject(new Error('Failed to create blob from canvas'))
|
| 96 |
+
return
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
// Créer un File avec un nom au lieu d'un Blob simple
|
| 100 |
+
const file = new File([blob], 'extracted_frame.jpg', { type: 'image/jpeg' })
|
| 101 |
+
this.extractedFrame = file
|
| 102 |
+
console.log('🔥 Frame extracted successfully:', {
|
| 103 |
+
name: file.name,
|
| 104 |
+
type: file.type,
|
| 105 |
+
size: file.size
|
| 106 |
+
})
|
| 107 |
+
URL.revokeObjectURL(video.src)
|
| 108 |
+
resolve(file)
|
| 109 |
+
}, 'image/jpeg', 0.9)
|
| 110 |
+
} catch (err) {
|
| 111 |
+
console.error('🔥 Error during canvas operations:', err)
|
| 112 |
+
URL.revokeObjectURL(video.src)
|
| 113 |
+
reject(err)
|
| 114 |
+
}
|
| 115 |
+
})
|
| 116 |
+
|
| 117 |
+
video.addEventListener('error', (err) => {
|
| 118 |
+
console.error('🔥 Video loading error:', err)
|
| 119 |
+
URL.revokeObjectURL(video.src)
|
| 120 |
+
reject(err)
|
| 121 |
+
})
|
| 122 |
+
|
| 123 |
+
// Timeout de sécurité
|
| 124 |
+
setTimeout(() => {
|
| 125 |
+
console.error('🔥 Frame extraction timeout')
|
| 126 |
+
URL.revokeObjectURL(video.src)
|
| 127 |
+
reject(new Error('Frame extraction timeout'))
|
| 128 |
+
}, 10000)
|
| 129 |
+
})
|
| 130 |
+
} catch (error) {
|
| 131 |
+
console.error('🔥 Erreur extraction frame:', error)
|
| 132 |
+
this.setError('Impossible d\'extraire une image de la vidéo: ' + error.message)
|
| 133 |
+
return null
|
| 134 |
+
}
|
| 135 |
+
},
|
| 136 |
+
|
| 137 |
+
clearFile() {
|
| 138 |
+
if (this.filePreview) {
|
| 139 |
+
URL.revokeObjectURL(this.filePreview)
|
| 140 |
+
}
|
| 141 |
+
this.selectedFile = null
|
| 142 |
+
this.fileType = null
|
| 143 |
+
this.filePreview = null
|
| 144 |
+
this.uploadStatus = 'idle'
|
| 145 |
+
this.error = null
|
| 146 |
+
this.videoType = null
|
| 147 |
+
this.extractedFrame = null
|
| 148 |
+
},
|
| 149 |
+
|
| 150 |
+
setUploadStatus(status) {
|
| 151 |
+
this.uploadStatus = status
|
| 152 |
+
},
|
| 153 |
+
|
| 154 |
+
setError(error) {
|
| 155 |
+
this.error = error
|
| 156 |
+
this.uploadStatus = 'error'
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
})
|
src/views/HomeView.vue
ADDED
|
@@ -0,0 +1,1837 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script setup>
|
| 2 |
+
import { ref, computed, nextTick, watch } from 'vue'
|
| 3 |
+
import { useRouter } from 'vue-router'
|
| 4 |
+
import { useCalibrationStore } from '../stores/calibration'
|
| 5 |
+
import { useUploadStore } from '../stores/upload'
|
| 6 |
+
import api from '../services/api'
|
| 7 |
+
import CalibrationArea from '@/components/CalibrationArea.vue'
|
| 8 |
+
import FootballField from '@/components/FootballField.vue'
|
| 9 |
+
|
| 10 |
+
const router = useRouter()
|
| 11 |
+
const calibrationStore = useCalibrationStore()
|
| 12 |
+
const uploadStore = useUploadStore()
|
| 13 |
+
|
| 14 |
+
// Refs pour les sections
|
| 15 |
+
const modeSection = ref(null)
|
| 16 |
+
const uploadSection = ref(null)
|
| 17 |
+
const videoTypeSection = ref(null)
|
| 18 |
+
const parametersSection = ref(null)
|
| 19 |
+
const processingSection = ref(null)
|
| 20 |
+
const errorSection = ref(null)
|
| 21 |
+
const resultsSection = ref(null)
|
| 22 |
+
const manualSection = ref(null)
|
| 23 |
+
|
| 24 |
+
// États locaux
|
| 25 |
+
const dragActive = ref(false)
|
| 26 |
+
|
| 27 |
+
// États pour la vue manuelle
|
| 28 |
+
const thumbnail = ref(null)
|
| 29 |
+
const calibrationPoints = ref({})
|
| 30 |
+
const selectedFieldPoint = ref(null)
|
| 31 |
+
const calibrationLines = ref({})
|
| 32 |
+
const selectedFieldLine = ref(null)
|
| 33 |
+
|
| 34 |
+
// Refs pour les composants manuels
|
| 35 |
+
const calibrationArea = ref(null)
|
| 36 |
+
const footballField = ref(null)
|
| 37 |
+
|
| 38 |
+
// Computed
|
| 39 |
+
const showUpload = computed(() => calibrationStore.mode !== null && !uploadStore.isFileSelected)
|
| 40 |
+
const showVideoType = computed(() => uploadStore.isVideo && uploadStore.isFileSelected && uploadStore.videoType === null)
|
| 41 |
+
const showParameters = computed(() => uploadStore.needsParameters && !showManualCalibration.value)
|
| 42 |
+
const showProcessing = computed(() => calibrationStore.isProcessingStep)
|
| 43 |
+
const showResults = computed(() => calibrationStore.isResultsStep)
|
| 44 |
+
const showError = computed(() => calibrationStore.error !== null && !showManualCalibration.value)
|
| 45 |
+
|
| 46 |
+
// Computed pour afficher la vue manuelle
|
| 47 |
+
const showManualCalibration = computed(() => {
|
| 48 |
+
return calibrationStore.isManualMode &&
|
| 49 |
+
uploadStore.isFileSelected &&
|
| 50 |
+
(uploadStore.isImage || (uploadStore.isVideo && uploadStore.videoType === 'static'))
|
| 51 |
+
})
|
| 52 |
+
|
| 53 |
+
// Watchers pour le scroll automatique
|
| 54 |
+
watch(() => calibrationStore.mode, async (newMode) => {
|
| 55 |
+
if (newMode) {
|
| 56 |
+
await nextTick()
|
| 57 |
+
scrollToSection(uploadSection.value)
|
| 58 |
+
}
|
| 59 |
+
})
|
| 60 |
+
|
| 61 |
+
watch(() => uploadStore.isVideo, async (isVideo) => {
|
| 62 |
+
if (isVideo && uploadStore.isFileSelected) {
|
| 63 |
+
await nextTick()
|
| 64 |
+
scrollToSection(videoTypeSection.value)
|
| 65 |
+
}
|
| 66 |
+
})
|
| 67 |
+
|
| 68 |
+
watch(() => uploadStore.videoType, async (videoType) => {
|
| 69 |
+
if (calibrationStore.isManualMode) {
|
| 70 |
+
if (videoType === 'static') {
|
| 71 |
+
// Vidéo statique en mode manuel : charger la vue manuelle intégrée
|
| 72 |
+
await loadThumbnail()
|
| 73 |
+
await nextTick()
|
| 74 |
+
scrollToSection(manualSection.value)
|
| 75 |
+
} else if (videoType === 'dynamic') {
|
| 76 |
+
// Vidéo dynamique en mode manuel : afficher message d'avertissement
|
| 77 |
+
calibrationStore.setError("Le mode manuel pour les vidéos dynamiques n'est pas encore disponible. Cette fonctionnalité nécessite l'implémentation de nouvelles features. Veuillez utiliser le mode automatique ou sélectionner une vidéo statique.")
|
| 78 |
+
await nextTick()
|
| 79 |
+
scrollToSection(errorSection.value)
|
| 80 |
+
}
|
| 81 |
+
} else if (videoType === 'dynamic') {
|
| 82 |
+
await nextTick()
|
| 83 |
+
scrollToSection(parametersSection.value)
|
| 84 |
+
}
|
| 85 |
+
// Suppression du lancement automatique - sera géré par le watcher extractedFrame
|
| 86 |
+
})
|
| 87 |
+
|
| 88 |
+
// Watcher spécifique pour l'extraction de frame terminée
|
| 89 |
+
watch(() => uploadStore.extractedFrame, async (extractedFrame) => {
|
| 90 |
+
// Lancement automatique quand la frame est extraite en mode auto + vidéo statique
|
| 91 |
+
if (extractedFrame &&
|
| 92 |
+
calibrationStore.isAutoMode &&
|
| 93 |
+
uploadStore.isStaticVideo) {
|
| 94 |
+
console.log('🔥 Frame extracted, starting automatic processing...')
|
| 95 |
+
startProcessing()
|
| 96 |
+
}
|
| 97 |
+
})
|
| 98 |
+
|
| 99 |
+
watch(() => calibrationStore.isProcessingStep, async (isProcessing) => {
|
| 100 |
+
if (isProcessing) {
|
| 101 |
+
await nextTick()
|
| 102 |
+
scrollToSection(processingSection.value)
|
| 103 |
+
}
|
| 104 |
+
})
|
| 105 |
+
|
| 106 |
+
watch(() => calibrationStore.isResultsStep, async (isResults) => {
|
| 107 |
+
if (isResults) {
|
| 108 |
+
await nextTick()
|
| 109 |
+
scrollToSection(resultsSection.value)
|
| 110 |
+
}
|
| 111 |
+
})
|
| 112 |
+
|
| 113 |
+
// Watcher spécial pour les résultats en mode manuel
|
| 114 |
+
watch(() => calibrationStore.results, async (results) => {
|
| 115 |
+
if (results && calibrationStore.isManualMode) {
|
| 116 |
+
await nextTick()
|
| 117 |
+
scrollToSection(resultsSection.value)
|
| 118 |
+
}
|
| 119 |
+
})
|
| 120 |
+
|
| 121 |
+
watch(() => calibrationStore.error, async (error) => {
|
| 122 |
+
if (error) {
|
| 123 |
+
await nextTick()
|
| 124 |
+
scrollToSection(errorSection.value)
|
| 125 |
+
}
|
| 126 |
+
})
|
| 127 |
+
|
| 128 |
+
// Méthodes
|
| 129 |
+
const scrollToSection = (element) => {
|
| 130 |
+
if (element) {
|
| 131 |
+
element.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
const selectMode = (mode) => {
|
| 136 |
+
calibrationStore.setMode(mode)
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
const resetToStart = () => {
|
| 140 |
+
// Réinitialiser tous les stores
|
| 141 |
+
calibrationStore.reset()
|
| 142 |
+
uploadStore.clearFile()
|
| 143 |
+
|
| 144 |
+
// Scroll vers le haut
|
| 145 |
+
scrollToSection(modeSection.value)
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
const handleFileSelect = async (event) => {
|
| 149 |
+
const file = event.target.files[0]
|
| 150 |
+
if (file) {
|
| 151 |
+
uploadStore.setFile(file)
|
| 152 |
+
|
| 153 |
+
if (calibrationStore.isManualMode) {
|
| 154 |
+
if (uploadStore.isImage) {
|
| 155 |
+
// En mode manuel avec image, charger la vue manuelle intégrée
|
| 156 |
+
await loadThumbnail()
|
| 157 |
+
await nextTick()
|
| 158 |
+
scrollToSection(manualSection.value)
|
| 159 |
+
} else if (uploadStore.isVideo) {
|
| 160 |
+
// En mode manuel avec vidéo, aller au choix statique/dynamique
|
| 161 |
+
await nextTick()
|
| 162 |
+
scrollToSection(videoTypeSection.value)
|
| 163 |
+
}
|
| 164 |
+
} else if (calibrationStore.isAutoMode && uploadStore.isImage) {
|
| 165 |
+
// En mode auto, lancement automatique pour les images
|
| 166 |
+
startProcessing()
|
| 167 |
+
}
|
| 168 |
+
// Pour les vidéos en mode auto, on laisse le flow normal (choix statique/dynamique)
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
const handleDrop = async (event) => {
|
| 173 |
+
event.preventDefault()
|
| 174 |
+
dragActive.value = false
|
| 175 |
+
|
| 176 |
+
const files = event.dataTransfer.files
|
| 177 |
+
if (files.length > 0) {
|
| 178 |
+
uploadStore.setFile(files[0])
|
| 179 |
+
|
| 180 |
+
if (calibrationStore.isManualMode) {
|
| 181 |
+
if (uploadStore.isImage) {
|
| 182 |
+
// En mode manuel avec image, charger la vue manuelle intégrée
|
| 183 |
+
await loadThumbnail()
|
| 184 |
+
await nextTick()
|
| 185 |
+
scrollToSection(manualSection.value)
|
| 186 |
+
} else if (uploadStore.isVideo) {
|
| 187 |
+
// En mode manuel avec vidéo, aller au choix statique/dynamique
|
| 188 |
+
await nextTick()
|
| 189 |
+
scrollToSection(videoTypeSection.value)
|
| 190 |
+
}
|
| 191 |
+
} else if (calibrationStore.isAutoMode && uploadStore.isImage) {
|
| 192 |
+
// En mode auto, lancement automatique pour les images
|
| 193 |
+
startProcessing()
|
| 194 |
+
}
|
| 195 |
+
// Pour les vidéos en mode auto, on laisse le flow normal (choix statique/dynamique)
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
const handleDragOver = (event) => {
|
| 200 |
+
event.preventDefault()
|
| 201 |
+
dragActive.value = true
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
const handleDragLeave = () => {
|
| 205 |
+
dragActive.value = false
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
const selectVideoType = async (type) => {
|
| 209 |
+
await uploadStore.setVideoType(type)
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
const updateParameter = (param, value) => {
|
| 213 |
+
calibrationStore.setVideoParams({ [param]: value })
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
const startProcessing = async () => {
|
| 217 |
+
calibrationStore.setProcessing(true, 'Initialisation...')
|
| 218 |
+
|
| 219 |
+
try {
|
| 220 |
+
let result
|
| 221 |
+
|
| 222 |
+
if (uploadStore.isImage || uploadStore.isStaticVideo) {
|
| 223 |
+
// Traitement d'image ou de frame extraite
|
| 224 |
+
const fileToProcess = uploadStore.isImage ?
|
| 225 |
+
uploadStore.selectedFile :
|
| 226 |
+
uploadStore.extractedFrame
|
| 227 |
+
|
| 228 |
+
// Vérification que le fichier existe
|
| 229 |
+
if (!fileToProcess) {
|
| 230 |
+
const errorMsg = uploadStore.isImage ?
|
| 231 |
+
'Aucun fichier image sélectionné' :
|
| 232 |
+
'Frame non extraite de la vidéo. Essayez de recharger la vidéo.'
|
| 233 |
+
throw new Error(errorMsg)
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
// Logs détaillés pour debug
|
| 237 |
+
console.log('🔥 File to process details:', {
|
| 238 |
+
name: fileToProcess?.name,
|
| 239 |
+
type: fileToProcess?.type,
|
| 240 |
+
size: fileToProcess?.size,
|
| 241 |
+
constructor: fileToProcess?.constructor?.name
|
| 242 |
+
})
|
| 243 |
+
|
| 244 |
+
console.log('🔥 Processing params:', {
|
| 245 |
+
kpThreshold: calibrationStore.videoProcessingParams.kpThreshold,
|
| 246 |
+
lineThreshold: calibrationStore.videoProcessingParams.lineThreshold,
|
| 247 |
+
typeOfKp: typeof calibrationStore.videoProcessingParams.kpThreshold,
|
| 248 |
+
typeOfLine: typeof calibrationStore.videoProcessingParams.lineThreshold
|
| 249 |
+
})
|
| 250 |
+
|
| 251 |
+
// Test de diagnostic si c'est une vidéo statique
|
| 252 |
+
if (uploadStore.isStaticVideo && uploadStore.extractedFrame) {
|
| 253 |
+
console.log('🔥 Testing extracted frame:', {
|
| 254 |
+
isFile: fileToProcess instanceof File,
|
| 255 |
+
isBlob: fileToProcess instanceof Blob,
|
| 256 |
+
hasName: !!fileToProcess.name,
|
| 257 |
+
hasType: !!fileToProcess.type
|
| 258 |
+
})
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
result = await processWithProgress(() =>
|
| 262 |
+
api.inferenceImage(fileToProcess, {
|
| 263 |
+
kpThreshold: calibrationStore.videoProcessingParams.kpThreshold,
|
| 264 |
+
lineThreshold: calibrationStore.videoProcessingParams.lineThreshold
|
| 265 |
+
})
|
| 266 |
+
)
|
| 267 |
+
} else if (uploadStore.isDynamicVideo) {
|
| 268 |
+
// Traitement de vidéo dynamique
|
| 269 |
+
result = await processWithProgress(() =>
|
| 270 |
+
api.inferenceVideo(uploadStore.selectedFile, calibrationStore.videoProcessingParams)
|
| 271 |
+
)
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
// Console log de la réponse API
|
| 275 |
+
console.log('🔥 Réponse API reçue:', result)
|
| 276 |
+
|
| 277 |
+
if (result.status === 'success') {
|
| 278 |
+
calibrationStore.setResults(result)
|
| 279 |
+
} else if (result.status === 'failed') {
|
| 280 |
+
throw new Error(result.message || "Échec de l'extraction des paramètres")
|
| 281 |
+
} else {
|
| 282 |
+
throw new Error(result.error || 'Erreur de traitement')
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
} catch (error) {
|
| 286 |
+
console.error('❌ Erreur lors du traitement:', error)
|
| 287 |
+
calibrationStore.setError(error.message)
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
const processWithProgress = async (processFunction) => {
|
| 292 |
+
// Activer le mode processing
|
| 293 |
+
calibrationStore.setProcessing(true, 'Initialisation...')
|
| 294 |
+
|
| 295 |
+
const tasks = [
|
| 296 |
+
'Chargement du fichier...',
|
| 297 |
+
'Détection des lignes du terrain...',
|
| 298 |
+
'Analyse des points clés...',
|
| 299 |
+
'Calcul des paramètres de caméra...',
|
| 300 |
+
'Finalisation...'
|
| 301 |
+
]
|
| 302 |
+
|
| 303 |
+
// Simulation du progrès
|
| 304 |
+
for (let i = 0; i < tasks.length; i++) {
|
| 305 |
+
calibrationStore.updateProgress((i / tasks.length) * 100, tasks[i])
|
| 306 |
+
await new Promise(resolve => setTimeout(resolve, 500))
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
// Traitement réel
|
| 310 |
+
const result = await processFunction()
|
| 311 |
+
calibrationStore.updateProgress(100, 'Terminé !')
|
| 312 |
+
|
| 313 |
+
return result
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
const goToManual = async () => {
|
| 317 |
+
calibrationStore.switchToManual()
|
| 318 |
+
await loadThumbnail()
|
| 319 |
+
await nextTick()
|
| 320 |
+
scrollToSection(manualSection.value)
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
const backToCalibration = async () => {
|
| 324 |
+
// Réinitialiser les erreurs et résultats
|
| 325 |
+
calibrationStore.setError(null)
|
| 326 |
+
calibrationStore.setResults(null)
|
| 327 |
+
calibrationStore.setProcessing(false)
|
| 328 |
+
|
| 329 |
+
// Retourner à la section de calibration manuelle
|
| 330 |
+
await nextTick()
|
| 331 |
+
scrollToSection(manualSection.value)
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
const restart = () => {
|
| 335 |
+
calibrationStore.reset()
|
| 336 |
+
uploadStore.clearFile()
|
| 337 |
+
scrollToSection(modeSection.value)
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
const exportResults = () => {
|
| 341 |
+
const data = calibrationStore.results
|
| 342 |
+
const filename = 'football_vision_results.json'
|
| 343 |
+
|
| 344 |
+
const content = JSON.stringify(data, null, 2)
|
| 345 |
+
|
| 346 |
+
const blob = new Blob([content], { type: 'application/json' })
|
| 347 |
+
const url = URL.createObjectURL(blob)
|
| 348 |
+
const a = document.createElement('a')
|
| 349 |
+
a.href = url
|
| 350 |
+
a.download = filename
|
| 351 |
+
a.click()
|
| 352 |
+
URL.revokeObjectURL(url)
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
// Méthodes pour la vue manuelle
|
| 356 |
+
const loadThumbnail = async () => {
|
| 357 |
+
try {
|
| 358 |
+
thumbnail.value = null
|
| 359 |
+
|
| 360 |
+
if (uploadStore.isImage) {
|
| 361 |
+
// Pour les images, utiliser directement la preview
|
| 362 |
+
thumbnail.value = uploadStore.filePreview
|
| 363 |
+
} else if (uploadStore.isStaticVideo && uploadStore.extractedFrame) {
|
| 364 |
+
// Pour les vidéos statiques, utiliser la frame déjà extraite
|
| 365 |
+
console.log('Using extracted frame from static video:', uploadStore.selectedFile.name)
|
| 366 |
+
thumbnail.value = URL.createObjectURL(uploadStore.extractedFrame)
|
| 367 |
+
} else if (uploadStore.isVideo) {
|
| 368 |
+
// Pour les autres vidéos, extraire la première frame
|
| 369 |
+
console.log('Extracting first frame from video:', uploadStore.selectedFile.name)
|
| 370 |
+
|
| 371 |
+
// Créer une URL pour le fichier vidéo
|
| 372 |
+
const videoUrl = URL.createObjectURL(uploadStore.selectedFile)
|
| 373 |
+
|
| 374 |
+
// Extraire la première frame avec un canvas
|
| 375 |
+
const video = document.createElement('video')
|
| 376 |
+
video.src = videoUrl
|
| 377 |
+
video.muted = true // Important pour éviter les problèmes d'autoplay
|
| 378 |
+
|
| 379 |
+
await new Promise((resolve, reject) => {
|
| 380 |
+
video.addEventListener('loadedmetadata', () => {
|
| 381 |
+
video.currentTime = 0 // Aller à la première frame
|
| 382 |
+
})
|
| 383 |
+
|
| 384 |
+
video.addEventListener('seeked', () => {
|
| 385 |
+
try {
|
| 386 |
+
const canvas = document.createElement('canvas')
|
| 387 |
+
canvas.width = video.videoWidth
|
| 388 |
+
canvas.height = video.videoHeight
|
| 389 |
+
|
| 390 |
+
const ctx = canvas.getContext('2d')
|
| 391 |
+
ctx.drawImage(video, 0, 0)
|
| 392 |
+
|
| 393 |
+
thumbnail.value = canvas.toDataURL('image/jpeg', 0.9)
|
| 394 |
+
URL.revokeObjectURL(videoUrl)
|
| 395 |
+
resolve()
|
| 396 |
+
} catch (err) {
|
| 397 |
+
URL.revokeObjectURL(videoUrl)
|
| 398 |
+
reject(err)
|
| 399 |
+
}
|
| 400 |
+
})
|
| 401 |
+
|
| 402 |
+
video.addEventListener('error', (err) => {
|
| 403 |
+
URL.revokeObjectURL(videoUrl)
|
| 404 |
+
reject(err)
|
| 405 |
+
})
|
| 406 |
+
})
|
| 407 |
+
}
|
| 408 |
+
} catch (error) {
|
| 409 |
+
console.error('Erreur lors du chargement du thumbnail:', error)
|
| 410 |
+
thumbnail.value = null
|
| 411 |
+
}
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
const handleFieldPointSelected = (pointData) => {
|
| 415 |
+
selectedFieldLine.value = null
|
| 416 |
+
selectedFieldPoint.value = pointData
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
const handleFieldLineSelected = (lineData) => {
|
| 420 |
+
selectedFieldPoint.value = null
|
| 421 |
+
selectedFieldLine.value = lineData
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
const updateThumbnail = (newThumbnail) => {
|
| 425 |
+
thumbnail.value = newThumbnail
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
const updateCalibrationPoints = (newPoints) => {
|
| 429 |
+
calibrationPoints.value = { ...newPoints }
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
const updateCalibrationLines = (newLines) => {
|
| 433 |
+
calibrationLines.value = { ...newLines }
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
const updateSelectedFieldPoint = (newPoint) => {
|
| 437 |
+
selectedFieldPoint.value = newPoint
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
const updateSelectedFieldLine = (newLine) => {
|
| 441 |
+
selectedFieldLine.value = newLine
|
| 442 |
+
if (footballField.value) {
|
| 443 |
+
footballField.value.selectedLine = newLine ? newLine.id : null
|
| 444 |
+
}
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
const clearCalibration = () => {
|
| 448 |
+
calibrationPoints.value = {}
|
| 449 |
+
calibrationLines.value = {}
|
| 450 |
+
selectedFieldPoint.value = null
|
| 451 |
+
selectedFieldLine.value = null
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
const processCalibration = async () => {
|
| 455 |
+
if (!uploadStore.selectedFile || Object.keys(calibrationLines.value).length === 0) {
|
| 456 |
+
alert('Veuillez créer au moins une ligne de calibration')
|
| 457 |
+
return
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
// Scroll immédiat vers la section de processing
|
| 461 |
+
scrollToSection(processingSection.value)
|
| 462 |
+
await nextTick()
|
| 463 |
+
|
| 464 |
+
try {
|
| 465 |
+
// Utiliser le même système de progress que la version automatique
|
| 466 |
+
const result = await processWithProgress(async () => {
|
| 467 |
+
if (!calibrationArea.value) {
|
| 468 |
+
throw new Error('CalibrationArea component is not mounted.')
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
const imageContainer = document.querySelector('.video-frame')
|
| 472 |
+
const imageSize = calibrationArea.value.imageSize
|
| 473 |
+
if (!imageSize) {
|
| 474 |
+
throw new Error('Image size is not available.')
|
| 475 |
+
}
|
| 476 |
+
const containerWidth = imageContainer.clientWidth
|
| 477 |
+
const containerHeight = imageContainer.clientHeight
|
| 478 |
+
|
| 479 |
+
// Préparer les données des lignes pour l'API /calibrate
|
| 480 |
+
const linesData = {}
|
| 481 |
+
|
| 482 |
+
// Traitement des lignes - conversion des coordonnées container vers image
|
| 483 |
+
for (const [lineName, line] of Object.entries(calibrationLines.value)) {
|
| 484 |
+
linesData[lineName] = line.points.map(point => {
|
| 485 |
+
return {
|
| 486 |
+
x: point.x / containerWidth * imageSize.width,
|
| 487 |
+
y: point.y / containerHeight * imageSize.height
|
| 488 |
+
}
|
| 489 |
+
})
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
console.log('🔥 Données de lignes pour calibration:', linesData)
|
| 493 |
+
|
| 494 |
+
// Déterminer quel fichier envoyer à l'API
|
| 495 |
+
let fileToSend
|
| 496 |
+
if (uploadStore.isImage) {
|
| 497 |
+
// Pour les images, utiliser le fichier original
|
| 498 |
+
fileToSend = uploadStore.selectedFile
|
| 499 |
+
} else if (uploadStore.isStaticVideo && uploadStore.extractedFrame) {
|
| 500 |
+
// Pour les vidéos statiques, utiliser la frame extraite
|
| 501 |
+
fileToSend = uploadStore.extractedFrame
|
| 502 |
+
} else {
|
| 503 |
+
throw new Error('Aucune image disponible pour la calibration')
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
console.log('🔥 Fichier envoyé pour calibration:', fileToSend.name || 'extracted_frame.jpg', 'Type:', fileToSend.type)
|
| 507 |
+
|
| 508 |
+
// Appeler l'API /calibrate avec l'image et les lignes
|
| 509 |
+
return await api.calibrateCamera(fileToSend, linesData)
|
| 510 |
+
})
|
| 511 |
+
|
| 512 |
+
// Console log de la réponse API
|
| 513 |
+
console.log('🔥 Réponse API calibration reçue:', result)
|
| 514 |
+
|
| 515 |
+
// Toujours afficher les résultats, même en cas d'erreur
|
| 516 |
+
calibrationStore.setResults(result)
|
| 517 |
+
|
| 518 |
+
} catch (error) {
|
| 519 |
+
console.error('❌ Erreur lors du traitement manuel:', error)
|
| 520 |
+
// En cas d'erreur de réseau ou autre, créer un objet de résultat d'erreur
|
| 521 |
+
calibrationStore.setResults({
|
| 522 |
+
status: 'failed',
|
| 523 |
+
message: error.message,
|
| 524 |
+
error: error.message
|
| 525 |
+
})
|
| 526 |
+
}
|
| 527 |
+
}
|
| 528 |
+
</script>
|
| 529 |
+
|
| 530 |
+
<template>
|
| 531 |
+
<div class="home-container">
|
| 532 |
+
<!-- Bouton retour subtil (visible si on a déjà fait des actions) -->
|
| 533 |
+
<button
|
| 534 |
+
v-if="showUpload || showResults || showError"
|
| 535 |
+
@click="resetToStart"
|
| 536 |
+
class="btn-back-home"
|
| 537 |
+
title="Recommencer"
|
| 538 |
+
>
|
| 539 |
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 540 |
+
<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/>
|
| 541 |
+
<path d="M21 3v5h-5"/>
|
| 542 |
+
<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/>
|
| 543 |
+
<path d="M3 21v-5h5"/>
|
| 544 |
+
</svg>
|
| 545 |
+
</button>
|
| 546 |
+
|
| 547 |
+
<!-- Section 1: Choix du mode -->
|
| 548 |
+
<section ref="modeSection" class="section mode-section">
|
| 549 |
+
<div class="hero">
|
| 550 |
+
<h1>Football Vision</h1>
|
| 551 |
+
<p class="hero-subtitle">Analysez automatiquement les paramètres de caméra de vos vidéos de football</p>
|
| 552 |
+
</div>
|
| 553 |
+
|
| 554 |
+
<div class="mode-selection">
|
| 555 |
+
<div class="mode-cards">
|
| 556 |
+
<div
|
| 557 |
+
class="mode-card auto"
|
| 558 |
+
:class="{ selected: calibrationStore.isAutoMode }"
|
| 559 |
+
@click="selectMode('auto')"
|
| 560 |
+
>
|
| 561 |
+
<h3>Mode Automatique</h3>
|
| 562 |
+
<p>Détection automatique des lignes du terrain</p>
|
| 563 |
+
<ul>
|
| 564 |
+
<li>Rapide et simple</li>
|
| 565 |
+
<li>Précision élevée</li>
|
| 566 |
+
<li>Recommandé</li>
|
| 567 |
+
</ul>
|
| 568 |
+
</div>
|
| 569 |
+
|
| 570 |
+
<div
|
| 571 |
+
class="mode-card manual"
|
| 572 |
+
:class="{ selected: calibrationStore.isManualMode }"
|
| 573 |
+
@click="selectMode('manual')"
|
| 574 |
+
>
|
| 575 |
+
<h3>Mode Manuel</h3>
|
| 576 |
+
<p>Contrôle total sur la définition des lignes</p>
|
| 577 |
+
<ul>
|
| 578 |
+
<li>Contrôle précis</li>
|
| 579 |
+
<li>Personnalisable</li>
|
| 580 |
+
<li>Cas spéciaux</li>
|
| 581 |
+
</ul>
|
| 582 |
+
</div>
|
| 583 |
+
</div>
|
| 584 |
+
</div>
|
| 585 |
+
</section>
|
| 586 |
+
|
| 587 |
+
<!-- Section 2: Upload de fichier -->
|
| 588 |
+
<section v-if="showUpload" ref="uploadSection" class="section upload-section">
|
| 589 |
+
|
| 590 |
+
<div
|
| 591 |
+
class="drop-zone"
|
| 592 |
+
:class="{
|
| 593 |
+
active: dragActive,
|
| 594 |
+
'has-file': uploadStore.isFileSelected,
|
| 595 |
+
'processing': uploadStore.isUploading
|
| 596 |
+
}"
|
| 597 |
+
@drop="handleDrop"
|
| 598 |
+
@dragover="handleDragOver"
|
| 599 |
+
@dragleave="handleDragLeave"
|
| 600 |
+
>
|
| 601 |
+
<div v-if="!uploadStore.isFileSelected" class="drop-content">
|
| 602 |
+
<div class="upload-icon">+</div>
|
| 603 |
+
<h3>Glissez-déposez votre fichier ici</h3>
|
| 604 |
+
<p class="or-text">ou</p>
|
| 605 |
+
<label class="file-input-label">
|
| 606 |
+
<input
|
| 607 |
+
type="file"
|
| 608 |
+
accept="image/*,video/*"
|
| 609 |
+
@change="handleFileSelect"
|
| 610 |
+
hidden
|
| 611 |
+
>
|
| 612 |
+
Choisir un fichier
|
| 613 |
+
</label>
|
| 614 |
+
<p class="format-info">Images: JPG, PNG | Vidéos: MP4, AVI, MOV</p>
|
| 615 |
+
</div>
|
| 616 |
+
|
| 617 |
+
<div v-else class="file-preview">
|
| 618 |
+
<div class="file-info">
|
| 619 |
+
<h3>Fichier sélectionné</h3>
|
| 620 |
+
<p class="file-name">{{ uploadStore.selectedFile.name }}</p>
|
| 621 |
+
<p class="file-details">
|
| 622 |
+
<span>Type: {{ uploadStore.fileType === 'image' ? 'Image' : 'Vidéo' }}</span>
|
| 623 |
+
<span>Taille: {{ Math.round(uploadStore.selectedFile.size / 1024) }} KB</span>
|
| 624 |
+
</p>
|
| 625 |
+
</div>
|
| 626 |
+
|
| 627 |
+
<div class="preview" v-if="uploadStore.filePreview">
|
| 628 |
+
<img
|
| 629 |
+
v-if="uploadStore.isImage"
|
| 630 |
+
:src="uploadStore.filePreview"
|
| 631 |
+
alt="Preview"
|
| 632 |
+
class="preview-media"
|
| 633 |
+
>
|
| 634 |
+
<video
|
| 635 |
+
v-else
|
| 636 |
+
:src="uploadStore.filePreview"
|
| 637 |
+
controls
|
| 638 |
+
class="preview-media"
|
| 639 |
+
>
|
| 640 |
+
</video>
|
| 641 |
+
</div>
|
| 642 |
+
|
| 643 |
+
<button @click="uploadStore.clearFile()" class="btn-secondary">
|
| 644 |
+
Changer de fichier
|
| 645 |
+
</button>
|
| 646 |
+
</div>
|
| 647 |
+
</div>
|
| 648 |
+
</section>
|
| 649 |
+
|
| 650 |
+
<!-- Section 3: Type de vidéo (statique/dynamique) -->
|
| 651 |
+
<section v-if="showVideoType" ref="videoTypeSection" class="section video-type-section">
|
| 652 |
+
<h2>Type de vidéo</h2>
|
| 653 |
+
|
| 654 |
+
<div class="video-type-cards">
|
| 655 |
+
<div
|
| 656 |
+
class="type-card static"
|
| 657 |
+
:class="{ selected: uploadStore.videoType === 'static' }"
|
| 658 |
+
@click="selectVideoType('static')"
|
| 659 |
+
>
|
| 660 |
+
<h3>Vidéo Statique</h3>
|
| 661 |
+
<p>Caméra fixe, extraction de la première image</p>
|
| 662 |
+
<ul>
|
| 663 |
+
<li>Traitement rapide</li>
|
| 664 |
+
<li>Analyse comme une image</li>
|
| 665 |
+
<li>Recommandé pour caméra fixe</li>
|
| 666 |
+
</ul>
|
| 667 |
+
</div>
|
| 668 |
+
|
| 669 |
+
<div
|
| 670 |
+
class="type-card dynamic"
|
| 671 |
+
:class="{ selected: uploadStore.videoType === 'dynamic' }"
|
| 672 |
+
@click="selectVideoType('dynamic')"
|
| 673 |
+
>
|
| 674 |
+
<h3>Vidéo Dynamique</h3>
|
| 675 |
+
<p>Caméra en mouvement, analyse de plusieurs frames</p>
|
| 676 |
+
<ul>
|
| 677 |
+
<li>Analyse complète</li>
|
| 678 |
+
<li>Traitement avancé</li>
|
| 679 |
+
<li>Plus de données collectées</li>
|
| 680 |
+
</ul>
|
| 681 |
+
</div>
|
| 682 |
+
</div>
|
| 683 |
+
</section>
|
| 684 |
+
|
| 685 |
+
<!-- Section 4: Paramètres pour vidéo dynamique -->
|
| 686 |
+
<section v-if="showParameters" ref="parametersSection" class="section parameters-section">
|
| 687 |
+
<h2>Paramètres de traitement</h2>
|
| 688 |
+
|
| 689 |
+
<div class="parameters-form">
|
| 690 |
+
<div class="param-group">
|
| 691 |
+
<label>Seuil de détection des points clés</label>
|
| 692 |
+
<input
|
| 693 |
+
type="range"
|
| 694 |
+
min="0.1"
|
| 695 |
+
max="0.5"
|
| 696 |
+
step="0.05"
|
| 697 |
+
:value="calibrationStore.videoProcessingParams.kpThreshold"
|
| 698 |
+
@input="updateParameter('kpThreshold', parseFloat($event.target.value))"
|
| 699 |
+
>
|
| 700 |
+
<span class="param-value">{{ calibrationStore.videoProcessingParams.kpThreshold }}</span>
|
| 701 |
+
</div>
|
| 702 |
+
|
| 703 |
+
<div class="param-group">
|
| 704 |
+
<label>Seuil de détection des lignes</label>
|
| 705 |
+
<input
|
| 706 |
+
type="range"
|
| 707 |
+
min="0.1"
|
| 708 |
+
max="0.5"
|
| 709 |
+
step="0.05"
|
| 710 |
+
:value="calibrationStore.videoProcessingParams.lineThreshold"
|
| 711 |
+
@input="updateParameter('lineThreshold', parseFloat($event.target.value))"
|
| 712 |
+
>
|
| 713 |
+
<span class="param-value">{{ calibrationStore.videoProcessingParams.lineThreshold }}</span>
|
| 714 |
+
</div>
|
| 715 |
+
|
| 716 |
+
<div class="param-group">
|
| 717 |
+
<label>Pas entre les frames (traiter 1 frame sur X)</label>
|
| 718 |
+
<input
|
| 719 |
+
type="range"
|
| 720 |
+
min="1"
|
| 721 |
+
max="300"
|
| 722 |
+
step="1"
|
| 723 |
+
:value="calibrationStore.videoProcessingParams.frameStep"
|
| 724 |
+
@input="updateParameter('frameStep', parseInt($event.target.value))"
|
| 725 |
+
>
|
| 726 |
+
<span class="param-value">{{ calibrationStore.videoProcessingParams.frameStep }}</span>
|
| 727 |
+
</div>
|
| 728 |
+
|
| 729 |
+
<button @click="startProcessing" class="btn-primary launch-btn">
|
| 730 |
+
Lancer le traitement
|
| 731 |
+
</button>
|
| 732 |
+
</div>
|
| 733 |
+
</section>
|
| 734 |
+
|
| 735 |
+
<!-- Section 5: Vue manuelle intégrée -->
|
| 736 |
+
<section v-if="showManualCalibration" ref="manualSection" class="section manual-section">
|
| 737 |
+
<div class="manual-container">
|
| 738 |
+
<div class="manual-content">
|
| 739 |
+
<div class="calibration-container">
|
| 740 |
+
<CalibrationArea
|
| 741 |
+
ref="calibrationArea"
|
| 742 |
+
:thumbnail="thumbnail"
|
| 743 |
+
:calibrationPoints="calibrationPoints"
|
| 744 |
+
:calibrationLines="calibrationLines"
|
| 745 |
+
:selectedFieldPoint="selectedFieldPoint"
|
| 746 |
+
:selectedFieldLine="selectedFieldLine"
|
| 747 |
+
@update:thumbnail="updateThumbnail"
|
| 748 |
+
@update:calibrationPoints="updateCalibrationPoints"
|
| 749 |
+
@update:calibrationLines="updateCalibrationLines"
|
| 750 |
+
@update:selectedFieldPoint="updateSelectedFieldPoint"
|
| 751 |
+
@update:selectedFieldLine="updateSelectedFieldLine"
|
| 752 |
+
@clear-calibration="clearCalibration"
|
| 753 |
+
@process-calibration="processCalibration"
|
| 754 |
+
/>
|
| 755 |
+
</div>
|
| 756 |
+
<div class="field-container">
|
| 757 |
+
<FootballField
|
| 758 |
+
ref="footballField"
|
| 759 |
+
@point-selected="handleFieldPointSelected"
|
| 760 |
+
@line-selected="handleFieldLineSelected"
|
| 761 |
+
:positionedPoints="calibrationPoints"
|
| 762 |
+
:positionedLines="calibrationLines"
|
| 763 |
+
/>
|
| 764 |
+
</div>
|
| 765 |
+
</div>
|
| 766 |
+
</div>
|
| 767 |
+
</section>
|
| 768 |
+
|
| 769 |
+
<!-- Section 6: Traitement en cours -->
|
| 770 |
+
<section v-if="showProcessing" ref="processingSection" class="section processing-section">
|
| 771 |
+
<h2>Traitement en cours</h2>
|
| 772 |
+
|
| 773 |
+
<div class="processing-card">
|
| 774 |
+
<div class="processing-spinner"></div>
|
| 775 |
+
|
| 776 |
+
<h3>{{ calibrationStore.processingTask }}</h3>
|
| 777 |
+
|
| 778 |
+
<div class="progress-container">
|
| 779 |
+
<div class="progress-bar">
|
| 780 |
+
<div
|
| 781 |
+
class="progress-fill"
|
| 782 |
+
:style="{ width: calibrationStore.processingProgress + '%' }"
|
| 783 |
+
></div>
|
| 784 |
+
</div>
|
| 785 |
+
<span class="progress-text">{{ Math.round(calibrationStore.processingProgress) }}%</span>
|
| 786 |
+
</div>
|
| 787 |
+
|
| 788 |
+
<div class="processing-info">
|
| 789 |
+
<div class="info-item">
|
| 790 |
+
<span class="label">Fichier:</span>
|
| 791 |
+
<span class="value">{{ uploadStore.selectedFile?.name }}</span>
|
| 792 |
+
</div>
|
| 793 |
+
<div class="info-item">
|
| 794 |
+
<span class="label">Mode:</span>
|
| 795 |
+
<span class="value">{{ calibrationStore.isAutoMode ? 'Automatique' : 'Manuel' }}</span>
|
| 796 |
+
</div>
|
| 797 |
+
<div class="info-item" v-if="uploadStore.isVideo">
|
| 798 |
+
<span class="label">Type:</span>
|
| 799 |
+
<span class="value">{{ uploadStore.videoType === 'static' ? 'Vidéo Statique' : 'Vidéo Dynamique' }}</span>
|
| 800 |
+
</div>
|
| 801 |
+
</div>
|
| 802 |
+
</div>
|
| 803 |
+
</section>
|
| 804 |
+
|
| 805 |
+
<!-- Section 7: Erreur -->
|
| 806 |
+
<section v-if="showError" ref="errorSection" class="section error-section">
|
| 807 |
+
<h2 v-if="!calibrationStore.isManualMode">Mode manuel recommandé</h2>
|
| 808 |
+
<h2 v-else>Échec de la calibration</h2>
|
| 809 |
+
|
| 810 |
+
<div class="error-card">
|
| 811 |
+
<p class="error-message">{{ calibrationStore.error }}</p>
|
| 812 |
+
|
| 813 |
+
<div v-if="calibrationStore.isManualMode" class="manual-error-actions">
|
| 814 |
+
<button @click="backToCalibration" class="btn-manual-primary">
|
| 815 |
+
Modifier la calibration
|
| 816 |
+
</button>
|
| 817 |
+
<button @click="restart" class="btn-restart-small">
|
| 818 |
+
Recommencer
|
| 819 |
+
</button>
|
| 820 |
+
</div>
|
| 821 |
+
|
| 822 |
+
<div v-else class="auto-error-actions">
|
| 823 |
+
<button @click="goToManual" class="btn-manual-primary">
|
| 824 |
+
Passer en mode manuel
|
| 825 |
+
</button>
|
| 826 |
+
<button @click="restart" class="btn-restart-small">
|
| 827 |
+
Ou essayer une autre image
|
| 828 |
+
</button>
|
| 829 |
+
</div>
|
| 830 |
+
</div>
|
| 831 |
+
</section>
|
| 832 |
+
|
| 833 |
+
<!-- Section 8: Résultats -->
|
| 834 |
+
<section v-if="showResults" ref="resultsSection" class="section results-section">
|
| 835 |
+
<!-- Succès -->
|
| 836 |
+
<div v-if="calibrationStore.results?.status === 'success'" class="results-container">
|
| 837 |
+
<div class="result-status">
|
| 838 |
+
<div class="status-success">
|
| 839 |
+
<h2>Analyse réussie</h2>
|
| 840 |
+
</div>
|
| 841 |
+
</div>
|
| 842 |
+
|
| 843 |
+
<div class="result-message">
|
| 844 |
+
<p>{{ calibrationStore.results?.message || 'Paramètres de caméra extraits avec succès' }}</p>
|
| 845 |
+
</div>
|
| 846 |
+
|
| 847 |
+
<div class="result-actions">
|
| 848 |
+
<button @click="exportResults()" class="btn-primary">
|
| 849 |
+
Télécharger les résultats
|
| 850 |
+
</button>
|
| 851 |
+
|
| 852 |
+
<button v-if="calibrationStore.isManualMode" @click="backToCalibration" class="btn-secondary">
|
| 853 |
+
Modifier la calibration
|
| 854 |
+
</button>
|
| 855 |
+
|
| 856 |
+
<button @click="restart" class="btn-tertiary">
|
| 857 |
+
Nouvelle analyse
|
| 858 |
+
</button>
|
| 859 |
+
</div>
|
| 860 |
+
|
| 861 |
+
<details class="result-details">
|
| 862 |
+
<summary>Données complètes</summary>
|
| 863 |
+
<pre class="result-data">{{ JSON.stringify(calibrationStore.results, null, 2) }}</pre>
|
| 864 |
+
</details>
|
| 865 |
+
</div>
|
| 866 |
+
|
| 867 |
+
<!-- Échec en mode manuel -->
|
| 868 |
+
<div v-else-if="calibrationStore.isManualMode" class="error-card-simple">
|
| 869 |
+
<h2>Calibration échouée</h2>
|
| 870 |
+
|
| 871 |
+
<p class="error-message">Les lignes définies ne permettent pas de calculer les paramètres de caméra.</p>
|
| 872 |
+
|
| 873 |
+
<div class="error-actions">
|
| 874 |
+
<button
|
| 875 |
+
@click="backToCalibration"
|
| 876 |
+
class="btn-primary"
|
| 877 |
+
title="Modifiez vos lignes de calibration : ajoutez plus de points, utilisez des lignes variées (droites, cercles), répartissez-les sur l'image"
|
| 878 |
+
>
|
| 879 |
+
Ajuster la calibration
|
| 880 |
+
</button>
|
| 881 |
+
|
| 882 |
+
<button
|
| 883 |
+
@click="restart"
|
| 884 |
+
class="btn-secondary"
|
| 885 |
+
title="Essayez avec une image de meilleure qualité ou un angle de vue différent"
|
| 886 |
+
>
|
| 887 |
+
Changer d'image
|
| 888 |
+
</button>
|
| 889 |
+
</div>
|
| 890 |
+
</div>
|
| 891 |
+
|
| 892 |
+
<!-- Échec en mode auto -->
|
| 893 |
+
<div v-else class="results-container">
|
| 894 |
+
<div class="result-status">
|
| 895 |
+
<div class="status-error">
|
| 896 |
+
<h2>Analyse échouée</h2>
|
| 897 |
+
</div>
|
| 898 |
+
</div>
|
| 899 |
+
|
| 900 |
+
<div class="result-message">
|
| 901 |
+
<p>L'analyse automatique n'a pas pu extraire les paramètres de caméra.</p>
|
| 902 |
+
</div>
|
| 903 |
+
|
| 904 |
+
<div class="result-actions">
|
| 905 |
+
<button @click="goToManual" class="btn-secondary">
|
| 906 |
+
Essayer en mode manuel
|
| 907 |
+
</button>
|
| 908 |
+
|
| 909 |
+
<button @click="restart" class="btn-tertiary">
|
| 910 |
+
Nouvelle analyse
|
| 911 |
+
</button>
|
| 912 |
+
</div>
|
| 913 |
+
|
| 914 |
+
<details class="result-details">
|
| 915 |
+
<summary>Données complètes</summary>
|
| 916 |
+
<pre class="result-data">{{ JSON.stringify(calibrationStore.results, null, 2) }}</pre>
|
| 917 |
+
</details>
|
| 918 |
+
</div>
|
| 919 |
+
</section>
|
| 920 |
+
</div>
|
| 921 |
+
</template>
|
| 922 |
+
|
| 923 |
+
<style scoped>
|
| 924 |
+
.btn-back-home {
|
| 925 |
+
position: fixed;
|
| 926 |
+
top: 20px;
|
| 927 |
+
left: 20px;
|
| 928 |
+
background: rgba(255, 255, 255, 0.1);
|
| 929 |
+
color: #888;
|
| 930 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 931 |
+
border-radius: 8px;
|
| 932 |
+
padding: 10px;
|
| 933 |
+
cursor: pointer;
|
| 934 |
+
transition: all 0.3s ease;
|
| 935 |
+
z-index: 1000;
|
| 936 |
+
display: flex;
|
| 937 |
+
align-items: center;
|
| 938 |
+
justify-content: center;
|
| 939 |
+
backdrop-filter: blur(10px);
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
.btn-back-home:hover {
|
| 943 |
+
background: rgba(255, 255, 255, 0.15);
|
| 944 |
+
color: var(--color-primary);
|
| 945 |
+
border-color: var(--color-primary);
|
| 946 |
+
transform: scale(1.05);
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
.btn-back-home svg {
|
| 950 |
+
transition: all 0.3s ease;
|
| 951 |
+
}
|
| 952 |
+
|
| 953 |
+
.home-container {
|
| 954 |
+
margin: 0 auto;
|
| 955 |
+
background: var(--color-secondary);
|
| 956 |
+
min-height: 100vh;
|
| 957 |
+
}
|
| 958 |
+
|
| 959 |
+
.section {
|
| 960 |
+
min-height: 100vh;
|
| 961 |
+
display: flex;
|
| 962 |
+
flex-direction: column;
|
| 963 |
+
justify-content: center;
|
| 964 |
+
align-items: center;
|
| 965 |
+
text-align: center;
|
| 966 |
+
}
|
| 967 |
+
|
| 968 |
+
/* Section Mode */
|
| 969 |
+
.hero h1 {
|
| 970 |
+
font-size: 3rem;
|
| 971 |
+
font-weight: 700;
|
| 972 |
+
margin-bottom: 1rem;
|
| 973 |
+
color: white;
|
| 974 |
+
letter-spacing: -0.025em;
|
| 975 |
+
position: relative;
|
| 976 |
+
}
|
| 977 |
+
|
| 978 |
+
.hero h1::after {
|
| 979 |
+
content: '';
|
| 980 |
+
position: absolute;
|
| 981 |
+
bottom: -10px;
|
| 982 |
+
left: 50%;
|
| 983 |
+
transform: translateX(-50%);
|
| 984 |
+
width: 80px;
|
| 985 |
+
height: 4px;
|
| 986 |
+
background: var(--color-primary);
|
| 987 |
+
border-radius: 2px;
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
.hero-subtitle {
|
| 991 |
+
font-size: 1.1rem;
|
| 992 |
+
color: #b0b0b0;
|
| 993 |
+
margin-bottom: 4rem;
|
| 994 |
+
max-width: 600px;
|
| 995 |
+
line-height: 1.6;
|
| 996 |
+
font-weight: 500;
|
| 997 |
+
}
|
| 998 |
+
|
| 999 |
+
.mode-selection h2 {
|
| 1000 |
+
font-size: 1.5rem;
|
| 1001 |
+
margin-bottom: 3rem;
|
| 1002 |
+
color: white;
|
| 1003 |
+
font-weight: 600;
|
| 1004 |
+
}
|
| 1005 |
+
|
| 1006 |
+
.mode-cards, .video-type-cards {
|
| 1007 |
+
display: grid;
|
| 1008 |
+
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
| 1009 |
+
gap: 2rem;
|
| 1010 |
+
width: 100%;
|
| 1011 |
+
max-width: 800px;
|
| 1012 |
+
}
|
| 1013 |
+
|
| 1014 |
+
.mode-card, .type-card {
|
| 1015 |
+
background: var(--color-secondary-soft);
|
| 1016 |
+
border-radius: 12px;
|
| 1017 |
+
padding: 2rem;
|
| 1018 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
| 1019 |
+
cursor: pointer;
|
| 1020 |
+
transition: all 0.3s ease;
|
| 1021 |
+
border: 2px solid #333;
|
| 1022 |
+
position: relative;
|
| 1023 |
+
overflow: hidden;
|
| 1024 |
+
}
|
| 1025 |
+
|
| 1026 |
+
.mode-card::before, .type-card::before {
|
| 1027 |
+
content: '';
|
| 1028 |
+
position: absolute;
|
| 1029 |
+
top: 0;
|
| 1030 |
+
left: 0;
|
| 1031 |
+
right: 0;
|
| 1032 |
+
height: 4px;
|
| 1033 |
+
background: var(--color-primary);
|
| 1034 |
+
transform: translateY(-4px);
|
| 1035 |
+
transition: transform 0.3s ease;
|
| 1036 |
+
}
|
| 1037 |
+
|
| 1038 |
+
.mode-card:hover::before, .type-card:hover::before {
|
| 1039 |
+
transform: translateY(0);
|
| 1040 |
+
}
|
| 1041 |
+
|
| 1042 |
+
.mode-card:hover, .type-card:hover {
|
| 1043 |
+
transform: translateY(-8px);
|
| 1044 |
+
box-shadow: 0 8px 30px rgba(0,0,0,0.4);
|
| 1045 |
+
border-color: var(--color-primary);
|
| 1046 |
+
background: #2a2a2a;
|
| 1047 |
+
}
|
| 1048 |
+
|
| 1049 |
+
.mode-card.selected, .type-card.selected {
|
| 1050 |
+
border-color: var(--color-primary);
|
| 1051 |
+
background: #2a2a2a;
|
| 1052 |
+
transform: translateY(-4px);
|
| 1053 |
+
box-shadow: 0 6px 25px rgba(255, 255, 255, 0.3);
|
| 1054 |
+
}
|
| 1055 |
+
|
| 1056 |
+
.mode-card.selected::before, .type-card.selected::before {
|
| 1057 |
+
transform: translateY(0);
|
| 1058 |
+
}
|
| 1059 |
+
|
| 1060 |
+
.mode-card h3, .type-card h3 {
|
| 1061 |
+
font-size: 1.25rem;
|
| 1062 |
+
font-weight: 700;
|
| 1063 |
+
color: white;
|
| 1064 |
+
margin-bottom: 1rem;
|
| 1065 |
+
}
|
| 1066 |
+
|
| 1067 |
+
.mode-card p, .type-card p {
|
| 1068 |
+
color: #b0b0b0;
|
| 1069 |
+
margin-bottom: 1.5rem;
|
| 1070 |
+
line-height: 1.5;
|
| 1071 |
+
font-weight: 500;
|
| 1072 |
+
}
|
| 1073 |
+
|
| 1074 |
+
.mode-card ul, .type-card ul {
|
| 1075 |
+
list-style: none;
|
| 1076 |
+
padding: 0;
|
| 1077 |
+
margin: 0;
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
.mode-card li, .type-card li {
|
| 1081 |
+
padding: 0.5rem 0;
|
| 1082 |
+
color: #d0d0d0;
|
| 1083 |
+
font-size: 0.9rem;
|
| 1084 |
+
position: relative;
|
| 1085 |
+
padding-left: 1.5rem;
|
| 1086 |
+
font-weight: 500;
|
| 1087 |
+
}
|
| 1088 |
+
|
| 1089 |
+
.mode-card li::before, .type-card li::before {
|
| 1090 |
+
content: '●';
|
| 1091 |
+
color: var(--color-primary);
|
| 1092 |
+
font-weight: bold;
|
| 1093 |
+
position: absolute;
|
| 1094 |
+
left: 0;
|
| 1095 |
+
}
|
| 1096 |
+
|
| 1097 |
+
/* Section Upload */
|
| 1098 |
+
.upload-section h2, .video-type-section h2, .parameters-section h2, .processing-section h2, .results-section h2 {
|
| 1099 |
+
font-size: 1.5rem;
|
| 1100 |
+
margin-bottom: 3rem;
|
| 1101 |
+
color: white;
|
| 1102 |
+
font-weight: 600;
|
| 1103 |
+
}
|
| 1104 |
+
|
| 1105 |
+
.drop-zone {
|
| 1106 |
+
border: 3px dashed #555;
|
| 1107 |
+
border-radius: 12px;
|
| 1108 |
+
padding: 3rem;
|
| 1109 |
+
transition: all 0.3s ease;
|
| 1110 |
+
background: var(--color-secondary-soft);
|
| 1111 |
+
width: 100%;
|
| 1112 |
+
max-width: 600px;
|
| 1113 |
+
position: relative;
|
| 1114 |
+
}
|
| 1115 |
+
|
| 1116 |
+
.drop-zone.active {
|
| 1117 |
+
border-color: var(--color-primary);
|
| 1118 |
+
background: #2a2a2a;
|
| 1119 |
+
box-shadow: 0 4px 20px rgba(217, 255, 4, 0.2);
|
| 1120 |
+
}
|
| 1121 |
+
|
| 1122 |
+
.drop-zone.has-file {
|
| 1123 |
+
border-color: var(--color-primary);
|
| 1124 |
+
border-style: solid;
|
| 1125 |
+
background: #2a2a2a;
|
| 1126 |
+
}
|
| 1127 |
+
|
| 1128 |
+
.upload-icon {
|
| 1129 |
+
font-size: 3rem;
|
| 1130 |
+
color: #888;
|
| 1131 |
+
margin-bottom: 1rem;
|
| 1132 |
+
font-weight: 300;
|
| 1133 |
+
}
|
| 1134 |
+
|
| 1135 |
+
.drop-content h3 {
|
| 1136 |
+
font-size: 1.25rem;
|
| 1137 |
+
color: white;
|
| 1138 |
+
margin-bottom: 1rem;
|
| 1139 |
+
font-weight: 600;
|
| 1140 |
+
}
|
| 1141 |
+
|
| 1142 |
+
.or-text {
|
| 1143 |
+
color: #888;
|
| 1144 |
+
margin: 1.5rem 0;
|
| 1145 |
+
font-size: 0.9rem;
|
| 1146 |
+
font-weight: 500;
|
| 1147 |
+
}
|
| 1148 |
+
|
| 1149 |
+
.file-input-label {
|
| 1150 |
+
display: inline-block;
|
| 1151 |
+
background: var(--color-primary);
|
| 1152 |
+
color: var(--color-secondary);
|
| 1153 |
+
padding: 0.875rem 2rem;
|
| 1154 |
+
border-radius: 8px;
|
| 1155 |
+
cursor: pointer;
|
| 1156 |
+
transition: all 0.3s ease;
|
| 1157 |
+
font-weight: 700;
|
| 1158 |
+
font-size: 0.9rem;
|
| 1159 |
+
position: relative;
|
| 1160 |
+
overflow: hidden;
|
| 1161 |
+
}
|
| 1162 |
+
|
| 1163 |
+
.file-input-label::before {
|
| 1164 |
+
content: '';
|
| 1165 |
+
position: absolute;
|
| 1166 |
+
top: 0;
|
| 1167 |
+
left: -100%;
|
| 1168 |
+
width: 100%;
|
| 1169 |
+
height: 100%;
|
| 1170 |
+
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
| 1171 |
+
transition: left 0.5s ease;
|
| 1172 |
+
}
|
| 1173 |
+
|
| 1174 |
+
.file-input-label:hover::before {
|
| 1175 |
+
left: 100%;
|
| 1176 |
+
}
|
| 1177 |
+
|
| 1178 |
+
.file-input-label:hover {
|
| 1179 |
+
background: white;
|
| 1180 |
+
transform: translateY(-2px);
|
| 1181 |
+
box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
|
| 1182 |
+
}
|
| 1183 |
+
|
| 1184 |
+
.format-info {
|
| 1185 |
+
color: #888;
|
| 1186 |
+
font-size: 0.85rem;
|
| 1187 |
+
margin-top: 1.5rem;
|
| 1188 |
+
font-weight: 500;
|
| 1189 |
+
}
|
| 1190 |
+
|
| 1191 |
+
.file-preview {
|
| 1192 |
+
text-align: center;
|
| 1193 |
+
}
|
| 1194 |
+
|
| 1195 |
+
.file-info h3 {
|
| 1196 |
+
color: var(--color-primary);
|
| 1197 |
+
margin-bottom: 1.5rem;
|
| 1198 |
+
font-weight: 600;
|
| 1199 |
+
}
|
| 1200 |
+
|
| 1201 |
+
.file-name {
|
| 1202 |
+
font-weight: 700;
|
| 1203 |
+
color: white;
|
| 1204 |
+
margin-bottom: 1rem;
|
| 1205 |
+
}
|
| 1206 |
+
|
| 1207 |
+
.file-details {
|
| 1208 |
+
color: #b0b0b0;
|
| 1209 |
+
font-size: 0.9rem;
|
| 1210 |
+
margin-bottom: 2rem;
|
| 1211 |
+
font-weight: 500;
|
| 1212 |
+
}
|
| 1213 |
+
|
| 1214 |
+
.file-details span {
|
| 1215 |
+
margin-right: 1rem;
|
| 1216 |
+
}
|
| 1217 |
+
|
| 1218 |
+
.preview-media {
|
| 1219 |
+
max-width: 100%;
|
| 1220 |
+
max-height: 300px;
|
| 1221 |
+
border-radius: 8px;
|
| 1222 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
| 1223 |
+
margin: 2rem 0;
|
| 1224 |
+
/* border: 2px solid var(--color-primary); */
|
| 1225 |
+
}
|
| 1226 |
+
|
| 1227 |
+
/* Section Paramètres */
|
| 1228 |
+
.parameters-form {
|
| 1229 |
+
background: var(--color-secondary-soft);
|
| 1230 |
+
padding: 2.5rem;
|
| 1231 |
+
border-radius: 12px;
|
| 1232 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
| 1233 |
+
width: 100%;
|
| 1234 |
+
max-width: 500px;
|
| 1235 |
+
text-align: left;
|
| 1236 |
+
border: 1px solid #333;
|
| 1237 |
+
}
|
| 1238 |
+
|
| 1239 |
+
.param-group {
|
| 1240 |
+
margin-bottom: 2rem;
|
| 1241 |
+
}
|
| 1242 |
+
|
| 1243 |
+
.param-group label {
|
| 1244 |
+
display: block;
|
| 1245 |
+
margin-bottom: 0.75rem;
|
| 1246 |
+
font-weight: 600;
|
| 1247 |
+
color: white;
|
| 1248 |
+
font-size: 0.9rem;
|
| 1249 |
+
}
|
| 1250 |
+
|
| 1251 |
+
.param-group input[type="range"] {
|
| 1252 |
+
width: 100%;
|
| 1253 |
+
height: 6px;
|
| 1254 |
+
background: #333;
|
| 1255 |
+
border-radius: 3px;
|
| 1256 |
+
outline: none;
|
| 1257 |
+
margin: 0.5rem 0;
|
| 1258 |
+
-webkit-appearance: none;
|
| 1259 |
+
}
|
| 1260 |
+
|
| 1261 |
+
.param-group input[type="range"]::-webkit-slider-thumb {
|
| 1262 |
+
-webkit-appearance: none;
|
| 1263 |
+
appearance: none;
|
| 1264 |
+
width: 20px;
|
| 1265 |
+
height: 20px;
|
| 1266 |
+
border-radius: 50%;
|
| 1267 |
+
background: var(--color-primary);
|
| 1268 |
+
cursor: pointer;
|
| 1269 |
+
border: 3px solid var(--color-secondary);
|
| 1270 |
+
box-shadow: 0 2px 6px rgba(0,0,0,0.3);
|
| 1271 |
+
}
|
| 1272 |
+
|
| 1273 |
+
.param-group input[type="range"]::-moz-range-thumb {
|
| 1274 |
+
width: 20px;
|
| 1275 |
+
height: 20px;
|
| 1276 |
+
border-radius: 50%;
|
| 1277 |
+
background: var(--color-primary);
|
| 1278 |
+
cursor: pointer;
|
| 1279 |
+
border: 3px solid var(--color-secondary);
|
| 1280 |
+
box-shadow: 0 2px 6px rgba(0,0,0,0.3);
|
| 1281 |
+
}
|
| 1282 |
+
|
| 1283 |
+
.param-value {
|
| 1284 |
+
font-weight: 700;
|
| 1285 |
+
float: right;
|
| 1286 |
+
background: var(--color-primary);
|
| 1287 |
+
color: var(--color-secondary);
|
| 1288 |
+
padding: 0.25rem 0.5rem;
|
| 1289 |
+
border-radius: 4px;
|
| 1290 |
+
font-size: 0.8rem;
|
| 1291 |
+
}
|
| 1292 |
+
|
| 1293 |
+
.launch-btn {
|
| 1294 |
+
width: 100%;
|
| 1295 |
+
margin-top: 1rem;
|
| 1296 |
+
font-size: 1rem;
|
| 1297 |
+
padding: 1rem;
|
| 1298 |
+
font-weight: 700;
|
| 1299 |
+
}
|
| 1300 |
+
|
| 1301 |
+
/* Section Erreur */
|
| 1302 |
+
.error-section h2 {
|
| 1303 |
+
font-size: 1.5rem;
|
| 1304 |
+
margin-bottom: 3rem;
|
| 1305 |
+
color: white;
|
| 1306 |
+
font-weight: 600;
|
| 1307 |
+
}
|
| 1308 |
+
|
| 1309 |
+
.error-card {
|
| 1310 |
+
background: var(--color-secondary-soft);
|
| 1311 |
+
border-radius: 12px;
|
| 1312 |
+
padding: 3rem;
|
| 1313 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
| 1314 |
+
width: 100%;
|
| 1315 |
+
max-width: 400px;
|
| 1316 |
+
border: 1px solid #333;
|
| 1317 |
+
text-align: center;
|
| 1318 |
+
display: flex;
|
| 1319 |
+
flex-direction: column;
|
| 1320 |
+
gap: 2rem;
|
| 1321 |
+
}
|
| 1322 |
+
|
| 1323 |
+
.error-message {
|
| 1324 |
+
color: #b0b0b0;
|
| 1325 |
+
font-size: 0.95rem;
|
| 1326 |
+
font-weight: 500;
|
| 1327 |
+
margin: 0;
|
| 1328 |
+
}
|
| 1329 |
+
|
| 1330 |
+
.btn-manual-primary {
|
| 1331 |
+
background: var(--color-primary);
|
| 1332 |
+
color: var(--color-secondary);
|
| 1333 |
+
border: none;
|
| 1334 |
+
padding: 1rem 2rem;
|
| 1335 |
+
border-radius: 8px;
|
| 1336 |
+
font-weight: 700;
|
| 1337 |
+
font-size: 1rem;
|
| 1338 |
+
cursor: pointer;
|
| 1339 |
+
transition: all 0.3s ease;
|
| 1340 |
+
}
|
| 1341 |
+
|
| 1342 |
+
.btn-manual-primary:hover {
|
| 1343 |
+
background: var(--color-primary-soft);
|
| 1344 |
+
transform: translateY(-2px);
|
| 1345 |
+
box-shadow: 0 4px 15px rgba(217, 255, 4, 0.4);
|
| 1346 |
+
}
|
| 1347 |
+
|
| 1348 |
+
.btn-restart-small {
|
| 1349 |
+
background: transparent;
|
| 1350 |
+
color: #888;
|
| 1351 |
+
border: none;
|
| 1352 |
+
padding: 0.5rem;
|
| 1353 |
+
font-size: 0.85rem;
|
| 1354 |
+
cursor: pointer;
|
| 1355 |
+
transition: color 0.3s ease;
|
| 1356 |
+
text-decoration: underline;
|
| 1357 |
+
}
|
| 1358 |
+
|
| 1359 |
+
.btn-restart-small:hover {
|
| 1360 |
+
color: white;
|
| 1361 |
+
}
|
| 1362 |
+
|
| 1363 |
+
/* Section Traitement */
|
| 1364 |
+
.processing-card {
|
| 1365 |
+
background: var(--color-secondary-soft);
|
| 1366 |
+
border-radius: 12px;
|
| 1367 |
+
padding: 3rem;
|
| 1368 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
| 1369 |
+
width: 100%;
|
| 1370 |
+
max-width: 500px;
|
| 1371 |
+
border: 1px solid #333;
|
| 1372 |
+
}
|
| 1373 |
+
|
| 1374 |
+
.processing-spinner {
|
| 1375 |
+
width: 48px;
|
| 1376 |
+
height: 48px;
|
| 1377 |
+
border: 4px solid #333;
|
| 1378 |
+
border-top: 4px solid var(--color-primary);
|
| 1379 |
+
border-radius: 50%;
|
| 1380 |
+
animation: spin 1s linear infinite;
|
| 1381 |
+
margin: 0 auto 2rem;
|
| 1382 |
+
}
|
| 1383 |
+
|
| 1384 |
+
@keyframes spin {
|
| 1385 |
+
0% { transform: rotate(0deg); }
|
| 1386 |
+
100% { transform: rotate(360deg); }
|
| 1387 |
+
}
|
| 1388 |
+
|
| 1389 |
+
.processing-card h3 {
|
| 1390 |
+
font-size: 1.1rem;
|
| 1391 |
+
color: white;
|
| 1392 |
+
margin-bottom: 2rem;
|
| 1393 |
+
font-weight: 600;
|
| 1394 |
+
}
|
| 1395 |
+
|
| 1396 |
+
.progress-container {
|
| 1397 |
+
margin: 2rem 0;
|
| 1398 |
+
}
|
| 1399 |
+
|
| 1400 |
+
.progress-bar {
|
| 1401 |
+
width: 100%;
|
| 1402 |
+
height: 10px;
|
| 1403 |
+
background: #333;
|
| 1404 |
+
border-radius: 5px;
|
| 1405 |
+
overflow: hidden;
|
| 1406 |
+
margin-bottom: 0.75rem;
|
| 1407 |
+
}
|
| 1408 |
+
|
| 1409 |
+
.progress-fill {
|
| 1410 |
+
height: 100%;
|
| 1411 |
+
background: linear-gradient(90deg, var(--color-primary), var(--color-primary-soft));
|
| 1412 |
+
transition: width 0.3s ease;
|
| 1413 |
+
border-radius: 5px;
|
| 1414 |
+
}
|
| 1415 |
+
|
| 1416 |
+
.progress-text {
|
| 1417 |
+
font-weight: 700;
|
| 1418 |
+
color: white;
|
| 1419 |
+
font-size: 0.9rem;
|
| 1420 |
+
}
|
| 1421 |
+
|
| 1422 |
+
.processing-info {
|
| 1423 |
+
margin-top: 2rem;
|
| 1424 |
+
text-align: left;
|
| 1425 |
+
}
|
| 1426 |
+
|
| 1427 |
+
.info-item {
|
| 1428 |
+
display: flex;
|
| 1429 |
+
justify-content: space-between;
|
| 1430 |
+
margin-bottom: 0.5rem;
|
| 1431 |
+
font-size: 0.9rem;
|
| 1432 |
+
}
|
| 1433 |
+
|
| 1434 |
+
.info-item .label {
|
| 1435 |
+
color: #b0b0b0;
|
| 1436 |
+
font-weight: 500;
|
| 1437 |
+
}
|
| 1438 |
+
|
| 1439 |
+
.info-item .value {
|
| 1440 |
+
color: white;
|
| 1441 |
+
font-weight: 600;
|
| 1442 |
+
}
|
| 1443 |
+
|
| 1444 |
+
/* Section Résultats */
|
| 1445 |
+
.results-summary {
|
| 1446 |
+
background: var(--color-secondary-soft);
|
| 1447 |
+
border-radius: 12px;
|
| 1448 |
+
margin-bottom: 3rem;
|
| 1449 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
| 1450 |
+
width: 100%;
|
| 1451 |
+
max-width: 600px;
|
| 1452 |
+
border: 1px solid #333;
|
| 1453 |
+
}
|
| 1454 |
+
|
| 1455 |
+
/* Section Résultats */
|
| 1456 |
+
.results-container {
|
| 1457 |
+
max-width: 600px;
|
| 1458 |
+
width: 100%;
|
| 1459 |
+
display: flex;
|
| 1460 |
+
flex-direction: column;
|
| 1461 |
+
gap: 2rem;
|
| 1462 |
+
}
|
| 1463 |
+
|
| 1464 |
+
.result-status h2 {
|
| 1465 |
+
margin: 0;
|
| 1466 |
+
font-size: 1.5rem;
|
| 1467 |
+
font-weight: 600;
|
| 1468 |
+
}
|
| 1469 |
+
|
| 1470 |
+
.status-success h2 {
|
| 1471 |
+
color: var(--color-primary);
|
| 1472 |
+
}
|
| 1473 |
+
|
| 1474 |
+
.status-error h2 {
|
| 1475 |
+
color: #dc3545;
|
| 1476 |
+
}
|
| 1477 |
+
|
| 1478 |
+
.result-message {
|
| 1479 |
+
background: var(--color-secondary-soft);
|
| 1480 |
+
border-radius: 8px;
|
| 1481 |
+
padding: 1.5rem;
|
| 1482 |
+
border-left: 4px solid var(--color-primary);
|
| 1483 |
+
}
|
| 1484 |
+
|
| 1485 |
+
.result-message p {
|
| 1486 |
+
margin: 0;
|
| 1487 |
+
color: #e0e0e0;
|
| 1488 |
+
line-height: 1.5;
|
| 1489 |
+
font-size: 0.95rem;
|
| 1490 |
+
}
|
| 1491 |
+
|
| 1492 |
+
.result-actions {
|
| 1493 |
+
display: flex;
|
| 1494 |
+
flex-direction: column;
|
| 1495 |
+
gap: 0.75rem;
|
| 1496 |
+
}
|
| 1497 |
+
|
| 1498 |
+
.btn-primary, .btn-secondary, .btn-tertiary {
|
| 1499 |
+
padding: 0.875rem 1.5rem;
|
| 1500 |
+
border-radius: 8px;
|
| 1501 |
+
border: none;
|
| 1502 |
+
cursor: pointer;
|
| 1503 |
+
font-weight: 600;
|
| 1504 |
+
font-size: 0.9rem;
|
| 1505 |
+
transition: all 0.3s ease;
|
| 1506 |
+
}
|
| 1507 |
+
|
| 1508 |
+
.btn-primary {
|
| 1509 |
+
background: var(--color-primary);
|
| 1510 |
+
color: var(--color-secondary);
|
| 1511 |
+
}
|
| 1512 |
+
|
| 1513 |
+
.btn-primary:hover {
|
| 1514 |
+
background: var(--color-primary-soft);
|
| 1515 |
+
transform: translateY(-1px);
|
| 1516 |
+
}
|
| 1517 |
+
|
| 1518 |
+
.btn-secondary {
|
| 1519 |
+
background: #555;
|
| 1520 |
+
color: white;
|
| 1521 |
+
border: 1px solid #666;
|
| 1522 |
+
}
|
| 1523 |
+
|
| 1524 |
+
.btn-secondary:hover {
|
| 1525 |
+
background: #666;
|
| 1526 |
+
transform: translateY(-1px);
|
| 1527 |
+
}
|
| 1528 |
+
|
| 1529 |
+
.btn-tertiary {
|
| 1530 |
+
background: transparent;
|
| 1531 |
+
color: #888;
|
| 1532 |
+
border: 1px solid #555;
|
| 1533 |
+
}
|
| 1534 |
+
|
| 1535 |
+
.btn-tertiary:hover {
|
| 1536 |
+
color: white;
|
| 1537 |
+
border-color: #777;
|
| 1538 |
+
background: #333;
|
| 1539 |
+
}
|
| 1540 |
+
|
| 1541 |
+
.result-details {
|
| 1542 |
+
margin-top: 1rem;
|
| 1543 |
+
}
|
| 1544 |
+
|
| 1545 |
+
.result-details summary {
|
| 1546 |
+
color: #888;
|
| 1547 |
+
font-size: 0.9rem;
|
| 1548 |
+
cursor: pointer;
|
| 1549 |
+
padding: 0.5rem 0;
|
| 1550 |
+
transition: color 0.3s ease;
|
| 1551 |
+
}
|
| 1552 |
+
|
| 1553 |
+
.result-details summary:hover {
|
| 1554 |
+
color: white;
|
| 1555 |
+
}
|
| 1556 |
+
|
| 1557 |
+
.result-details[open] summary {
|
| 1558 |
+
color: var(--color-primary);
|
| 1559 |
+
margin-bottom: 1rem;
|
| 1560 |
+
}
|
| 1561 |
+
|
| 1562 |
+
.result-data {
|
| 1563 |
+
background: #1a1a1a;
|
| 1564 |
+
color: #e0e0e0;
|
| 1565 |
+
padding: 1rem;
|
| 1566 |
+
border-radius: 6px;
|
| 1567 |
+
font-family: 'Courier New', monospace;
|
| 1568 |
+
font-size: 0.8rem;
|
| 1569 |
+
line-height: 1.4;
|
| 1570 |
+
overflow-x: auto;
|
| 1571 |
+
white-space: pre-wrap;
|
| 1572 |
+
word-wrap: break-word;
|
| 1573 |
+
border: 1px solid #333;
|
| 1574 |
+
max-height: 300px;
|
| 1575 |
+
overflow-y: auto;
|
| 1576 |
+
}
|
| 1577 |
+
|
| 1578 |
+
.confidence-score {
|
| 1579 |
+
font-size: 1rem;
|
| 1580 |
+
color: white;
|
| 1581 |
+
font-weight: 600;
|
| 1582 |
+
}
|
| 1583 |
+
|
| 1584 |
+
.quick-info {
|
| 1585 |
+
margin-top: 2rem;
|
| 1586 |
+
padding-top: 1.5rem;
|
| 1587 |
+
border-top: 1px solid #333;
|
| 1588 |
+
}
|
| 1589 |
+
|
| 1590 |
+
.quick-info .info-item {
|
| 1591 |
+
display: flex;
|
| 1592 |
+
justify-content: space-between;
|
| 1593 |
+
align-items: center;
|
| 1594 |
+
margin-bottom: 0.75rem;
|
| 1595 |
+
font-size: 0.9rem;
|
| 1596 |
+
}
|
| 1597 |
+
|
| 1598 |
+
.quick-info .info-item span:first-child {
|
| 1599 |
+
color: #b0b0b0;
|
| 1600 |
+
font-weight: 500;
|
| 1601 |
+
}
|
| 1602 |
+
|
| 1603 |
+
.quick-info .info-item span:last-child {
|
| 1604 |
+
color: white;
|
| 1605 |
+
font-weight: 600;
|
| 1606 |
+
font-family: monospace;
|
| 1607 |
+
}
|
| 1608 |
+
|
| 1609 |
+
|
| 1610 |
+
|
| 1611 |
+
/* Error Card simple pour mode manuel */
|
| 1612 |
+
.error-card-simple {
|
| 1613 |
+
max-width: 500px;
|
| 1614 |
+
width: 100%;
|
| 1615 |
+
text-align: center;
|
| 1616 |
+
}
|
| 1617 |
+
|
| 1618 |
+
.error-card-simple h2 {
|
| 1619 |
+
color: #dc3545;
|
| 1620 |
+
font-size: 1.5rem;
|
| 1621 |
+
font-weight: 600;
|
| 1622 |
+
margin-bottom: 1rem;
|
| 1623 |
+
}
|
| 1624 |
+
|
| 1625 |
+
.error-card-simple .error-message {
|
| 1626 |
+
color: #b0b0b0;
|
| 1627 |
+
font-size: 1rem;
|
| 1628 |
+
margin-bottom: 2rem;
|
| 1629 |
+
line-height: 1.5;
|
| 1630 |
+
}
|
| 1631 |
+
|
| 1632 |
+
.error-actions {
|
| 1633 |
+
display: flex;
|
| 1634 |
+
flex-direction: column;
|
| 1635 |
+
gap: 1rem;
|
| 1636 |
+
max-width: 300px;
|
| 1637 |
+
margin: 0 auto;
|
| 1638 |
+
}
|
| 1639 |
+
|
| 1640 |
+
.manual-error-actions, .auto-error-actions {
|
| 1641 |
+
display: flex;
|
| 1642 |
+
flex-direction: column;
|
| 1643 |
+
gap: 1rem;
|
| 1644 |
+
width: 100%;
|
| 1645 |
+
max-width: 300px;
|
| 1646 |
+
margin: 0 auto;
|
| 1647 |
+
}
|
| 1648 |
+
|
| 1649 |
+
.btn-manual-primary {
|
| 1650 |
+
background: var(--color-primary);
|
| 1651 |
+
color: var(--color-secondary);
|
| 1652 |
+
border: none;
|
| 1653 |
+
padding: 1rem 2rem;
|
| 1654 |
+
border-radius: 8px;
|
| 1655 |
+
font-weight: 600;
|
| 1656 |
+
font-size: 0.95rem;
|
| 1657 |
+
cursor: pointer;
|
| 1658 |
+
transition: all 0.3s ease;
|
| 1659 |
+
}
|
| 1660 |
+
|
| 1661 |
+
.btn-manual-primary:hover {
|
| 1662 |
+
background: var(--color-primary-soft);
|
| 1663 |
+
transform: translateY(-2px);
|
| 1664 |
+
box-shadow: 0 4px 15px rgba(217, 255, 4, 0.4);
|
| 1665 |
+
}
|
| 1666 |
+
|
| 1667 |
+
.btn-restart-small {
|
| 1668 |
+
background: transparent;
|
| 1669 |
+
color: #888;
|
| 1670 |
+
border: 1px solid #555;
|
| 1671 |
+
padding: 0.75rem 1.5rem;
|
| 1672 |
+
border-radius: 8px;
|
| 1673 |
+
font-weight: 500;
|
| 1674 |
+
font-size: 0.9rem;
|
| 1675 |
+
cursor: pointer;
|
| 1676 |
+
transition: all 0.3s ease;
|
| 1677 |
+
}
|
| 1678 |
+
|
| 1679 |
+
.btn-restart-small:hover {
|
| 1680 |
+
color: white;
|
| 1681 |
+
border-color: #777;
|
| 1682 |
+
background: #333;
|
| 1683 |
+
}
|
| 1684 |
+
|
| 1685 |
+
|
| 1686 |
+
|
| 1687 |
+
/* Boutons */
|
| 1688 |
+
.btn-primary, .btn-secondary, .btn-export {
|
| 1689 |
+
border: none;
|
| 1690 |
+
padding: 0.875rem 1.5rem;
|
| 1691 |
+
border-radius: 8px;
|
| 1692 |
+
cursor: pointer;
|
| 1693 |
+
font-weight: 600;
|
| 1694 |
+
transition: all 0.3s ease;
|
| 1695 |
+
text-decoration: none;
|
| 1696 |
+
display: inline-block;
|
| 1697 |
+
font-size: 0.9rem;
|
| 1698 |
+
position: relative;
|
| 1699 |
+
overflow: hidden;
|
| 1700 |
+
}
|
| 1701 |
+
|
| 1702 |
+
.btn-primary {
|
| 1703 |
+
background: var(--color-primary);
|
| 1704 |
+
color: var(--color-secondary);
|
| 1705 |
+
}
|
| 1706 |
+
|
| 1707 |
+
.btn-primary::before {
|
| 1708 |
+
content: '';
|
| 1709 |
+
position: absolute;
|
| 1710 |
+
top: 0;
|
| 1711 |
+
left: -100%;
|
| 1712 |
+
width: 100%;
|
| 1713 |
+
height: 100%;
|
| 1714 |
+
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
|
| 1715 |
+
transition: left 0.5s ease;
|
| 1716 |
+
}
|
| 1717 |
+
|
| 1718 |
+
.btn-primary:hover::before {
|
| 1719 |
+
left: 100%;
|
| 1720 |
+
}
|
| 1721 |
+
|
| 1722 |
+
.btn-primary:hover {
|
| 1723 |
+
background: var(--color-primary-soft);
|
| 1724 |
+
transform: translateY(-2px);
|
| 1725 |
+
box-shadow: 0 4px 15px rgba(217, 255, 4, 0.4);
|
| 1726 |
+
}
|
| 1727 |
+
|
| 1728 |
+
.btn-secondary {
|
| 1729 |
+
background: #555;
|
| 1730 |
+
color: white;
|
| 1731 |
+
border: 1px solid #666;
|
| 1732 |
+
}
|
| 1733 |
+
|
| 1734 |
+
.btn-secondary:hover {
|
| 1735 |
+
background: #666;
|
| 1736 |
+
transform: translateY(-2px);
|
| 1737 |
+
box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
|
| 1738 |
+
}
|
| 1739 |
+
|
| 1740 |
+
.btn-export {
|
| 1741 |
+
background: var(--color-primary);
|
| 1742 |
+
color: var(--color-secondary);
|
| 1743 |
+
padding: 0.5rem 1rem;
|
| 1744 |
+
font-size: 0.85rem;
|
| 1745 |
+
font-weight: 700;
|
| 1746 |
+
}
|
| 1747 |
+
|
| 1748 |
+
.btn-export:hover {
|
| 1749 |
+
background: var(--color-primary-soft);
|
| 1750 |
+
transform: translateY(-2px);
|
| 1751 |
+
box-shadow: 0 4px 15px rgba(217, 255, 4, 0.4);
|
| 1752 |
+
}
|
| 1753 |
+
|
| 1754 |
+
/* Section manuelle */
|
| 1755 |
+
.manual-section {
|
| 1756 |
+
height: 100svh;
|
| 1757 |
+
min-height: 100svh;
|
| 1758 |
+
padding: 0;
|
| 1759 |
+
}
|
| 1760 |
+
|
| 1761 |
+
.manual-container {
|
| 1762 |
+
height: 100%;
|
| 1763 |
+
width: 100%;
|
| 1764 |
+
display: flex;
|
| 1765 |
+
flex-direction: column;
|
| 1766 |
+
}
|
| 1767 |
+
|
| 1768 |
+
.manual-content {
|
| 1769 |
+
flex: 1;
|
| 1770 |
+
display: flex;
|
| 1771 |
+
gap: 15px;
|
| 1772 |
+
padding: 15px;
|
| 1773 |
+
overflow: hidden;
|
| 1774 |
+
height: 100%;
|
| 1775 |
+
}
|
| 1776 |
+
|
| 1777 |
+
.manual-section .calibration-container {
|
| 1778 |
+
flex: 1;
|
| 1779 |
+
min-width: 0;
|
| 1780 |
+
display: flex;
|
| 1781 |
+
flex-direction: column;
|
| 1782 |
+
height: 100%;
|
| 1783 |
+
}
|
| 1784 |
+
|
| 1785 |
+
.manual-section .field-container {
|
| 1786 |
+
flex: 1;
|
| 1787 |
+
min-width: 0;
|
| 1788 |
+
overflow: hidden;
|
| 1789 |
+
display: flex;
|
| 1790 |
+
align-items: center;
|
| 1791 |
+
justify-content: center;
|
| 1792 |
+
height: 100%;
|
| 1793 |
+
}
|
| 1794 |
+
|
| 1795 |
+
.manual-section .field-container :deep(svg) {
|
| 1796 |
+
width: 100%;
|
| 1797 |
+
height: 100%;
|
| 1798 |
+
object-fit: contain;
|
| 1799 |
+
margin-top: -10px;
|
| 1800 |
+
}
|
| 1801 |
+
|
| 1802 |
+
.manual-section .calibration-container :deep(.video-frame-container) {
|
| 1803 |
+
height: 100%;
|
| 1804 |
+
}
|
| 1805 |
+
|
| 1806 |
+
.manual-section .calibration-container :deep(.video-frame) {
|
| 1807 |
+
height: calc(100% - 80px);
|
| 1808 |
+
}
|
| 1809 |
+
|
| 1810 |
+
/* Responsive */
|
| 1811 |
+
@media (max-width: 768px) {
|
| 1812 |
+
.home-container {
|
| 1813 |
+
padding: 0 1rem;
|
| 1814 |
+
}
|
| 1815 |
+
|
| 1816 |
+
.section {
|
| 1817 |
+
min-height: auto;
|
| 1818 |
+
}
|
| 1819 |
+
|
| 1820 |
+
.mode-cards, .video-type-cards {
|
| 1821 |
+
grid-template-columns: 1fr;
|
| 1822 |
+
}
|
| 1823 |
+
|
| 1824 |
+
.main-actions {
|
| 1825 |
+
grid-template-columns: 1fr;
|
| 1826 |
+
}
|
| 1827 |
+
|
| 1828 |
+
.hero h1 {
|
| 1829 |
+
font-size: 2.5rem;
|
| 1830 |
+
}
|
| 1831 |
+
|
| 1832 |
+
.manual-content {
|
| 1833 |
+
flex-direction: column;
|
| 1834 |
+
}
|
| 1835 |
+
|
| 1836 |
+
}
|
| 1837 |
+
</style>
|
src/views/ManualView.vue
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<template>
|
| 2 |
+
<div class="calibration">
|
| 3 |
+
<!-- Bouton retour home -->
|
| 4 |
+
<button @click="goBack" class="btn-home" title="Retour à l'accueil">
|
| 5 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 6 |
+
<path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
|
| 7 |
+
<polyline points="9,22 9,12 15,12 15,22"/>
|
| 8 |
+
</svg>
|
| 9 |
+
</button>
|
| 10 |
+
|
| 11 |
+
<div class="main-content">
|
| 12 |
+
<div class="content-area">
|
| 13 |
+
<div class="video-display">
|
| 14 |
+
<div class="calibration-container">
|
| 15 |
+
<CalibrationArea
|
| 16 |
+
ref="calibrationArea"
|
| 17 |
+
:thumbnail="thumbnail"
|
| 18 |
+
:calibrationPoints="calibrationPoints"
|
| 19 |
+
:calibrationLines="calibrationLines"
|
| 20 |
+
:selectedFieldPoint="selectedFieldPoint"
|
| 21 |
+
:selectedFieldLine="selectedFieldLine"
|
| 22 |
+
@update:thumbnail="updateThumbnail"
|
| 23 |
+
@update:calibrationPoints="updateCalibrationPoints"
|
| 24 |
+
@update:calibrationLines="updateCalibrationLines"
|
| 25 |
+
@update:selectedFieldPoint="updateSelectedFieldPoint"
|
| 26 |
+
@update:selectedFieldLine="updateSelectedFieldLine"
|
| 27 |
+
@clear-calibration="clearCalibration"
|
| 28 |
+
@process-calibration="processCalibration"
|
| 29 |
+
/>
|
| 30 |
+
</div>
|
| 31 |
+
<div class="field-container">
|
| 32 |
+
<FootballField
|
| 33 |
+
ref="footballField"
|
| 34 |
+
@point-selected="handleFieldPointSelected"
|
| 35 |
+
@line-selected="handleFieldLineSelected"
|
| 36 |
+
:positionedPoints="calibrationPoints"
|
| 37 |
+
:positionedLines="calibrationLines"
|
| 38 |
+
/>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
</template>
|
| 45 |
+
|
| 46 |
+
<script>
|
| 47 |
+
import CalibrationArea from '@/components/CalibrationArea.vue'
|
| 48 |
+
import FootballField from '@/components/FootballField.vue'
|
| 49 |
+
import { useUploadStore } from '@/stores/upload'
|
| 50 |
+
import { useCalibrationStore } from '@/stores/calibration'
|
| 51 |
+
import api from '@/services/api'
|
| 52 |
+
|
| 53 |
+
export default {
|
| 54 |
+
name: 'ManualView',
|
| 55 |
+
components: {
|
| 56 |
+
CalibrationArea,
|
| 57 |
+
FootballField
|
| 58 |
+
},
|
| 59 |
+
|
| 60 |
+
setup() {
|
| 61 |
+
const uploadStore = useUploadStore()
|
| 62 |
+
const calibrationStore = useCalibrationStore()
|
| 63 |
+
return {
|
| 64 |
+
uploadStore,
|
| 65 |
+
calibrationStore
|
| 66 |
+
}
|
| 67 |
+
},
|
| 68 |
+
|
| 69 |
+
data() {
|
| 70 |
+
return {
|
| 71 |
+
thumbnail: null,
|
| 72 |
+
calibrationPoints: {},
|
| 73 |
+
selectedFieldPoint: null,
|
| 74 |
+
calibrationLines: {},
|
| 75 |
+
selectedFieldLine: null
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
|
| 79 |
+
computed: {
|
| 80 |
+
canProcess() {
|
| 81 |
+
return Object.keys(this.calibrationLines).length > 0 || Object.keys(this.calibrationPoints).length > 0
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
|
| 85 |
+
async created() {
|
| 86 |
+
// Vérifier qu'un fichier est sélectionné
|
| 87 |
+
if (!this.uploadStore.selectedFile) {
|
| 88 |
+
this.$router.push('/')
|
| 89 |
+
return
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
// Appliquer les styles fullscreen
|
| 93 |
+
this.applyFullscreenStyles()
|
| 94 |
+
|
| 95 |
+
// Charger l'image/vidéo
|
| 96 |
+
await this.loadThumbnail()
|
| 97 |
+
},
|
| 98 |
+
|
| 99 |
+
beforeUnmount() {
|
| 100 |
+
// Restaurer les styles originaux
|
| 101 |
+
this.removeFullscreenStyles()
|
| 102 |
+
},
|
| 103 |
+
|
| 104 |
+
methods: {
|
| 105 |
+
goBack() {
|
| 106 |
+
this.removeFullscreenStyles()
|
| 107 |
+
this.$router.push('/')
|
| 108 |
+
},
|
| 109 |
+
|
| 110 |
+
applyFullscreenStyles() {
|
| 111 |
+
const app = document.getElementById('app')
|
| 112 |
+
if (app) {
|
| 113 |
+
app.style.maxWidth = 'none'
|
| 114 |
+
app.style.margin = '0'
|
| 115 |
+
app.style.padding = '0'
|
| 116 |
+
}
|
| 117 |
+
},
|
| 118 |
+
|
| 119 |
+
removeFullscreenStyles() {
|
| 120 |
+
const app = document.getElementById('app')
|
| 121 |
+
if (app) {
|
| 122 |
+
app.style.maxWidth = '1280px'
|
| 123 |
+
app.style.margin = '0 auto'
|
| 124 |
+
app.style.padding = '1rem'
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
|
| 128 |
+
async loadThumbnail() {
|
| 129 |
+
try {
|
| 130 |
+
this.thumbnail = null
|
| 131 |
+
|
| 132 |
+
if (this.uploadStore.isImage) {
|
| 133 |
+
// Pour les images, utiliser directement la preview
|
| 134 |
+
this.thumbnail = this.uploadStore.filePreview
|
| 135 |
+
} else if (this.uploadStore.isStaticVideo && this.uploadStore.extractedFrame) {
|
| 136 |
+
// Pour les vidéos statiques, utiliser la frame déjà extraite
|
| 137 |
+
console.log('Using extracted frame from static video:', this.uploadStore.selectedFile.name)
|
| 138 |
+
this.thumbnail = URL.createObjectURL(this.uploadStore.extractedFrame)
|
| 139 |
+
} else if (this.uploadStore.isVideo) {
|
| 140 |
+
// Pour les autres vidéos, extraire la première frame
|
| 141 |
+
console.log('Extracting first frame from video:', this.uploadStore.selectedFile.name)
|
| 142 |
+
|
| 143 |
+
// Créer une URL pour le fichier vidéo
|
| 144 |
+
const videoUrl = URL.createObjectURL(this.uploadStore.selectedFile)
|
| 145 |
+
|
| 146 |
+
// Extraire la première frame avec un canvas
|
| 147 |
+
const video = document.createElement('video')
|
| 148 |
+
video.src = videoUrl
|
| 149 |
+
video.muted = true // Important pour éviter les problèmes d'autoplay
|
| 150 |
+
|
| 151 |
+
await new Promise((resolve, reject) => {
|
| 152 |
+
video.addEventListener('loadedmetadata', () => {
|
| 153 |
+
video.currentTime = 0 // Aller à la première frame
|
| 154 |
+
})
|
| 155 |
+
|
| 156 |
+
video.addEventListener('seeked', () => {
|
| 157 |
+
try {
|
| 158 |
+
const canvas = document.createElement('canvas')
|
| 159 |
+
canvas.width = video.videoWidth
|
| 160 |
+
canvas.height = video.videoHeight
|
| 161 |
+
|
| 162 |
+
const ctx = canvas.getContext('2d')
|
| 163 |
+
ctx.drawImage(video, 0, 0)
|
| 164 |
+
|
| 165 |
+
this.thumbnail = canvas.toDataURL('image/jpeg', 0.9)
|
| 166 |
+
URL.revokeObjectURL(videoUrl)
|
| 167 |
+
resolve()
|
| 168 |
+
} catch (err) {
|
| 169 |
+
URL.revokeObjectURL(videoUrl)
|
| 170 |
+
reject(err)
|
| 171 |
+
}
|
| 172 |
+
})
|
| 173 |
+
|
| 174 |
+
video.addEventListener('error', (err) => {
|
| 175 |
+
URL.revokeObjectURL(videoUrl)
|
| 176 |
+
reject(err)
|
| 177 |
+
})
|
| 178 |
+
})
|
| 179 |
+
}
|
| 180 |
+
} catch (error) {
|
| 181 |
+
console.error('Erreur lors du chargement du thumbnail:', error)
|
| 182 |
+
this.thumbnail = null
|
| 183 |
+
}
|
| 184 |
+
},
|
| 185 |
+
|
| 186 |
+
handleFieldPointSelected(pointData) {
|
| 187 |
+
this.selectedFieldLine = null
|
| 188 |
+
this.selectedFieldPoint = pointData
|
| 189 |
+
},
|
| 190 |
+
|
| 191 |
+
handleFieldLineSelected(lineData) {
|
| 192 |
+
this.selectedFieldPoint = null
|
| 193 |
+
this.selectedFieldLine = lineData
|
| 194 |
+
},
|
| 195 |
+
|
| 196 |
+
updateThumbnail(newThumbnail) {
|
| 197 |
+
this.thumbnail = newThumbnail
|
| 198 |
+
},
|
| 199 |
+
|
| 200 |
+
updateCalibrationPoints(newPoints) {
|
| 201 |
+
this.calibrationPoints = { ...newPoints }
|
| 202 |
+
},
|
| 203 |
+
|
| 204 |
+
updateCalibrationLines(newLines) {
|
| 205 |
+
this.calibrationLines = { ...newLines }
|
| 206 |
+
},
|
| 207 |
+
|
| 208 |
+
updateSelectedFieldPoint(newPoint) {
|
| 209 |
+
this.selectedFieldPoint = newPoint
|
| 210 |
+
},
|
| 211 |
+
|
| 212 |
+
updateSelectedFieldLine(newLine) {
|
| 213 |
+
this.selectedFieldLine = newLine
|
| 214 |
+
if (this.$refs.footballField) {
|
| 215 |
+
this.$refs.footballField.selectedLine = newLine ? newLine.id : null
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
|
| 219 |
+
clearCalibration() {
|
| 220 |
+
this.calibrationPoints = {}
|
| 221 |
+
this.calibrationLines = {}
|
| 222 |
+
this.selectedFieldPoint = null
|
| 223 |
+
this.selectedFieldLine = null
|
| 224 |
+
},
|
| 225 |
+
|
| 226 |
+
async processCalibration() {
|
| 227 |
+
if (!this.uploadStore.selectedFile || Object.keys(this.calibrationLines).length === 0) {
|
| 228 |
+
alert('Veuillez créer au moins une ligne de calibration')
|
| 229 |
+
return
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
try {
|
| 233 |
+
this.calibrationStore.setProcessing(true, 'Traitement de la calibration manuelle...')
|
| 234 |
+
|
| 235 |
+
if (!this.$refs.calibrationArea) {
|
| 236 |
+
console.error('CalibrationArea component is not mounted.')
|
| 237 |
+
return
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
const imageContainer = document.querySelector('.video-frame')
|
| 241 |
+
const imageSize = this.$refs.calibrationArea.imageSize
|
| 242 |
+
if (!imageSize) {
|
| 243 |
+
console.error('Image size is not available.')
|
| 244 |
+
return
|
| 245 |
+
}
|
| 246 |
+
const containerWidth = imageContainer.clientWidth
|
| 247 |
+
const containerHeight = imageContainer.clientHeight
|
| 248 |
+
|
| 249 |
+
// Préparer les données des lignes pour l'API /calibrate
|
| 250 |
+
const linesData = {}
|
| 251 |
+
|
| 252 |
+
// Traitement des lignes - conversion des coordonnées container vers image
|
| 253 |
+
for (const [lineName, line] of Object.entries(this.calibrationLines)) {
|
| 254 |
+
linesData[lineName] = line.points.map(point => {
|
| 255 |
+
return {
|
| 256 |
+
x: point.x / containerWidth * imageSize.width,
|
| 257 |
+
y: point.y / containerHeight * imageSize.height
|
| 258 |
+
}
|
| 259 |
+
})
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
console.log('🔥 Données de lignes pour calibration:', linesData)
|
| 263 |
+
|
| 264 |
+
// Appeler l'API /calibrate avec l'image et les lignes
|
| 265 |
+
const result = await api.calibrateCamera(this.uploadStore.selectedFile, linesData)
|
| 266 |
+
|
| 267 |
+
console.log('🔥 Réponse API calibration:', result)
|
| 268 |
+
|
| 269 |
+
if (result.status === 'success') {
|
| 270 |
+
this.calibrationStore.setResults(result)
|
| 271 |
+
this.$router.push('/')
|
| 272 |
+
} else if (result.status === 'failed') {
|
| 273 |
+
throw new Error(result.message || "Échec du traitement de la calibration")
|
| 274 |
+
} else {
|
| 275 |
+
throw new Error(result.error || 'Erreur de traitement')
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
} catch (error) {
|
| 279 |
+
console.error('❌ Erreur lors du traitement manuel:', error)
|
| 280 |
+
this.calibrationStore.setError(error.message)
|
| 281 |
+
this.$router.push('/')
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
}
|
| 286 |
+
</script>
|
| 287 |
+
|
| 288 |
+
<style scoped>
|
| 289 |
+
.calibration {
|
| 290 |
+
height: 100vh;
|
| 291 |
+
display: flex;
|
| 292 |
+
flex-direction: column;
|
| 293 |
+
color: white;
|
| 294 |
+
position: fixed;
|
| 295 |
+
top: 0;
|
| 296 |
+
left: 0;
|
| 297 |
+
right: 0;
|
| 298 |
+
bottom: 0;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.btn-home {
|
| 302 |
+
position: fixed;
|
| 303 |
+
top: 20px;
|
| 304 |
+
right: 20px;
|
| 305 |
+
background: rgba(255, 255, 255, 0.1);
|
| 306 |
+
color: #888;
|
| 307 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 308 |
+
border-radius: 8px;
|
| 309 |
+
padding: 10px;
|
| 310 |
+
cursor: pointer;
|
| 311 |
+
transition: all 0.3s ease;
|
| 312 |
+
z-index: 1000;
|
| 313 |
+
display: flex;
|
| 314 |
+
align-items: center;
|
| 315 |
+
justify-content: center;
|
| 316 |
+
backdrop-filter: blur(10px);
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
.btn-home:hover {
|
| 320 |
+
background: rgba(255, 255, 255, 0.15);
|
| 321 |
+
color: var(--color-primary);
|
| 322 |
+
border-color: var(--color-primary);
|
| 323 |
+
transform: scale(1.05);
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
.btn-home svg {
|
| 327 |
+
transition: all 0.3s ease;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
.main-content {
|
| 331 |
+
display: flex;
|
| 332 |
+
flex: 1;
|
| 333 |
+
overflow: hidden;
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
.content-area {
|
| 337 |
+
flex: 1;
|
| 338 |
+
display: flex;
|
| 339 |
+
flex-direction: column;
|
| 340 |
+
padding: 0;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
.video-display {
|
| 346 |
+
flex: 1;
|
| 347 |
+
display: flex;
|
| 348 |
+
gap: 15px;
|
| 349 |
+
padding: 15px;
|
| 350 |
+
overflow: hidden;
|
| 351 |
+
height: 100%;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
.calibration-container {
|
| 355 |
+
flex: 1;
|
| 356 |
+
min-width: 0;
|
| 357 |
+
display: flex;
|
| 358 |
+
flex-direction: column;
|
| 359 |
+
height: 100%;
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
.field-container {
|
| 363 |
+
flex: 1;
|
| 364 |
+
min-width: 0;
|
| 365 |
+
overflow: hidden;
|
| 366 |
+
display: flex;
|
| 367 |
+
align-items: center;
|
| 368 |
+
justify-content: center;
|
| 369 |
+
height: 100%;
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
.field-container :deep(svg) {
|
| 373 |
+
width: 100%;
|
| 374 |
+
height: 100%;
|
| 375 |
+
object-fit: contain;
|
| 376 |
+
margin-top: -10px;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
.calibration-container :deep(.video-frame-container) {
|
| 380 |
+
height: 100%;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
.calibration-container :deep(.video-frame) {
|
| 384 |
+
height: calc(100% - 80px);
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
.actions {
|
| 388 |
+
display: flex;
|
| 389 |
+
justify-content: center;
|
| 390 |
+
background-color: #2a2a2a;
|
| 391 |
+
border-top: 1px solid #333;
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
.btn-process {
|
| 395 |
+
background: var(--color-primary);
|
| 396 |
+
color: var(--color-secondary);
|
| 397 |
+
border: none;
|
| 398 |
+
padding: 1rem 2rem;
|
| 399 |
+
border-radius: 8px;
|
| 400 |
+
font-weight: 700;
|
| 401 |
+
font-size: 1rem;
|
| 402 |
+
cursor: pointer;
|
| 403 |
+
transition: all 0.3s ease;
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
.btn-process:hover:not(:disabled) {
|
| 407 |
+
background: var(--color-primary-soft);
|
| 408 |
+
transform: translateY(-2px);
|
| 409 |
+
box-shadow: 0 4px 15px rgba(217, 255, 4, 0.4);
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
.btn-process:disabled {
|
| 413 |
+
background: #555;
|
| 414 |
+
color: #888;
|
| 415 |
+
cursor: not-allowed;
|
| 416 |
+
transform: none;
|
| 417 |
+
box-shadow: none;
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
/* Responsive */
|
| 421 |
+
@media (max-width: 768px) {
|
| 422 |
+
.video-display {
|
| 423 |
+
flex-direction: column;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
.header-actions {
|
| 427 |
+
padding: 1rem;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
.header-actions h1 {
|
| 431 |
+
font-size: 1.2rem;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
.file-info {
|
| 435 |
+
display: none;
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
</style>
|
vite.config.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { fileURLToPath, URL } from 'node:url'
|
| 2 |
+
|
| 3 |
+
import { defineConfig } from 'vite'
|
| 4 |
+
import vue from '@vitejs/plugin-vue'
|
| 5 |
+
import vueDevTools from 'vite-plugin-vue-devtools'
|
| 6 |
+
|
| 7 |
+
// https://vite.dev/config/
|
| 8 |
+
export default defineConfig({
|
| 9 |
+
plugins: [
|
| 10 |
+
vue(),
|
| 11 |
+
vueDevTools(),
|
| 12 |
+
],
|
| 13 |
+
resolve: {
|
| 14 |
+
alias: {
|
| 15 |
+
'@': fileURLToPath(new URL('./src', import.meta.url))
|
| 16 |
+
},
|
| 17 |
+
},
|
| 18 |
+
})
|