Skip to content

Commit e0dff08

Browse files
Fix RuntimeError when toggling image rectification
Co-authored-by: TillBeemelmanns <[email protected]>
1 parent fc1bf33 commit e0dff08

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)