quarta-feira, 24 de junho de 2015
How read an image with openCV and publish it using ROS and CvBridge
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2
image = cv2.imread("myimage",1)
pub = rospy.Publisher('image_topic', Image)
pub.publish(bridge.cv2_to_imgmsg(image, "bgr8"))
CvBridge é uma bilbioteca do ROS que fornece uma interface entre ROS e OpenCV. Leia mais em: http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython
Ros Rate
Como manter uma particular taxa
para um laço: usando rospy.Rate
Leia mais em: http://wiki.ros.org/rospy/Overview/Time
rate = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
# ...
rate.sleep()
quinta-feira, 26 de março de 2015
sexta-feira, 13 de fevereiro de 2015
Places I've visited :)
visited 9 states (4%)
Create your own visited map of The World or Triposo world travel guide for Android
domingo, 5 de outubro de 2014
Transform matrix in a vector - Python using numpy
1 a = np.arange(10).reshape(2,5)
2 print a
3 a = a .ravel
4 print a
_____________________________________________________
2: array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]])
2 print a
3 a = a .ravel
4 print a
_____________________________________________________
2: array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]])
4: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
quarta-feira, 1 de outubro de 2014
numpy ndarray to cvmat
1 import cv
2 print type(image)
3 new_image = cv.fromarray(image)
4 print type(new_image)
______________________________________________________:
2: cv2.cv.cvmat
4: type 'numpy.ndarray
Ternary operator python - Operador ternário python
>>> a = (False,True)[True]
>>> a
True
>>> a = (False,True)[False]
>>> a
False
>>> a= (False, True) [3%2 == 0]
False
>>> a
True
>>> a = (False,True)[False]
>>> a
False
>>> a= (False, True) [3%2 == 0]
False
Assinar:
Postagens (Atom)