37 from python_qt_binding
import QT_BINDING_MODULES
39 not QT_BINDING_MODULES[
'QtCore'].__name__.startswith(
'PyQt5')
and
40 'PyQt5' in sys.modules
42 sys.modules[
'PyQt5'] =
None
43 from PIL.ImageQt
import ImageQt
45 from rqt_bag
import TopicMessageView
46 from rqt_bag_plugins
import image_helper
48 from python_qt_binding.QtGui
import QPixmap
49 from python_qt_binding.QtWidgets
import QGraphicsScene, QGraphicsView
60 super(ImageView, self).
__init__(timeline, parent, topic)
90 TopicMessageView.message_viewed(self, bag, msg_details)
91 topic, msg, t = msg_details[:3]
95 self.
set_image(msg, topic, msg.header.stamp)
98 TopicMessageView.message_cleared(self)
107 resized_image = self.
_image.resize(
108 (int(scale_factor * self.
_image.size[0]),
109 int(scale_factor * self.
_image.size[1])),
112 QtImage = ImageQt(resized_image)
113 pixmap = QPixmap.fromImage(QtImage)
115 self.
_scene.addPixmap(pixmap)
117 def set_image(self, image_msg, image_topic, image_stamp):
120 self.
_image = image_helper.imgmsg_to_pil(image_msg)