Converting ImageSegment to OpenCV

(Vishal R) #1

I have a model for image segmentation. When I make a prediction, it returns an ImageSegment object. I need to convert the generated mask to an OpenCV image. How do I achieve that?

0 Likes

(Zachary Mueller) #2

Your ImageSegement object has a .save() method, and you can then convert it from the PIL to a OpenCV as described here:

One option

0 Likes

(Vishal R) #3

I don’t want to save and load the image. I’m trying to build a small pipeline in which I have to process the segmented image using open cv. Since it is binary segmentation, I am having trouble converting the predicted ImageSegment object (size: (256, 256, 1)) to an opencv image.

0 Likes