Airsim: Depth Images Types

Created on 9 Oct 2018  路  1Comment  路  Source: microsoft/AirSim

What are the differences among DepthVis, DepthPerspective and DepthPlanner images types?

Running a testing code that takes images from the three types are generating the same image.

image_request = [
    #DepthPerspective
    airsim.ImageRequest(camera_name, airsim.ImageType.DepthPerspective,False,False),
    #DepthPlanner
    airsim.ImageRequest(camera_name, airsim.ImageType.DepthPlanner,False,False),
    #DepthVis
    airsim.ImageRequest(camera_name,airsim.ImageType.DepthVis,False,False),
    #Infrared
    airsim.ImageRequest(camera_name,airsim.ImageType.Infrared,False,True)
]
responses =  test_client.simGetImages(image_request)

tmp_dir = os.path.join(tempfile.gettempdir(), "airsim_drone")
print ("Saving images to %s" % tmp_dir)
try:
    os.makedirs(tmp_dir)
    except OSError:
if not os.path.isdir(tmp_dir):
    raise

for idx, response in enumerate(responses):

     filename = os.path.join(tmp_dir, str(idx))

     if response.pixels_as_float:
          print("Type %d, size %d" % (response.image_type, len(response.image_data_float)))
         airsim.write_pfm(os.path.normpath(filename + '.pfm'), airsim.get_pfm_array(response))
    else response.compress: #png format
        print("Type %d, size %d" % (response.image_type, len(response.image_data_uint8)))
        airsim.write_file(os.path.normpath(filename + '.png'), response.image_data_uint8)
question

Most helpful comment

There is more details given on DepthVis, DepthPerpective and DepthPlanner here: https://github.com/Microsoft/AirSim/blob/master/docs/image_apis.md#what-does-pixel-values-mean-in-different-image-types

To summarise,

DepthVis gives you an image that helps depth visualization. In this case, each pixel value is interpolated from black to white depending on depth in camera plane in meters. The pixels with pure white means depth of 100m or more while pure black means depth of 0 meters.

DepthPerspective is where each pixel is given a value corresponding to the smallest distance from the camera to that point.

DepthPlanner is a small bit trickier to explain. If you imagine an very large plane intersecting the cameras origin parallel to the image plane, then each pixel is given a value corresponding to the perpendicular distance to that plane.

>All comments

There is more details given on DepthVis, DepthPerpective and DepthPlanner here: https://github.com/Microsoft/AirSim/blob/master/docs/image_apis.md#what-does-pixel-values-mean-in-different-image-types

To summarise,

DepthVis gives you an image that helps depth visualization. In this case, each pixel value is interpolated from black to white depending on depth in camera plane in meters. The pixels with pure white means depth of 100m or more while pure black means depth of 0 meters.

DepthPerspective is where each pixel is given a value corresponding to the smallest distance from the camera to that point.

DepthPlanner is a small bit trickier to explain. If you imagine an very large plane intersecting the cameras origin parallel to the image plane, then each pixel is given a value corresponding to the perpendicular distance to that plane.

Was this page helpful?
0 / 5 - 0 ratings