Is it possible to convert depth messages as Ipl image using CvBridge
I could convert RGB messages in to picture but says that the "[32FC1] is not a color format. but [mono8] is. The conversion does not make sense". Is there anything else i should be doing?
my code
import roslib
from matplotlib import pyplot as plt
roslib.load_manifest('beginner_tutorials')
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
i=0
np.set_printoptions(threshold='nan')
def callback(data):
try:
cv_image = CvBridge().imgmsg_to_cv2(data, "32FC1")
except CvBridgeError, e:
print e
global i
cv_image1 = np.array(cv_image, dtype=np.float)
cv2.normalize(cv_image1, cv_image1, 0, 1, cv2.NORM_MINMAX)
cv_image1=cv_image1*2**16
cv2.imwrite("im"+str(i)+".jpg")
i+=1
def video():
rospy.init_node('video', anonymous=True)
im=rospy.Subscriber('/camera/depth_registered/image_rect', Image, callback)
rospy.spin()
if __name__ == '__main__':
video()