MIDAS

class grid.model.perception.depth.midas.MIDAS(*args, **kwargs)

MIDAS: Depth Estimation Model

This class implements a wrapper for the MIDAS model, which estimates depth maps from RGB images using the DPTForDepthEstimation model.

Credits:

https://github.com/isl-org/MiDaS

License:

This code is licensed under the Apache 2.0 License.

__init__()

Initialize the MIDAS model with the specified configuration.

The model is loaded onto the GPU if available, otherwise it defaults to the CPU.

Return type:

None

run(rgbimage)

Runs the MIDAS depth estimation model on the given RGB image.

Parameters:

rgbimage (np.ndarray) -- The input RGB image.

Returns:

The predicted depth map.

Return type:

np.ndarray

Example

>>> img = np.random.randint(0, 255, (256, 256, 3)).astype(np.uint8)
>>> midas = MIDAS()
>>> depth = midas.run(img)
>>> print(depth.shape)