Gimp-Forum.net
Remnants left when deleting background using foregorund select - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Remnants left when deleting background using foregorund select (/Thread-Remnants-left-when-deleting-background-using-foregorund-select)



Remnants left when deleting background using foregorund select - Brimfulof - 08-25-2020

This seems like it should be a standard use, so I'm sure this is just a setting I'm missing, but I can't figure this out. Any suggestions appreciated.
I have a group of photos of people taken against a blue background (although it's not completely uniform). I want to remove the backgrounds, so I just have the images as cutouts.
I've used the foregorund select tool to create a selection around the person, but whatever I do to then delete the background, some remnants of the blue remain. These are outside of the selection line, so I'm not sure why they are not deleted. Images below illustrate what I mean.
What I have tried:
  1. Foreground select (based on Compound colours).
  2. Remove holes.
  3. Cut the selection.
  4. Paste to new layer.
  5. Delete old layer.
Also:
  1. Foreground select (based on Compound colours).
  2. Invert the selection.
  3. Remove holes.
  4. Add alpha channel to the layer.
  5. Delete the (inverted) selection.
Selection created - line is where I want it to be.



[Image: 4cgbkmdxhwi51.png?width=441&format=png&a...602ff3c0e1]

Selection created - line is where I want it to be.

[Image: hxnfakt1iwi51.png?width=451&format=png&a...4665aad4d3]

Selection inverted and deleted - remnants remain inside the (inverted) selection line.

[Image: afhtllu6iwi51.png?width=458&format=png&a...3c41fdd122]


RE: Remnants left when deleting background using foregorund select - rich2005 - 08-25-2020

Just out of interest, what do you mean by "compound colours" ? RGB maybe? Are you using a higher bit depth?

Foreground select, not my favourite tool Wink

In the tool options do you have Feather edges enabled and is it a big size (default I think is 10) You do not actually see the extent of the feather, it might encompass those stray pixels.

Which engine are you using? The one favoured by the developers now is Matting Levin but it does make for semi-transparent borders. I still prefer Matting Global.

If the selection is not much feathered, once inverted, shrink the selection by 3 or 4 pixels, fill the background with white to make it opaque, grow the selection back 3 or 4. Cut the selection.


RE: Remnants left when deleting background using foregorund select - Brimfulof - 08-30-2020

(08-25-2020, 05:16 PM)rich2005 Wrote: Just out of interest, what do you mean by "compound colours" ? RGB maybe?  Are you using a higher bit depth?

Whoops, that's my mistake (in fact two mistakes): I had also tried to select the background by colour and with fuzzy select, using the 'Composite' se;ect by mode. So that was a word I'd remembered incorrectly, for a different tool!

Foreground select, not my favourite tool Wink

In the tool options do you have Feather edges enabled and is it a big size (default I think is 10) You do not actually see the extent of the feather, it might encompass those stray pixels.

No, this was turned off.

Which engine are you using?  The one favoured by the developers now is Matting Levin but it does make for semi-transparent borders. I still prefer Matting Global.

I was using Global, but switched to Levin and seemed to get better results.

If the selection is not much feathered, once inverted, shrink the selection by 3 or 4 pixels, fill the background with white to make it opaque, grow the selection back 3 or 4. Cut the selection.

The problem I had with both filling and cuting was that these areas did not seem to be part of the selection, even though they were beyond the selection line.



RE: Remnants left when deleting background using foregorund select - rich2005 - 08-31-2020

Not really possible to give any definitive answer. Looking at your second screenshot - where the foreground is cut I do not see why those artifacts remain - never come across that before. They look like a separate layer. If you can post an example image somewhere, Dropbox or similar, you might get a more positive answer.

You could try a different approach. Whichever way I make the selection. Apply that selection to a layer mask, Layer -> Mask -> Add Layer Mask Use the from selection option. Then tidy the mask up, there are always edges to tidy up, painting out those defects is just another added operation.

Edit: This is how I might attack it.

screenshots: https://i.imgur.com/WEcTW8Y.jpg

(1) Made with FG Select and Matting Levin option. It does create a 'semi-transparent border, that is the 'unknown region' and intentional. Meant to capture the holy-grail of portraits, that stray hair. Never works for me. However I use the selection to create a layer mask. Sometimes a black or dark grey temporary layer underneath helps.

(2) I can see the occasional 'small-island' of the selection in (1) so I shrink the selection by 2 or 3 pixels to 'collapse' those areas.

https://i.imgur.com/n8YLxXc.jpg

(3) With the layer mask active and with the selection inverted, I can work on the background Black opaque, White transparent, Greys produce semi-transparency. Paint in black with large brush any areas in the back ground.

(4) Carefully paint in around the selection, it is not a border as-in-a-wall, there is feathering. After that up to you. I turn off any selection, and tidy up the Foreground border with a fuzzy brush. The X key is there for this, toggles between FG and BG colour, for paint-in / paint-out.