Foreground extraction

asked 2019-10-18 06:50:37 -0500

Hi All,

I am having an image as enclosed taken through a DSLR camera but its background is also seen on which the object is placed. I want to crop the object from the background.

I tried a variety of solutions available ie., .using openCV methods like foreground extraction using grabcut, image threshholding and masking, edge detection with unsatisfactory results.

Please suggest the right approach.

Thanks in advance, Michael image description image description

edit retag flag offensive close merge delete


Well this is called object detection - you can do this using the dnn module of opencv. Like here

Handwritten Algorithms tend to miss some corner cases - so in the end the guys invented an algorithm to create an algorithm(The good old meta game we play....). This process is called "training" and belongs to the area of machine learning. You are programming "by data". Selecting the right variation and kind of data requires some experiences - but its no magic.

The thing is that for your object - you will have to train a model - because your object is too "custom" to be contained in pretrained models. Training cannot be done in opencv - only detection

And dont pressure yourself too much - this area is still a bit new,

holger gravatar imageholger ( 2019-10-18 17:59:33 -0500 )edit