5,337
edits
Line 54: | Line 54: | ||
To convert depth values to euclidean distance, you need to divide by \(\cos(\theta)\) where \(\theta\) is the angle to the center of the image. | To convert depth values to euclidean distance, you need to divide by \(\cos(\theta)\) where \(\theta\) is the angle to the center of the image. | ||
{{hidden | Z-depth to Euclidean depth | {{hidden | Z-depth to Euclidean Depth | | ||
Below is code to convert z-depth to euclidean depth for an equirectangular image stitched from cubemaps. | |||
Adapt it accordingly. | |||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
theta, phi = np.meshgrid((np.arange(width) + 0.5) * (2 * np.pi / width), | theta, phi = np.meshgrid((np.arange(width) + 0.5) * (2 * np.pi / width), |