Page 1 of 1
Remove background of photographic Image
Posted: Sat Apr 10, 2021 5:42 am
by IdeasVacuum
There are many programs available that can remove the background of a photo (with a bit of work of the User).
Has anyone written functions in PB to do this, where the image is set on a Canvas Gadget?
Re: Remove background of photographic Image
Posted: Sun Apr 11, 2021 11:08 am
by Saki
I understand not the question ?
Re: Remove background of photographic Image
Posted: Sun Apr 11, 2021 11:17 am
by BarryG
Saki wrote:I understand not the question ?
He wants to know how to make your avatar look like this, by using code:

Re: Remove background of photographic Image
Posted: Sun Apr 11, 2021 11:19 am
by BarryG
IdeasVacuum wrote:Has anyone written functions in PB to do this
The closest I've seen is by Dobro here ->
viewtopic.php?f=12&t=69613
Re: Remove background of photographic Image
Posted: Sun Apr 11, 2021 12:13 pm
by Saki
Ah, I see.
It always depends on whether it is a photo or an image, whether the crop should be rectangular or freely pixel-exact.
If the colors of the image and the background differ, you can have it done automatically.
In GFX_Wizzard_BF there is the function FloodFill_BF.
You can set a Color Distance value there, then everything in a certain color spectrum will be replaced with a color or transparency.
This corresponds to an outline calculation.
If there is no outline, this does not work, of course.
But this is not a small function that you can separate, because it is very, very complex and has dependencies.
A stamp function is quickly made, it also depends on whether it should be a copy stamp or an eraser.
That needs then still another magnifying glass or zoom.
So nothing that you can do just so quickly
The function "TextureBrush_canvas_BF" (Photo_merge.pb) can do this without a magnifying glass,
but it must be adapted to the requirements, it is only a function (With included stepples undo) and not a tool.

Re: Remove background of photographic Image
Posted: Sun Apr 11, 2021 1:55 pm
by IdeasVacuum
The closest I've seen is by Dobro here -> viewtopic.php?f=12&t=69613
That is a very nice solution, I can work with that, thanks BarryG.
Re: Remove background of photographic Image
Posted: Sun Apr 11, 2021 2:02 pm
by Saki
IdeasVacuum wrote:The closest I've seen is by Dobro here -> viewtopic.php?f=12&t=69613
That is a very nice solution, I can work with that, thanks BarryG.
It works not with scalings >100%
Re: Remove background of photographic Image
Posted: Sun Apr 11, 2021 4:08 pm
by JHPJHP
Hi IdeasVacuum,
It sounds like you have very specific requirements and have found a suitable method, so the following solution is for reference only.
The two methods I'm familiar with are
watershed segmentation and
grabcut segmentation.
Watershed Segmentation

Re: Remove background of photographic Image
Posted: Mon Apr 12, 2021 12:41 pm
by IdeasVacuum
It works not with scalings >100%
That is relatively easy to add, via the Vector Lib. This though is one of the areas where a 32bit Canvas supporting transparency and layers would be more fun.
Re: Remove background of photographic Image
Posted: Mon Apr 26, 2021 1:32 am
by netmaestro
You can use Vector Curve Designer for that.