This is indeed a simple problem if tried to be tackled using semantic segmentation. Semantic segmentation itself is a computer vision problem that could be understood as an extension of object detection and could be understood as follows:
Using semantic segmentation done using a network called as UNET, the model could be trained for the required image and then it can be extended to find the boundary of the required object and finally extract it. UNET architecture could be understood using the following diagram:
UNET's are generally used to create mask that could be XOR with the actual image and the background of the image could be subtracted easily.
Completely explaining image segmentation using UNET or any other technique falls beyond the limit of the answer and thus a better explanation could be found in this article
If you want the practical implementation/codes of the same, they could be found here on kaggle kernels of the following contests:
- TGS Salt Identification Challenge
- Carvana Image Masking Challenge