[v2.0-alpha5] Re-formatting displaying date in TUI + re-formatting unit in tqdm (cv2 process) + TUI enhancement + correction in locales
This commit is contained in:
@@ -12,6 +12,7 @@ This script is designed to create geotagged frames from video and GPX track."""
|
|||||||
end = "End of program, press Enter to quit."
|
end = "End of program, press Enter to quit."
|
||||||
paths_title = "## Paths"
|
paths_title = "## Paths"
|
||||||
parameters_title = "## Process parameters"
|
parameters_title = "## Process parameters"
|
||||||
|
tags_title = "## Additional tags"
|
||||||
metadata = """{} ({} {}B)\n
|
metadata = """{} ({} {}B)\n
|
||||||
- Duration : {} s\n
|
- Duration : {} s\n
|
||||||
- Start time : {}.{}\n
|
- Start time : {}.{}\n
|
||||||
@@ -21,7 +22,7 @@ metadata = """{} ({} {}B)\n
|
|||||||
cv2_tqdm = 'frame(s)'
|
cv2_tqdm = 'frame(s)'
|
||||||
|
|
||||||
[ui.parameters]
|
[ui.parameters]
|
||||||
toml_setting² = "Setting with TOML file ({}/{}) ? "
|
toml_setting = "Setting with TOML file ({}/{}) ? "
|
||||||
|
|
||||||
timelapse = "Timelapse video ({}/{}) ? "
|
timelapse = "Timelapse video ({}/{}) ? "
|
||||||
timelapse_fps = "Timelapse framerate (frame/s) [{}-{}] : "
|
timelapse_fps = "Timelapse framerate (frame/s) [{}-{}] : "
|
||||||
@@ -38,7 +39,7 @@ video_start_datetime_err = "Error... entered datetime is not valid."
|
|||||||
|
|
||||||
rec_timezone = "Enter time offset related to UTC (example for CEST : +02:00) : "
|
rec_timezone = "Enter time offset related to UTC (example for CEST : +02:00) : "
|
||||||
|
|
||||||
time_offset = "Enter time offset between video and GPX in seconds [{}-{}] : "
|
time_offset = "Enter time offset with GPS track in seconds [{}-{}] : "
|
||||||
time_offset_err = "Error... please enter a decimal between {} and {}."
|
time_offset_err = "Error... please enter a decimal between {} and {}."
|
||||||
|
|
||||||
[ui.paths]
|
[ui.paths]
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ intro = """Bienvenue dans le script video2geoframes.py !
|
|||||||
Ce script permet, à partir d'une vidéo et d'une trace GPS, de créer un ensemble de photos géotaguées."""
|
Ce script permet, à partir d'une vidéo et d'une trace GPS, de créer un ensemble de photos géotaguées."""
|
||||||
end = "Fin du programme, appuyez sur Entrée pour fermer."
|
end = "Fin du programme, appuyez sur Entrée pour fermer."
|
||||||
paths_title = "## Chemins"
|
paths_title = "## Chemins"
|
||||||
|
tags_title = "## Tags additionnels"
|
||||||
parameters_title = "## Paramètres du traitement"
|
parameters_title = "## Paramètres du traitement"
|
||||||
metadatas = """{} ({} {}B)
|
metadatas = """{} ({} {}B)
|
||||||
- Durée : {} s
|
- Durée : {} s
|
||||||
@@ -38,7 +39,7 @@ video_start_datetime_err = "Erreur... l'horodatage entré est invalide."
|
|||||||
|
|
||||||
rec_timezone = "Entrez le décalage horaire par rapport à UTC (exemple pour CEST : +02:00) : "
|
rec_timezone = "Entrez le décalage horaire par rapport à UTC (exemple pour CEST : +02:00) : "
|
||||||
|
|
||||||
time_offset = "Entrez le décalage temporel entre la vidéo et le GPX en secondes [{}-{}] : "
|
time_offset = "Entrez le décalage temporel avec la trace GPS en secondes [{}-{}] : "
|
||||||
time_offset_err = "Erreur... veuillez entrer un nombre décimal entre {} et {}."
|
time_offset_err = "Erreur... veuillez entrer un nombre décimal entre {} et {}."
|
||||||
|
|
||||||
[ui.paths]
|
[ui.paths]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Designed for contribution to street-level imagery projects like Mapillary or Pan
|
|||||||
|
|
||||||
__author__ = "Lucas MATHIEU (@campanu)"
|
__author__ = "Lucas MATHIEU (@campanu)"
|
||||||
__license__ = "AGPL-3.0-or-later"
|
__license__ = "AGPL-3.0-or-later"
|
||||||
__version__ = "2.0-alpha4"
|
__version__ = "2.0-alpha5"
|
||||||
__maintainer__ = "Lucas MATHIEU (@campanu)"
|
__maintainer__ = "Lucas MATHIEU (@campanu)"
|
||||||
__email__ = "campanu@luc-geo.fr"
|
__email__ = "campanu@luc-geo.fr"
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ else:
|
|||||||
model = input(locale_toml['ui']['metadatas']['model'])
|
model = input(locale_toml['ui']['metadatas']['model'])
|
||||||
author = input(locale_toml['ui']['metadatas']['author'])
|
author = input(locale_toml['ui']['metadatas']['author'])
|
||||||
|
|
||||||
# Video metadatas extraction
|
# Video metadatas formatting
|
||||||
print('\n{}'.format(locale_toml['processing']['reading_metadatas']))
|
print('\n{}'.format(locale_toml['processing']['reading_metadatas']))
|
||||||
|
|
||||||
video = cv2.VideoCapture(video_path)
|
video = cv2.VideoCapture(video_path)
|
||||||
@@ -277,7 +277,7 @@ video_file_size = byte_multiple(os.stat(video_path).st_size)
|
|||||||
video_duration = video_total_frames / video_fps
|
video_duration = video_total_frames / video_fps
|
||||||
|
|
||||||
video_start_datetime_obj = video_start_datetime_obj + timedelta(seconds=time_offset)
|
video_start_datetime_obj = video_start_datetime_obj + timedelta(seconds=time_offset)
|
||||||
video_start_datetime = video_start_datetime_obj.strftime('%Y:%m:%d %H:%M:%S')
|
video_start_datetime = video_start_datetime_obj.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
video_start_subsectime = video_start_datetime_obj.strftime('%f')
|
video_start_subsectime = video_start_datetime_obj.strftime('%f')
|
||||||
|
|
||||||
# Metadata recap
|
# Metadata recap
|
||||||
@@ -302,7 +302,7 @@ if timelapse == user_agree:
|
|||||||
else:
|
else:
|
||||||
frame_interval = frame_sampling
|
frame_interval = frame_sampling
|
||||||
|
|
||||||
cv2_tqdm_unit = " {}".format(locale_toml['ui']['units']['cv2_tqdm'])
|
cv2_tqdm_unit = locale_toml['ui']['units']['cv2_tqdm']
|
||||||
cv2_tqdm_range = int(video_duration / frame_interval)
|
cv2_tqdm_range = int(video_duration / frame_interval)
|
||||||
|
|
||||||
for i in tqdm(range(cv2_tqdm_range), unit=cv2_tqdm_unit):
|
for i in tqdm(range(cv2_tqdm_range), unit=cv2_tqdm_unit):
|
||||||
@@ -316,7 +316,7 @@ for i in tqdm(range(cv2_tqdm_range), unit=cv2_tqdm_unit):
|
|||||||
|
|
||||||
cv2.imwrite(image_path, frame, [cv2.IMWRITE_JPEG_QUALITY, 88, cv2.IMWRITE_JPEG_PROGRESSIVE, 1, cv2.IMWRITE_JPEG_SAMPLING_FACTOR, 0x411111])
|
cv2.imwrite(image_path, frame, [cv2.IMWRITE_JPEG_QUALITY, 88, cv2.IMWRITE_JPEG_PROGRESSIVE, 1, cv2.IMWRITE_JPEG_SAMPLING_FACTOR, 0x411111])
|
||||||
|
|
||||||
## Time tags preparation
|
## Time tags formatting
|
||||||
time_shift = i * frame_sampling
|
time_shift = i * frame_sampling
|
||||||
current_datetime_obj = video_start_datetime_obj + timedelta(seconds=time_shift)
|
current_datetime_obj = video_start_datetime_obj + timedelta(seconds=time_shift)
|
||||||
current_datetime = current_datetime_obj.strftime('%Y:%m:%d %H:%M:%S')
|
current_datetime = current_datetime_obj.strftime('%Y:%m:%d %H:%M:%S')
|
||||||
|
|||||||
Reference in New Issue
Block a user