1_capture 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. CONVERTLL_PATH="/home/pi/BallonSonde/convert_ll_dec.py"
  3. READ_NMEA_PATH="/home/pi/BallonSonde/read_nmea.py"
  4. echo "=> Acquisition on !"
  5. DATE=$(date +%y%m%d_%H%M%S)
  6. $READ_NMEA_PATH > /ramfs/.out
  7. raspistill -o /ramfs/$DATE.jpg
  8. DATA=$(cat /ramfs/.out)
  9. NS=$(echo $DATA| tr ' ' '\n' | grep NS | cut -d'=' -f2 | cut -d',' -f1)
  10. EW=$(echo $DATA| tr ' ' '\n' | grep EW | cut -d'=' -f2 | cut -d',' -f1)
  11. LAT=$(echo $DATA| tr ' ' '\n' | grep 'lat=' | cut -d'=' -f2 | cut -d',' -f1)
  12. echo "Latitude $LAT"
  13. LATD=$($CONVERTLL_PATH $LAT | grep "d:" | cut -d':' -f2)
  14. LATM=$($CONVERTLL_PATH $LAT | grep "m:" | cut -d':' -f2)
  15. LATS=$($CONVERTLL_PATH $LAT | grep "s:" | cut -d':' -f2 | sed 's/\.//' )
  16. echo "$LATD $LATM $LATS"
  17. LON=$(echo $DATA| tr ' ' '\n' | grep 'lon=' | cut -d'=' -f2 | cut -d',' -f1)
  18. echo "Longitude : $LON"
  19. LOND=$($CONVERTLL_PATH $LON| grep "d:" | cut -d':' -f2)
  20. LONM=$($CONVERTLL_PATH $LON | grep "m:" | cut -d':' -f2)
  21. LONS=$($CONVERTLL_PATH $LON | grep "s:" | cut -d':' -f2 | sed 's/\.//')
  22. echo "$LOND $LONM $LONS"
  23. # Creation du script pour ajout des données Exif dans le JPG
  24. cat <<EOF > /ramfs/.conf_exif
  25. # Ajouter aux metadatas les informations de geolocalisation
  26. # 'add' pour ajouter les informations
  27. # 'set' pour remplacer celles déjà exisante
  28. # 'del' pour les supprimer (sans préciser de valeur)
  29. add Exif.GPSInfo.GPSLatitudeRef ${NS}
  30. add Exif.GPSInfo.GPSLatitude ${LATD}/1 ${LATM}/1 ${LATS}/10000
  31. add Exif.GPSInfo.GPSLongitudeRef ${EW}
  32. add Exif.GPSInfo.GPSLongitude ${LOND}/1 ${LONM}/1 ${LONS}/10000
  33. EOF
  34. if [[ "$LAT" -ne "NO_DATA" ]]; then
  35. exiv2 -m /ramfs/.conf_exif /ramfs/$DATE.jpg
  36. else
  37. echo "Don't have GPS datas, continue without these datas"
  38. fi
  39. echo "Picz $DATE.jpg saved in RAM"
  40. mv /ramfs/$DATE.jpg ~/_Pictures
  41. echo "Picz $DATE.jpg saved to SDCARD"
  42. echo "$DATE.jpg" > /ramfs/.canbeconvert
  43. sleep 60