【问题标题】:How to Recognize objects using camera on Webots如何在 Webots 上使用摄像头识别物体
【发布时间】:2020-02-06 19:33:49
【问题描述】:

我正在尝试使用https://robotbenchmark.net/ 上的摄像头进行高速公路驾驶,但我在理解摄像头和物体识别手册时遇到了一些困难。我已经能够使用 camera.getRecognitionObjects() 识别如下所示的一些对象,但我不明白如何获取特定对象的 id 和距离或位置。我试图帮助的是识别道路的线条,这样我就可以将汽车与道路对齐。 提前致谢。

   [highway_driving] 3
   [highway_driving] [<controller.CameraRecognitionObject; proxy of <Swig Object of type 'webots::CameraRecognitionObject 
*' at 0x7fb72c2233c0> >, <controller.CameraRecognitionObject; 
    proxy of <Swig Object of type 'webots::CameraRecognitionObject *' at 0x7fb72c2233f0> >, 
    <controller.CameraRecognitionObject; proxy of <Swig Object of type 'webots::CameraRecognitionObject *' at 0x7fb72c223420> >]

【问题讨论】:

    标签: webots


    【解决方案1】:

    这里是cameraRecognitionObject类的定义(https://www.cyberbotics.com/doc/reference/camera?tab-language=python#wb_camera_has_recognition

    from controller import CameraRecognitionObject
    
    class CameraRecognitionObject:
        def get_id(self):
        def get_position(self):
        def get_orientation(self):
        def get_size(self):
        def get_position_on_image(self):
        def get_size_on_image(self):
        def get_number_of_colors(self):
        def get_colors(self):
        def get_model(self):
    

    因此,一旦您调用 Camera.getRecognitionObjects,您将获得一个对象数组,并且您可以轻松获得 id 和位置(与相机相比):

    firstObject = Camera.getRecognitionObjects()[0]
    id = firstObject.get_id()
    position = firstObject.get_position()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-13
      • 2019-11-11
      • 1970-01-01
      • 2019-01-18
      • 1970-01-01
      • 1970-01-01
      • 2013-08-17
      • 1970-01-01
      相关资源
      最近更新 更多