Skip to content

Instantly share code, notes, and snippets.

@furushchev
Last active November 16, 2019 02:13
Show Gist options
  • Save furushchev/437084d09f4ff602942edf11739d38ba to your computer and use it in GitHub Desktop.
Save furushchev/437084d09f4ff602942edf11739d38ba to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
def callback(msg):
rospy.loginfo(msg.width)
try:
frame = CvBridge().imgmsg_to_cv2(msg, "bgr8")
except:
rospy.logerr('error occured')
# 今までのYOLOの処理
def main():
rospy.init_node('sample')
sub = rospy.Subscriber('~input`, Image, callback, queue_size=1)
rospy.spin()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment