Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a Binary Image to Grayscale and RGB using python?

I am working on hair removal from skin lesion images. Is there any way to convert binary back to rgb?

Original Image:

enter image description here

Mask Image:

enter image description here

I just want to restore the black area with the original image.

like image 744
codelearn22 Avatar asked Mar 01 '26 02:03

codelearn22


1 Answers

As I know binary images are stored in grayscale in opencv values 1-->255.

To create „dummy“ RGB images you can do: rgb_img = cv2.cvtColor(binary_img, cv.CV_GRAY2RGB)

I call them „dummy“ since in these images the red, green and blue values are just the same.

like image 59
Daniel Tremer Avatar answered Mar 02 '26 15:03

Daniel Tremer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!