Object segmentation using the Watershed and GrabCut algorithms
Calculating a disparity map can be very useful to detect the foreground of an image, but StereoSGBM
is not the only algorithm available to accomplish this, and in fact, StereoSGBM
is more about gathering 3D information from 2D pictures, than anything else. GrabCut, however, is a perfect tool for this purpose. The GrabCut algorithm follows a precise sequence of 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 Gaussians Mixture Model (GMM
Get Learning OpenCV 3 Computer Vision with Python - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.