Skip to content

Commit a3a856b

Browse files
committed
Clean up
1 parent 524edac commit a3a856b

1 file changed

Lines changed: 5 additions & 29 deletions

File tree

examples/official/comparison_tool/sdk_comparison.py

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,26 @@
1515
import subprocess
1616
import json
1717
import time
18-
import threading
1918
from pathlib import Path
20-
from typing import Dict, List, Optional, Tuple
19+
from typing import Dict, List, Optional
2120
from dataclasses import dataclass
2221
import tempfile
2322
import shutil
24-
import re
2523

26-
# Try to import OpenCV for image processing and EXIF handling
24+
# OpenCV for image processing and EXIF handling
2725
import cv2
2826
import numpy as np
2927

30-
# Try to import PIL as fallback
31-
try:
32-
from PIL import Image, ExifTags
33-
PIL_AVAILABLE = True
34-
except ImportError:
35-
PIL_AVAILABLE = False
36-
3728
from PySide6.QtWidgets import (
3829
QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
3930
QPushButton, QLabel, QTextEdit, QListWidget, QFrame, QGroupBox,
4031
QProgressBar, QFileDialog, QMessageBox, QListWidgetItem, QSplitter,
41-
QTabWidget, QCheckBox, QStatusBar, QScrollArea, QLineEdit,
42-
QTableWidget, QTableWidgetItem, QHeaderView, QComboBox, QSpinBox,
43-
QFormLayout, QTreeWidget, QTreeWidgetItem, QGraphicsView,
44-
QGraphicsScene, QGraphicsPixmapItem, QGraphicsRectItem, QGraphicsTextItem,
45-
QDialog # Add QDialog import
32+
QStatusBar, QTableWidget, QTableWidgetItem, QHeaderView,
33+
QGraphicsView, QGraphicsScene, QDialog
4634
)
4735
from PySide6.QtCore import Qt, QThread, Signal, QTimer, QMimeData, QUrl
4836
from PySide6.QtGui import (
49-
QPixmap, QDragEnterEvent, QDropEvent, QFont, QPainter, QPen,
50-
QBrush, QColor, QAction, QIcon, QTransform, QImage
37+
QPixmap, QDragEnterEvent, QDropEvent, QFont, QColor, QImage
5138
)
5239

5340
def load_image_and_draw_overlays(image_path: str, results_dict: Optional[Dict[str, 'ProcessingResult']] = None) -> Dict[str, QPixmap]:
@@ -874,10 +861,6 @@ def show_comparison(self, image_path: str, results: Dict[str, ProcessingResult])
874861
# Force view updates
875862
self.sdk1_view.update()
876863
self.sdk2_view.update()
877-
878-
# The add_barcode_overlays method is no longer needed since overlays are drawn directly
879-
# onto the OpenCV Mat in the load_image_and_draw_overlays function
880-
881864
def update_barcode_text_area(self, text_area: QTextEdit, result: ProcessingResult):
882865
"""Update barcode results text area with formatted barcode data"""
883866
text_area.clear()
@@ -923,7 +906,6 @@ def __init__(self):
923906
# Data
924907
self.sdk_versions = []
925908
self.image_files = []
926-
self.workers = {}
927909
self.results = {} # {image_path: {sdk_name: ProcessingResult}}
928910
self.processing_thread = None # Initialize to None
929911

@@ -1015,7 +997,6 @@ def setup_ui(self):
1015997
results_layout = QVBoxLayout(results_group)
1016998

1017999
self.results_table = ResultsTableWidget()
1018-
# Remove the image selection connection since we use file list selection now
10191000
results_layout.addWidget(self.results_table)
10201001

10211002
# Export button (after table creation)
@@ -1283,11 +1264,6 @@ def clear_all(self):
12831264
self.image_comparison.sdk2_results_text.clear()
12841265
self.status_bar.showMessage("Cleared all data")
12851266

1286-
def show_image_comparison(self, image_path: str):
1287-
"""Show image comparison for selected image"""
1288-
if image_path in self.results:
1289-
self.image_comparison.show_comparison(image_path, self.results[image_path])
1290-
12911267
class ProcessingThread(QThread):
12921268
"""Background thread for image processing"""
12931269

0 commit comments

Comments
 (0)