Replace Color of Components that have specific color and are have transparent pixels as neighbours
Hello, I recently started with opencv and i need a color-replacement logic for image processing. My Images are RGB with transparent background. (I think this is the main reason i struggle)
What i want to do:
- Search for groups that only exist of 0xFFF (White)
- Replace them with 0x000 (Black), but only if the shape has a transparent pixel as a neighbour.
I tried working with connectedComponentsWithStats but the problem is it does not work with rgb + transparent images.
Does anyone have an idea and a hint for me how I could start?
Which methods/algorithms do you recommend for me?
I'm thankful for any kind of help!
Cheers Stefan
is this a homework?
No, It's for my business. I have t-shirts designs that contain animal illustration and a text. I want to invert the color of the text (which is white), but keep animal eyes in white.
Want to automate this process with opencv. Currently i'm doing it by hand in photoshop.
But you are right, it sounds like a homework hehe. I'm just asking for inspiration how I can solve my problem and which algorithms could work out of the box for this problem.
do you provide a real image and a result you get from photoshop
Yes, I added a sample of what i'm trying to do in detail.
i will try to suggest a solution when i find a free time
@Equintox could you provide a sample image that have real alpha channel
here is a sample: https://i.ibb.co/NF15HHm/3903-lloyd-c...