@@ -146,8 +146,7 @@ def load_image_and_draw_overlays(image_path: str, results_dict: Optional[Dict[st
146146 return pixmaps
147147
148148 except Exception as e :
149- print (f"Error loading image with OpenCV: { e } " )
150- # Fallback to QPixmap
149+ # Fallback to QPixmap if OpenCV fails
151150 return {"image" : QPixmap (image_path )}
152151
153152@dataclass
@@ -1254,16 +1253,14 @@ def dropEvent(self, event: QDropEvent):
12541253 """Handle drop events"""
12551254 urls = event .mimeData ().urls ()
12561255 new_files = []
1257- folder_dropped = False
12581256
12591257 for url in urls :
12601258 path = url .toLocalFile ()
12611259 if os .path .isfile (path ) and path .lower ().endswith (('.png' , '.jpg' , '.jpeg' , '.bmp' , '.tiff' )):
12621260 new_files .append (path )
12631261 elif os .path .isdir (path ):
1264- folder_dropped = True
12651262 # Add all images in directory
1266- for ext in ['*.png' , '*.jpg' , '*.jpeg' , '* .bmp' , '*.tiff' ]:
1263+ for ext in ['*.png' , '*.jpg' , '*.jpeg' , '.bmp' , '*.tiff' ]:
12671264 new_files .extend (Path (path ).glob (ext ))
12681265 new_files .extend (Path (path ).glob (ext .upper ()))
12691266
@@ -1453,8 +1450,20 @@ def on_single_processing_complete(self):
14531450 if len (self .results [image_path ]) == len (self .sdk_versions ):
14541451 self .update_single_image_display (image_path )
14551452
1456- total_barcodes = sum (len (result .barcodes ) for result in self .results [image_path ].values ())
1457- self .status_bar .showMessage (f"✅ Processing complete! Found { total_barcodes } total barcodes." )
1453+ # Count results based on detection mode
1454+ total_results = 0
1455+ result_type = "items"
1456+ if self .current_detection_mode == "Barcode" :
1457+ total_results = sum (len (result .barcodes ) for result in self .results [image_path ].values ())
1458+ result_type = "barcodes"
1459+ elif self .current_detection_mode == "MRZ" :
1460+ total_results = sum (len (result .mrz_results ) for result in self .results [image_path ].values ())
1461+ result_type = "MRZ results"
1462+ elif self .current_detection_mode == "Document" :
1463+ total_results = sum (len (result .document_results ) for result in self .results [image_path ].values ())
1464+ result_type = "documents"
1465+
1466+ self .status_bar .showMessage (f"✅ Processing complete! Found { total_results } total { result_type } ." )
14581467
14591468 # Clean up thread
14601469 if self .processing_thread :
@@ -1492,9 +1501,12 @@ def on_detection_mode_changed(self, mode: str):
14921501 self .current_detection_mode = mode
14931502 self .status_bar .showMessage (f"Detection mode changed to: { mode } " )
14941503
1495- # Clear existing results when mode changes as they're no longer valid
1504+ # Clear existing results and image files when mode changes as they're no longer valid
14961505 self .results .clear ()
14971506 self .results_table .setRowCount (0 )
1507+ self .image_files .clear ()
1508+ self .file_list .clear ()
1509+ self .new_files = []
14981510 self .image_comparison .sdk1_scene .clear ()
14991511 self .image_comparison .sdk2_scene .clear ()
15001512 self .image_comparison .summary_label .setText (f"Detection mode: { mode } - Add images to begin comparison" )
@@ -1791,11 +1803,7 @@ def process_image(image_path, detection_mode):
17911803 # Clean up
17921804 shutil .rmtree (temp_dir )
17931805
1794- # Debug output
17951806 if result .returncode != 0 :
1796- print (f"Subprocess failed with return code: { result .returncode } " )
1797- print (f"stdout: { result .stdout } " )
1798- print (f"stderr: { result .stderr } " )
17991807 return ProcessingResult (
18001808 detection_mode = self .detection_mode ,
18011809 processing_time = 0.0 ,
@@ -1805,7 +1813,6 @@ def process_image(image_path, detection_mode):
18051813 )
18061814
18071815 if not result .stdout .strip ():
1808- print (f"Empty output from subprocess" )
18091816 return ProcessingResult (
18101817 detection_mode = self .detection_mode ,
18111818 processing_time = 0.0 ,
@@ -1817,8 +1824,6 @@ def process_image(image_path, detection_mode):
18171824 try :
18181825 data = json .loads (result .stdout )
18191826 except json .JSONDecodeError as e :
1820- print (f"JSON decode error: { e } " )
1821- print (f"Raw output: '{ result .stdout } '" )
18221827 return ProcessingResult (
18231828 detection_mode = self .detection_mode ,
18241829 processing_time = 0.0 ,
0 commit comments