You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use tiago camera for feature extraction/matching. To test the image received from tiago camera, I write the following scripts. It may be a dirty code, I just wanted to see the result quickly.
```
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import Point
from std_msgs.msg import Int16
from sensor_msgs.msg import Image, CameraInfo
import cv2
import numpy as np
class SaveImg(Node):
def __init__(self):
super().__init__('save_img')
self.subscription_1 = self.create_subscription(Image,'/head_front_camera/rgb/image_raw',self.save_img,10)
self.subscription_2 = self.create_subscription(CameraInfo,'/head_front_camera/rgb/camera_info',self.print_camera_info,10)
def save_img(self, msg):
img = np.asarray(msg.data).reshape(msg.height,msg.width,3)
self.get_logger().info(str(img.shape))
res = cv2.imwrite("1.jpg", img)
self.get_logger().info('image saved ?: "%s"' % res)
def print_camera_info(self, msg):
self.get_logger().info('K matrix: "%s"' % msg.k)
self.get_logger().info('D matrix: "%s"' % msg.d)
self.get_logger().info('height: "%s"' % msg.height)
self.get_logger().info('width: "%s"' % msg.width)
self.get_logger().info('distortion_model: "%s"' % msg.distortion_model)
def main(args=None):
rclpy.init(args=args)
node = SaveImg()
rclpy.spin(node)
# Destroy the node explicitly
# (optional - otherwise it will be done automatically
# when the garbage collector destroys the node object)
node.destroy_node()
rclpy.shutdown()
if __name__ == '__main__':
main()
```
However, seems like render range of the camera is very short.
Is there any way to fix it ?
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to use tiago camera for feature extraction/matching. To test the image received from tiago camera, I write the following scripts. It may be a dirty code, I just wanted to see the result quickly.
However, seems like render range of the camera is very short.
Is there any way to fix it ?
The text was updated successfully, but these errors were encountered: