Image segment to PNG with transparent background

Hello, I have an interesting problem. I have an image of a leaf. I am able to segment and get the leaf. I would like to extract the segment into a transparent background png. I have included the image I am using.

I can isolate and convert the binary mask/segment to a png, but it still shows black background and white segment. I would like to be able to change the color of the segment and remove the background. Is this even possible?

A little more detail. I would like to eventually be able to replicate the Interactive Segmentation View by using javascript, so I can display the solution using the Web Server. I also want the user to be able to move and resize the segment label. I have the javascript code to do this, I just am unable to obtain the segment with a transparant background.

Hi @rbjacob1 , would you be able to share the workflow you are using so we can investigate?

Please be sure to tag my name with the @ sign so that I get an alert of your response. Thank you very much!

2 Likes

@victor_palacios

Yes I can attach a sample workflow. What I want is to be able to display the largest segment with the holes filled to intimate what the computer is able to detect as a completed leaf. The problem lies when I go to layer them on a javascript canvas in a generic javascript view node, I am unable to remove the background of the label/segment.

Thanks
Test-Image2.knwf (43.8 KB)

Hi @rbjacob1 , I’ve also tried my hand at this and could not find a suitable solution. I’ve asked internally but it seems at the moment we are stumped. I will follow up if anyone internal chimes in.

This may be helpful: Introduction to KNIME for Image Processing 1 of 2 -- [NEUBIAS Academy@Home] Webinar - YouTube

Best,
KNIME Team

1 Like

Hi @rbjacob1
You can use Labeling to RGB Img node to combine your source labeling with a background image. However, this requires your labeling to have the same dimensions as the background image you want to merge it with.
best,
Gabriel

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.