4 Commits

2 changed files with 6 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ Designed for contribution to street-level imagery projects like Mapillary or Pan
__author__ = "Lucas MATHIEU (@campanu)"
__license__ = "GPL-3.0-or-later"
__version__ = "2.0-alpha10"
__version__ = "2.0-alpha11"
__maintainer__ = "Lucas MATHIEU (@campanu)"
__email__ = "campanu@luc-geo.fr"
@@ -94,6 +94,7 @@ def video_metadata_reader(video_path: str):
video_md['width'] = video.get(cv2.CAP_PROP_FRAME_WIDTH)
video_md['height'] = video.get(cv2.CAP_PROP_FRAME_HEIGHT)
video_md['frame_number'] = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
video = None
return video_md
@@ -501,10 +502,10 @@ try:
ret, frame = video.read()
# Image resizing
if frame_height != 0:
resize_factor = video_height / frame_height
if frame_height != video_height:
resize_factor = frame_height / video_height
image_height = frame_height
image_width = int(round(video_height * resize_factor, 0))
image_width = int(round(video_width * resize_factor, 0))
frame = cv2.resize(frame, (image_width, image_height), interpolation=cv2.INTER_LANCZOS4)
@@ -512,7 +513,7 @@ try:
image_name = "{}_f{}.jpg".format(video_file_name.split('.')[0], frame_name)
image_path = "{}/{}".format(output_folder, image_name)
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, 0x221111])
# Time tags formatting
time_shift = i * frame_sampling