Class Midas
A class that allows to run Midas models to do monocular depth estimation.
Implements
Inherited Members
Namespace: Doji.AI.Depth
Assembly: .dll
Syntax
public class Midas : IDisposable
Constructors
Midas(ModelType)
Initializes a new instance of MiDaS.
Declaration
public Midas(ModelType modelType = ModelType.midas_v21_small_256)
Parameters
Type | Name | Description |
---|---|---|
ModelType | modelType |
Midas(ModelAsset)
Declaration
public Midas(ModelAsset modelAsset)
Parameters
Type | Name | Description |
---|---|---|
ModelAsset | modelAsset |
Properties
Backend
Which BackendType to run the model with.
Declaration
public BackendType Backend { get; set; }
Property Value
Type | Description |
---|---|
BackendType |
ModelType
Which of the MiDaS models to run.
Declaration
public ModelType ModelType { get; set; }
Property Value
Type | Description |
---|---|
ModelType |
NormalizeDepth
Whether to normalize the estimated depth.
Declaration
public bool NormalizeDepth { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
MiDaS predicts depth values as inverse relative depth. (small values for far away objects, large values for near objects) If NormalizeDepth is enabled, these values are mapped to the (0, 1) range, which is mostly useful for visualization.
Result
A RenderTexture that contains the estimated depth.
Declaration
public RenderTexture Result { get; set; }
Property Value
Type | Description |
---|---|
RenderTexture |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
EstimateDepth(Texture, bool)
Declaration
public void EstimateDepth(Texture input, bool autoResize = true)
Parameters
Type | Name | Description |
---|---|---|
Texture | input | |
bool | autoResize |
GetMinMax()
Returns the minimum and maximum values of the last depth prediction.
Declaration
public (float min, float max) GetMinMax()
Returns
Type | Description |
---|---|
(float min, float max) |
Remarks
Keep in mind that the predictions are relative inverse depth values, i.e. min refers to the furthest away point and max to the closest point.