Loading... # OriginCar Ros2 图像捕获工具 ```python #!/usr/bin/env python # -*- coding: utf-8 -*- import rclpy, cv2, cv_bridge, numpy from rclpy.node import Node from sensor_msgs.msg import Image import time class Shooter(Node): def __init__(self): super().__init__('image_shooter') self.bridge = cv_bridge.CvBridge() self.image_sub = self.create_subscription(Image, '/image', self.image_callback, 10) self.timer = self.create_timer(0.5,self.timer_callback) self.image = numpy.matrix(0) self._last_shot_time = time.time() self.get_logger().info("Image shooter init finished.") def timer_callback(self): current_time = time.time() write_file_path = "/root/img/{}.jpg".format(current_time) cv2.imwrite(write_file_path,self.image) self.get_logger().info("Shot at {0}, save to {1}.".format(current_time,write_file_path)) def image_callback(self, msg): self.image = self.bridge.compressed_imgmsg_to_cv2(msg,"bgr8") def main(args=None): rclpy.init(args=args) shooter = Shooter() rclpy.spin(shooter) shooter.destroy_node() rclpy.shutdown() if __name__ == '__main__': main() ``` © 允许规范转载 赞 1 富婆饿饿饭饭
1 条评论
[...]一种基于Resnet的图像巡线丢线检测算法摘要Resnet是一种常见的神经网络结构,常被使用于图像分类和特征提取。前人研究将其用于提取图片黑线特征点提取,输出特征点坐标,在具有神经网络加速硬件的环境实现高效的寻迹算法。而在一些场景中,图片中可能不存在黑线,而网络仍然有特征点的输出,这违背特征点提取的初衷。使用其他计算机视觉的方法检测特征点会失去Resnet高效的优点。本研究解决这一困境,结合Res[...]