コード例 #1
0
 def convert_depth_from_source_to_agent(
         self, source: carla.Image) -> Union[DepthData, None]:
     """Convert CARLA raw Image to a Union with Depth numpy array."""
     try:
         array = np.frombuffer(source.raw_data, dtype=np.dtype("uint8"))
         array = np.reshape(array, (source.height, source.width, 4))  # BGRA
         array = array[:, :, :3]  # BGR
         array = array[:, :, ::-1]  # RGB
         array = png_to_depth(array)
         return DepthData(data=array)
     except:
         return None
コード例 #2
0
ファイル: jetson_bridge.py プロジェクト: wuxiaohua1011/ROAR
    def convert_depth_from_source_to_agent(self,
                                           source) -> Optional[DepthData]:
        """
        Convert Jetson raw Image to an Optional with Depth numpy array.
        Args:
            source ():

        Returns:
            DepthData
        """
        if source is not None:
            depth_data = DepthData(data=source / np.amax(source))
            return depth_data
        return None
コード例 #3
0
 def convert_depth_from_source_to_agent(
         self, source: carla.Image
 ) -> Union[DepthData, None]:
     """Convert CARLA raw depth info to """
     try:
         array = np.frombuffer(source.raw_data, dtype=np.dtype("uint8"))
         array = np.reshape(array, (source.height, source.width, 4))  # BGRA
         array = array[:, :, :3]  # BGR
         array = array[:, :, ::-1]  # RGB
         # array = array.swapaxes(0, 1)
         array = png_to_depth(array)
         # print(array[350][160], array[350][688])
         return DepthData(data=array)
     except:
         return None
コード例 #4
0
 def convert_depth_from_source_to_agent(self,
                                        source) -> Optional[DepthData]:
     if source is not None:
         return DepthData(data=source)
     return None
コード例 #5
0
ファイル: ios_bridge.py プロジェクト: wuxiaohua1011/ROAR
 def convert_depth_from_source_to_agent(self,
                                        source: np.ndarray) -> DepthData:
     return DepthData(data=source)