Skip to content

Inputs

For using custom images or depthmaps, provide them to the input command or method:

from depthflow.scene import DepthScene

scene = DepthScene()
scene.input(image=..., depth=...)
# Also accepts URLs
$ depthflow input --image base.png (...)

Accepts: None | Path | Image | np.ndarray | str | BytesIO | bytesDefaults: None

Image

Main visual content in the scene. For better results, keep in mind and try to:

  • Use images with a clear central object, and smooth or far-away backgrounds.
  • Wires, fences, posts, hair threads, and small details will cause artifacts.
  • Use upscalers or denoisers to improve digital art sharpness.

Also, the scene's width and height will match the input for your convenience.

You should handle downloads caching with packages like requests-cache or pooch.

Depth

When no depthmap is provided, an estimator is used on the input #image.

For selecting a model, refer to the Estimators documentation.

A depthmap is a grayscale image where each pixel's intensity represents the distance between the camera and the scene at that point, also known as z-buffer in games/graphics. #wikipedia

Matching aspect ratios isn't required, coordinates are absolute.

Formats

There are two main formats for depthmaps:

  • Near is white: Seen on the image above, and what the depthflow math expects.
  • Near is dark: Inverse of the above, where near points are darker.

Units

And also three main types of values:

  • Metric: Values represent real-world distances, in meters, feet, etc.
  • Relative: Values can only be compared against each other reliably.
  • Normalized: Values are in a 0-1 range, loses proportions.

DepthFlow uses normalized, near is white values in its Camera parameters.