Hi there,
Working in a Python environment using ROS as the platform, I am having trouble displaying both image streams from separate topics.
The below code snippet simply freezes when I attempt to display both image stream at the same time but works fine individually.
def __init__(self):
self.bridge = CvBridge()
self.depth_sub = rospy.Subscriber("/camera/aligned_depth_to_color/image_raw",Image,self.callback)
self.image_sub = rospy.Subscriber("/camera/color/image_raw",Image,self.imgcallback)
def imgcallback(self,data):
try:
imgframe = self.bridge.imgmsg_to_cv2(data,"bgr8")
except CvBridgeError as e:
print(e)
cv2.imshow('Image Frame',imgframe)
cv2.moveWindow('Image Frame',640,0)
cv2.waitKey(1)
def callback(self,data):
try:
frame = self.bridge.imgmsg_to_cv2(data)
except CvBridgeError as e:
print(e)
cv2.imshow('Frame',frame)
cv2.moveWindow('Frame',0,0)
cv2.waitKey(1)
def main(args):
ic = image_converter()
rospy.init_node('image_converter', anonymous=True)
try:
rospy.spin()
except KeyboardInterrupt:
print("Shutting down")
cv2.destroyAllWindows()
if __name__ == '__main__':
main(sys.argv)
↧