In affine transformation, all parallel lines in the original image will still be parallel in the output image.
For perspective transformation, you need a 3x3 transformation matrix. Straight lines will remain straight even after the transformation.
Image Segmentation with Watershed Algorithm
Interactive Foreground Extraction using GrabCut Algorithm