本文整理匯總了Python中sensor_msgs.msg.Image.z方法的典型用法代碼示例。如果您正苦於以下問題:Python Image.z方法的具體用法?Python Image.z怎麽用?Python Image.z使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sensor_msgs.msg.Image
的用法示例。
在下文中一共展示了Image.z方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ord
# 需要導入模塊: from sensor_msgs.msg import Image [as 別名]
# 或者: from sensor_msgs.msg.Image import z [as 別名]
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
gray_image = cv2.imshow('frame',gray)
# if cv2.waitKey(1) & 0xFF == ord('q'):
# break
# # When everything done, release the capture
# cap.release()
# cv2.destroyAllWindows()
def callback(data):
print data
cv_image = bridge.imgmsg_to_cv2(image_message, desired_encoding ="passthrough")
gx,gy,gz = gray(cv_image)
if cx is not None:
i = Image()
i.x = gx
i.y = gy
i.z = gz
image_message = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
pub.publish(i)
def listener():
rospy.Subscriber('/camera/image_raw',Image,callback)
rospy.Subscriber('/camera/camera_info',CameraInfo,callback)
rospy.spin()
if __name__ == '__main__':
listener()