3

I'm trying to implement a python program to remove the background and extract the object/objects in the foreground from any given static image (as shown in the attached images). This is similar to "iPhoneX Portrait Effect" or "Bokeh Effect". However, instead of blurring the background one needs to completely remove it.

In short, I want to extract objects from any given image and also create a mask. Below are the examples of both respectively:

Object Extraction:

Object Extraction

Image Mask:

enter image description here

I have somewhere listened to Google's DeepLab, but I don't know how to start with it.

Can someone help me, please! Any step by step tutorial will be very appreciated.

Thanks in advance!

Abdul Rehman
  • 5,326
  • 9
  • 77
  • 150
  • This is a really hard task, there is a reason there are basically no good software to do this already, even in photoshop this is a struggle. I can advice you to start with open Cv and their implemented facial tracking which you may need to configure to work with animals if thats your goal – Stanley Aug 28 '18 at 06:10
  • Hi @Stanley, any resource for OpenCV facial tracking? please! – Abdul Rehman Aug 28 '18 at 06:27
  • posted as answer – Stanley Aug 28 '18 at 07:16

2 Answers2

0

This is a really hard task, there is a reason there are basically no good software to do this already, even in photoshop this is a struggle. I can advice you to start with open Cv and their implemented facial tracking which you may need to configure to work with animals if thats your goal

resources

facial detection:
https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html#face-detection

object detection:
https://docs.opencv.org/2.4/modules/contrib/doc/facerec/facerec_tutorial.html

Stanley
  • 2,434
  • 18
  • 28
0

Firstly you should collect data(image) for which object you want to detect or extract the object/objects in the foreground and also create a mask.

Then using tensorflow you can train an instance segmentation model Using your own dataset. (Ref : instance_segmentation)

After getting mask you can extract the foreground.

Tanmoy Ghosh
  • 82
  • 10
  • Hi @Tanmoy Ghosh, I have used Google's DeepLab V3 for segmentation and created the Image Mask but now I need to create the mask a separate Image, take a look at this question: https://stackoverflow.com/q/52113864/7644562, please! – Abdul Rehman Aug 31 '18 at 11:55