Image background

Hello community

Is there any function that makes me know the background color of an image ?

Thnx a lot

Hello @Amani_Boukadidaaa
please explain your query with more detail.

1 Like

i want to detect the background color of an image

do you happen to have any sample images ?

1 Like

yeah i have a photo and the background should be white
That’s why i want a function that detect the color of the background

Hi @Amani_Boukadidaaa,

There a no inbuilt function/s within UiPath to identify or segment a background in the image.

Building an image background estimater / segmenter is quite a complex problem.
Inorder to know where and what is the background, in each image we should be able to detect and segment the object in focus. For example a person sitting and a background of a mountain. Only if you can segment the person, can you segment the background.

Typical example is video bluring of the background in a Teams meeting.

Your best bet is to start with Open CV in python, but soon you will realize the background extracter will be quite limited when you introduce different images.

If you further use Machine Vision based background extracters then you will have to train the model with what is background and what is the foregroun object in focus in your use-case. It is very easy to set this up, but to validate its metrics is another ball game.

In summary depending on your case, you need to investigate further if it is worthwhile implementing this yourself.

As a start you could try if the inbuilt Windows 365 feature helps you remove background, but then again this will remove background not get you the background: Remove the background of a picture (microsoft.com)

1 Like

i see thank you

@Amani_Boukadidaaa
this might help you out
instead of whole image, take only certain portion of image like top left or top right

https://www.codeproject.com/Questions/677506/Csharp-find-the-majority-color-of-an-image

1 Like