The Disparity-To-Depth node can be used to convert disparity values generated by the Disparity Solver node into a depth map for both the left and right-eyes of a stereo pair. These depth maps can then be edited or exported for further use.
The screengrabs below show a grey-scale depth map on the left which was generated from the disparity map shown in the top-left corner, and a 3D perspective view of the depth map generated from a different camera position. The left and right-eye frustums used to convert disparity to depth can also be seen in the image.
Note that in this case, disparity values were not generated for the green-screen pixels because a mask was applied to each eye (see the Disparity Solver documentation for further details).
When converting to a depth map, the same masks were enabled in the Disparity-To-Depth node. This has the effect of automatically assigning the far-plane depth value to each masked pixel.
The Disparity-To-Depth node requires a properly positioned stereo camera to convert disparity to depth values at each pixel. The stereo camera can be generated in several ways: either by tracking left and right-eye clips using the Stereo Camera Solver node, or by using the Build Stereo Camera node. An example tree is shown below, where the matchmoving nodes have been used to track the left-eye camera and the Build Stereo Camera node has been used to produce the right-eye. Disparity for the clip was then calculated using the Disparity Solver node before being converted to a depth map in each eye using the Disparity-To-Depth node.
Using the left and right-eye camera positions at each frame, the disparity value at each pixel will be converted automatically to a depth value, and clamped between the near plane and far plane parameters. The resulting depth map is displayed as an overlay in the Cinema window. The Transparency and Grey-scale gamma parameters can be used to adjust the way the grey-scale map is displayed (note, this will not change the actual depth values, only how they are displayed).
Note that if the disparity values have been corrected before conversion to depth using the Keystone Fix node, the resulting depth values may not be accurate. This is because the transformation applied by the Keystone Fix node generates disparity values that no longer match a perspective camera. If keystone errors must be corrected, it is recommended that this is done after the disparity values are converted into depth maps. The Keystone Fix node will apply the same transformation to each depth map.
Masks can be enabled for each eye in the Disparity-To-Depth node. Pixels that are covered by a mask will be assigned a depth value equal to the far-plane depth.
Current clip: This menu can be used to change between displaying the left or right-eye of the stereo pair.
Near plane: This edit box specifies the distance of the near plane from the camera. Depth values will be generated between the near and far planes. Depth values at the near plane will be coloured white in the grey-scale overlay.
Far plane: This edit box specifies the distance of the far plane from the camera. Depth values will be generated between the near and far planes. Depth values at the far plane will be coloured black in the grey-scale overlay.
Ignore occluded pixels: When this option is enabled, pixels that are occluded in the disparity map will not be converted to a depth value, leaving a hole in the depth map.
Fill occluded pixels: When this option is enabled, the depth values for occluded pixels will be filled using data from nearby pixels. This option is only available when occluded pixels are not being ignored.
Edit ROI: Clicking this button will allow the region of interest to be adjusted in the Cinema window using the left mouse button.
Viewer proxy: This controls the resolution used to display triangular meshes and point clouds in 3D viewer windows. For high resolution images, selecting Half, Third or Quarter will increase rendering performance.
Transparency: This edit box controls the amount of transparency that is used to display a grey-scale depth map in the Cinema window.
Grey-scale gamma: This edit box controls the amount of gamma correction that is used to display a grey-scale depth map in the Cinema window.
Depth cut %: This edit box specifies the difference in depth values (as a percentage of the distance between the near and far camera planes) at which triangular mesh edges will be cut when displaying the depth map in 3D viewer windows. Note that this option is for display purposes only and does not affect the depth map being passed down-stream from the node.
Show ground: When enabled, the ground-plane will be displayed.
Show trackers: When enabled, 3D tracker positions will be displayed.
Show frustum: When enabled, the camera frustum for the near and far planes will be displayed in the 3D viewer windows.
Show path: When enabled, the camera path will be displayed in the 3D viewer windows.
Show ROI: Enabling this option will display the current region of interest in the Cinema window.
Default Keyboard Shortcuts
|Ignore Occluded Pixels||Shift+O|
|Fill Occluded Pixels||Shift+F|