Change all white pixels of image to transparent in OpenCV C++

Viewed 22587

I have this image in OpenCV imgColorPanel = imread("newGUI.png", CV_LOAD_IMAGE_COLOR);:

enter image description here

When I load it in with grey scale imgColorPanel = imread("newGUI.png", CV_LOAD_IMAGE_GRAYSCALE); it looks like this:

enter image description here

However I want to remove the white background or make it transparent (only it's white pixels), to be looking like this:

How to do it in C++ OpenCV ?

enter image description here

1 Answers
Related