Remove background of photographic Image

Windows specific forum
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Remove background of photographic Image

Post 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?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Remove background of photographic Image

Post by Saki »

I understand not the question ?
地球上の平和
BarryG
Addict
Addict
Posts: 3268
Joined: Thu Apr 18, 2019 8:17 am

Re: Remove background of photographic Image

Post by BarryG »

Saki wrote:I understand not the question ?
He wants to know how to make your avatar look like this, by using code:

Image
BarryG
Addict
Addict
Posts: 3268
Joined: Thu Apr 18, 2019 8:17 am

Re: Remove background of photographic Image

Post 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
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Remove background of photographic Image

Post 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.

Image
地球上の平和
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Remove background of photographic Image

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Remove background of photographic Image

Post 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%
地球上の平和
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Remove background of photographic Image

Post 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
Image
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Remove background of photographic Image

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8422
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Remove background of photographic Image

Post by netmaestro »

You can use Vector Curve Designer for that.
BERESHEIT
Post Reply