当前位置: 首页>>代码示例>>Python>>正文


Python CompressedImage.width方法代码示例

本文整理汇总了Python中sensor_msgs.msg.CompressedImage.width方法的典型用法代码示例。如果您正苦于以下问题:Python CompressedImage.width方法的具体用法?Python CompressedImage.width怎么用?Python CompressedImage.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sensor_msgs.msg.CompressedImage的用法示例。


在下文中一共展示了CompressedImage.width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: publish_video

# 需要导入模块: from sensor_msgs.msg import CompressedImage [as 别名]
# 或者: from sensor_msgs.msg.CompressedImage import width [as 别名]
    def publish_video(self, vid_type, vid_data, seq=None):
        # convert data
        if vid_type == 1 or vid_type == 2:  # /dev/video1 data
            vid_data = conversionlib.convert(vid_data, VID1_WIDTH, VID1_HEIGHT)

        # gather data/info
        mesginfo = CameraInfo()
        if vid_type == 0:  # video0
            mesgdata = CompressedImage()
            mesgdata.format = "jpeg"
            mesginfo.width = VID0_WIDTH
            mesginfo.height = VID0_HEIGHT
            channel = 0
        elif vid_type == 1:  # video1
            mesgdata = Image()
            mesgdata.width = VID1_WIDTH
            mesgdata.height = VID1_HEIGHT
            mesgdata.encoding = "rgb8"
            mesginfo.width = VID1_WIDTH
            mesginfo.height = VID1_HEIGHT
            channel = 1
        elif vid_type == 2:  # video2
            mesgdata = Image()
            mesgdata.width = VID1_WIDTH
            mesgdata.height = VID1_HEIGHT
            mesgdata.encoding = "rgb8"
            mesginfo.width = VID1_WIDTH
            mesginfo.height = VID1_HEIGHT
            channel = 2
        elif vid_type == "changed_video1":  # e.g. resize, delay
            mesgdata = Image()
            mesgdata.width = VID1_WIDTH
            mesgdata.height = VID1_HEIGHT
            mesgdata.encoding = "rgb8"
            mesginfo.width = VID1_WIDTH
            mesginfo.height = VID1_HEIGHT
            channel = 2
        elif vid_type == "elf_video":
            mesgdata = Image()
            mesgdata.width = VID0_WIDTH
            mesgdata.height = VID0_HEIGHT
            mesgdata.encoding = "rgb8"
            mesginfo.width = VID0_WIDTH
            mesginfo.height = VID0_HEIGHT
            mesginfo.header.seq = seq
            channel = 0
        else:
            raise Exception("bad vid_type: (vid_type = %s)" % vid_type)
        mesgdata.header.stamp = rospy.Time.now()
        mesgdata.data = vid_data
        # note: distortion model not used by PTAM(M)
        # mesginfo.distortion_model = 'plumb_bob'
        # mesginfo.D = [-0.33584000000000003, 0.12129000000000001, -0.0011500000000000002, 0.00039000000000000005, 0.0]
        # mesginfo.K = [431.90402, 0.0, 313.01760999999999, 0.0, 432.04253999999997, 246.35373999999999, 0.0, 0.0, 1.0]
        # mesginfo.R = [ 0.99995000000000012, 0.0089900000000000015, -0.0040000000000000001, \
        #              -0.0089700000000000005, 0.99996000000000007, 0.0029100000000000003,  \
        #               0.0040300000000000006, -0.0028700000000000002, 0.99999000000000005]
        # mesginfo.P = [395.29849999999999, 0.0, 315.97555, 0.0, 0.0, 395.29849999999999, 238.45780999999999, 0.0, 0.0, 0.0, 1.0, 0.0]
        # mesginfo.header.frame_id = 'mono_optical_frame'
        mesginfo.header.stamp = mesgdata.header.stamp

        # publish data/info
        self.pub_vid_data[channel].publish(mesgdata)
        self.pub_vid_info[channel].publish(mesginfo)
开发者ID:nymanjens,项目名称:ardrone-exploration,代码行数:66,代码来源:publishlib.py


注:本文中的sensor_msgs.msg.CompressedImage.width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。