robot_detect.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:micros_mars_task_alloc 作者: liminglong 项目源码 文件源码
def receive_1_cb(self, msg):
        #print 'message received'
        #print msg
        im = self.br.imgmsg_to_cv2(msg, desired_encoding='passthrough')
        for i in range(0, im.shape[0]):
            for j in range(0, im.shape[1]):
                #if not (im[i, j, 0] == 255 and im[i, j, 1] == 0 and im[i, j, 2] == 0):
                if im[i, j, 0] == 255 and im[i, j, 1] == 0 and im[i, j, 2] == 0:
                    #print 'Detect an intruder!'      
                    msg_sended = Bool()
                    msg_sended.data = True             
                    send = FunctionUnit.create_send(self, self._send_topic, Bool)
                    send.send(msg_sended)
                    virtual_msg = Bool()
                    virtual_msg.data = False
                    self._virtual_send.send(virtual_msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号