Skip to content

Commit 4121f86

Browse files
Merge pull request #4 from ika-rwth-aachen/copilot/fix-c445d49a-fa90-4adb-967f-6f45071f1178
Fix RuntimeError when toggling image rectification checkbox
2 parents 0b6e57f + e0dff08 commit 4121f86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ros2_calib/calibration_widget.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,18 +648,18 @@ def display_image(self):
648648
h, w, c = self.cv_image.shape
649649
self.image_res_label.setText(f"{w} x {h}")
650650

651-
# Clear existing image from scene but preserve other items
651+
# Clear existing image from scene but preserve other items (except PointCloudItem)
652652
items_to_preserve = []
653653
for item in self.scene.items():
654-
if not isinstance(item, QGraphicsPixmapItem):
654+
if not isinstance(item, QGraphicsPixmapItem) and not isinstance(item, PointCloudItem):
655655
items_to_preserve.append(item)
656656

657657
# Clear the scene and add the new image
658658
self.scene.clear()
659659
q_image = QImage(self.cv_image.data, w, h, 3 * w, QImage.Format_RGB888)
660660
self.scene.addPixmap(QPixmap.fromImage(q_image))
661661

662-
# Restore preserved items
662+
# Restore preserved items (PointCloudItem will be recreated by project_pointcloud)
663663
for item in items_to_preserve:
664664
self.scene.addItem(item)
665665

0 commit comments

Comments
 (0)