Calculating a disparity map is a useful way to segment the foreground and background of an image, but StereoSGBM is not the only algorithm that can accomplish this and, in fact, StereoSGBM is more about gathering three-dimensional information from two-dimensional pictures than anything else. GrabCut, however, is a perfect tool for foreground/background segmentation. The GrabCut algorithm consists of the following steps:
- A rectangle including the subject(s) of the picture is defined.
- The area lying outside the rectangle is automatically defined as a background.
- The data contained in the background is used as a reference to distinguish background areas from foreground areas within the user-defined rectangle.
- A Gaussian Mixture Model (GMM) models the foreground and background, and labels undefined pixels as probable background and...