I have trouble viewing color images from R200 realsense camera using the python-opencv interface.
The window is blank when I run this script.
When I comment out'cv2.namedWindow("Image window", 1)', it shows the first image.
-P
import roslib
import sys
import rospy
import cv2
from std_msgs.msg import String
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Image
from rospy.numpy_msg import numpy_msg
from rospy_tutorials.msg import Floats
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
import math;
import cv2;
import matplotlib.pyplot as plt;
import sys;
import caffe;
import socket;
from sklearn import datasets;
import subprocess;
import message_filters
from rospy.numpy_msg import numpy_msg
import time
#####################
import os.path
class image_converter:
Initializing variables, publishers and subscribers
Hi pnambiar. I don't have an R200 camera to test so I would suggest posting your question on http://answers.ros.org. Be sure to include the version of ROS and Ubuntu you are using.
I have trouble viewing color images from R200 realsense camera using the python-opencv interface. The window is blank when I run this script. When I comment out'cv2.namedWindow("Image window", 1)', it shows the first image.
-P
import roslib import sys import rospy import cv2 from std_msgs.msg import String from geometry_msgs.msg import Twist from sensor_msgs.msg import Image from rospy.numpy_msg import numpy_msg
from rospy_tutorials.msg import Floats
from cv_bridge import CvBridge, CvBridgeError import numpy as np import math; import cv2;
import matplotlib.pyplot as plt;
import sys;
import caffe;
import socket;
from sklearn import datasets;
import subprocess;
import message_filters from rospy.numpy_msg import numpy_msg import time #####################
import os.path
class image_converter:
Initializing variables, publishers and subscribers
def init(self): print 'show window' cv2.namedWindow("Image window", 1)
print 'start bridge and subscribe'
The main callback that processes the color and depth data.
def callback(self,color):
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)