Stitch 2 images

This commit is contained in:
Joe Knapper 2026-06-29 12:21:32 +01:00
parent 27854eb553
commit 5811631c4f
3 changed files with 7 additions and 8 deletions

View file

@ -385,9 +385,8 @@ class SmartScanThing(OFMThing):
if self._preview_stitcher is None:
# This scan can't stitch.
return
# Assume 4 images means at least one offset in x and y, making the stitching
# well constrained.
if self.scan_data.image_count > 3 and not self._preview_stitcher.running:
# Begin stitching once two images are captured
if self.scan_data.image_count >= 2 and not self._preview_stitcher.running:
self._preview_stitcher.start()
@_scan_running
@ -522,8 +521,8 @@ class SmartScanThing(OFMThing):
@_scan_running
def _perform_final_stitch(self) -> None:
"""Update the scan zip and perform final stitch of the data."""
if self.scan_data.image_count <= 3:
self.logger.info("Not performing a stitch as 3 or fewer images taken")
if self.scan_data.image_count <= 1:
self.logger.info("Not performing a stitch as not enough images captured")
return
self.ongoing_scan.zip_files()
@ -737,6 +736,6 @@ class SmartScanThing(OFMThing):
# Use the scan list (the data read by the gallery) to find any scans that
# need stitching.
for scan in self.get_data_for_gallery():
if scan.dzi is None:
if scan.dzi is None and scan.number_of_images >= 2:
self.logger.info(f"Stitching {scan.name}")
self.stitch_scan(scan_name=scan.name)

View file

@ -62,7 +62,7 @@
<li>Duration: {{ formatDuration(itemData.duration) }}</li>
</ul>
<ul>
<li v-if="itemData.number_of_images < 3" class="warning-msg">
<li v-if="itemData.number_of_images < 2" class="warning-msg">
Not enough images to stitch
</li>
<li v-else-if="!itemData.dzi && itemData.stitch_available" class="alert-msg">

View file

@ -203,7 +203,7 @@ export default {
return;
}
all_items.forEach((item) => {
item.can_stitch = !item.stitch_available && item.number_of_images > 3;
item.can_stitch = !item.stitch_available && item.number_of_images > 1;
});
all_items.sort((a, b) => {
return b.created - a.created;