1 | initial version |
Maybe post a sample image to get a better idea of your plroblem. The example code assumes that background has been segmented already and then proceeds to separate the objects individually because they are ocludded and form one big foreground blob. So If you already know which pixels are BG is just a matter of removing them from the resulting segmentation.