Capture metadata before image to ensure consistency
This commit is contained in:
parent
e6eb4d419d
commit
2c8660e01f
1 changed files with 2 additions and 1 deletions
|
|
@ -573,6 +573,7 @@ class SmartScanThing(Thing):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
capture_start = time.time()
|
capture_start = time.time()
|
||||||
|
metadata = metadata_getter()
|
||||||
raw_image = cam.capture_array(stream_name="raw")
|
raw_image = cam.capture_array(stream_name="raw")
|
||||||
acquired.set()
|
acquired.set()
|
||||||
acquisition_time = time.time()
|
acquisition_time = time.time()
|
||||||
|
|
@ -590,7 +591,7 @@ class SmartScanThing(Thing):
|
||||||
)
|
)
|
||||||
exif_dict = piexif.load(os.path.join(images_folder, name))
|
exif_dict = piexif.load(os.path.join(images_folder, name))
|
||||||
exif_dict["Exif"][piexif.ExifIFD.UserComment] = json.dumps(
|
exif_dict["Exif"][piexif.ExifIFD.UserComment] = json.dumps(
|
||||||
metadata_getter()
|
metadata
|
||||||
).encode("utf-8")
|
).encode("utf-8")
|
||||||
piexif.insert(piexif.dump(exif_dict), os.path.join(images_folder, name))
|
piexif.insert(piexif.dump(exif_dict), os.path.join(images_folder, name))
|
||||||
save_time = time.time()
|
save_time = time.time()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue