![]() ShowImage( " Image window ", cv_image) 31 cv. GetSize( cv_image) 27 if cols > 60 and rows > 60 : 28 cv. imgmsg_to_cv( data, " bgr8 ") 23 except CvBridgeError, e: 24 print e 25 26 ( cols, rows) = cv. callback) 19 20 def callback( self, data): 21 try: 22 cv_image = self. Subscriber( " image_topic ", Image, self. NamedWindow( " Image window ", 1) 17 self. Publisher( " image_topic_2 ", Image) 15 16 cv. load_manifest( ' my_package ') 4 import sys 5 import rospy 6 import cv 7 from std_msgs.msg import String 8 from sensor_msgs.msg import Image 9 from cv_bridge import CvBridge, CvBridgeError 10 11 class image_converter: 12 13 def _init_( self): 14 self. To convert an IplImage into a ROS image message, CvBridge provides the following function:ġ #!/usr/bin/env python 2 import roslib 3 roslib. Note that mono8 and bgr8 are the two image encodings expected by most OpenCV functions.Ĭonverting OpenCV images to ROS image messages Rgba8: CV_8UC4, RGB color image with an alpha channel Rgb8: CV_8UC3, color image with red-green-blue color orderīgra8: CV_8UC4, BGR color image with an alpha channel To use this feature, specify the encoding to be one of the following strings:īgr8: CV_8UC3, color image with blue-green-red color order ![]() Image encodings can be any one of the following OpenCV image encodings:įor popular image encodings, CvBridge will optionally do color or pixel depth conversions as necessary. ![]() If the default value of "passthrough" is given, the destination image encoding will be the same as the image message encoding. The encoding refers to the destination IplImage image. The input is the image message, as well as an optional encoding. imgmsg_to_cv( image_message, encoding= " passthrough ") 2
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |