diff --git a/hugin-gopro-fusion/README.md b/hugin-gopro-fusion/README.md index ae4e839f..d40f53e2 100644 --- a/hugin-gopro-fusion/README.md +++ b/hugin-gopro-fusion/README.md @@ -47,6 +47,12 @@ Ce script ne fera les assemblages que si le fichier de destination n'existe pas ## Une fois les assemblages réalisés Il faut encore remettre les infos GPS dans les fichiers générés. Pour cela il existe le script **exif_batch.sh**. +Exemple pour assembler les infos exif depuis les images gopro front se trouvant dans INBOX_a_assembler/rouen_3 vers les +assemblages du même numéro. + +```bash +bash /home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/exif_batch.sh 36077 38695 INBOX_a_assembler/rouen_3 +``` ## Suivi des assemblages On arrive vite a avoir de nombreux dossiers de capture. @@ -62,4 +68,4 @@ Il reste à lancer le script bash pour faire tous les assemblages à la suite et Une fois les assemblages réalisés et les infos de GPS présentes, les infos d'orientation réalisées avec JOSM, il n'y a plus qu'à envoyer les assemblages sur panoramax avec geovisio_cli. ``` geovisio upload --api-url https://panoramax.openstreetmap.fr . -``` \ No newline at end of file +``` diff --git a/hugin-gopro-fusion/exif_batch.sh b/hugin-gopro-fusion/exif_batch.sh index d69ff03e..b4ada78c 100755 --- a/hugin-gopro-fusion/exif_batch.sh +++ b/hugin-gopro-fusion/exif_batch.sh @@ -6,7 +6,8 @@ ################################### # complétion des données gps depuis une des photos assemblées ################################### -# exemple ./exif_batch.sh 36077 36159 +# exemple +# bash /home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/exif_batch.sh 36077 38695 INBOX_a_assembler/rouen_3 # va assigner les données exif des photos gopro GF036077.JPG à leur assemblage assemblage_063077.jpg #folder="rouen/rouen_oct23" @@ -17,6 +18,7 @@ function batch_exif_photos { local folder=$3 local dir="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/$folder" + echo "subdirectory of gopro is $dir" echo $(seq $min $max) for i in $(seq $min $max); do @@ -26,8 +28,8 @@ function batch_exif_photos { if [ -f "$file" ] && [ -f "$file_assemblage" ]; then echo "set the tags in assemblage $i from GF0$filename.jpg" -# exiftool -tagsFromFile "$file" $file $file_assemblage -overwrite_original -# echo "updated the exift tags of $file_assemblage" + exiftool -tagsFromFile "$file" $file $file_assemblage -overwrite_original + echo "updated the exift tags of $file_assemblage" else echo "batch_exif_photos: File $file does not exist." fi diff --git a/hugin-gopro-fusion/find_min_max.ts b/hugin-gopro-fusion/find_min_max.ts new file mode 100644 index 00000000..9527fcfc --- /dev/null +++ b/hugin-gopro-fusion/find_min_max.ts @@ -0,0 +1,54 @@ +import fs from "node:fs"; +import path from "path"; + +// @ts-ignore +import minimist from 'minimist'; + +let mini_arguments: any = minimist(process.argv.slice(2)) + +let folder = `/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/INBOX_a_assembler/` +let subfolder = `` + +if (mini_arguments['folder']) { + subfolder = mini_arguments['folder'] +} + +/** + * trouver les valeux min et max de numéros de séquence gopro dans un dossier contenant des photos jpg + * @param dirPath + */ +function findMinMaxNumberOfPhotos(dirPath: string): { min: number, max: number } { + + console.log('dirPath', dirPath) + + let minNumber: number = 0; + let maxNumber: number = 0; + + // Boucler sur chaque fichier JPG dans le dossier + fs.readdirSync(dirPath).forEach(file => { + // Vérifier si le fichier est un fichier JPG + if (path.extname(file) === '.jpg' || path.extname(file) === '.JPG') { + // Éxtraire le nombre du nom de fichier + let matches: any = file.match(/(\d+)/); + if (matches && matches.length && matches[0]) { + let number = parseInt(matches[0]); + + // Sauver le nombre minimal et maximal trouvé jusqu'à présent + if (minNumber === 0 && number > 0) { + minNumber = number; + } + if (number > maxNumber) { + maxNumber = number; + } + } + } + }); + + return { + min: minNumber, + max: maxNumber, + } +} + +let result = findMinMaxNumberOfPhotos(folder + subfolder) +console.log('result :\n', `bash /home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/exif_batch.sh ${result.min} ${result.max} INBOX_a_assembler/${subfolder}`) diff --git a/hugin-gopro-fusion/main.ts b/hugin-gopro-fusion/main.ts index a0a9af5e..a3da88ac 100644 --- a/hugin-gopro-fusion/main.ts +++ b/hugin-gopro-fusion/main.ts @@ -7,6 +7,8 @@ **/ +const path = require('path'); + // @ts-ignore import * as fs from 'node:fs'; // @ts-ignore @@ -43,6 +45,7 @@ if (mini_arguments['goproMax']) { goproMax = mini_arguments['goproMax'] } + let hugin_batch_command = 'bash /home/poule/encrypted/stockage-syncable/www/development/html/scripts/hugin-gopro-fusion/exif_batch.sh ' + goproMin + ' ' + goproMax @@ -61,11 +64,24 @@ if (mini_arguments['folder']) { let dossier_assemblages_output = `${gopro_folder}/hugin_assemblages_script_output`; + +let minmax = findMinMaxNumberOfPhotos(folder) +console.log('minmax', minmax) + +goproMin = minmax.min +goproMax = minmax.max + +let countPhotos = ((goproMax)) - ((goproMin)); +console.log('goproMax', goproMax) +console.log('goproMin', goproMin) +console.log('max - min', (goproMax) - (goproMin)) +console.log('la séquence', countPhotos, 'captures', (countPhotos / 60).toFixed(0), 'minutes'); + + + console.log('mini_arguments', mini_arguments) -const path = require('path'); - /** * trouver les valeux min et max de numéros de séquence gopro dans un dossier contenant des photos jpg * @param dirPath @@ -289,18 +305,6 @@ function main() { } -let minmax = findMinMaxNumberOfPhotos(folder) -console.log('minmax', minmax) - -goproMin = minmax.min -goproMax = minmax.max - -let countPhotos = ((goproMax)) - ((goproMin)); -console.log('goproMax', goproMax) -console.log('goproMin', goproMin) -console.log('max - min', (goproMax) - (goproMin)) -console.log('la séquence', countPhotos, 'captures', (countPhotos / 60).toFixed(0), 'minutes'); - // run it all main()