I want to separate the white pixel data from this binary image and convert it back to the rgb image for further use.
What I undestood (and certainly sure), you want to mask the binary image on RGB Image. No need to ectract the white pixels from Binary Image (just index position of white pixels is sufficient). You can directly apply it on RGB Image. In the following example, forced the pixels to those in RGB Image, where mask (Binary Image) represents as white pixels.
RGBImage=imread('image_test.jpg');
subplot(131),imshow(RGBImage),title('RGB Image');
grayImage=rgb2gray(RGBImage);
bwImage=im2bw(grayImage,0.7);
subplot(132),imshow(bwImage),title('Binary Image-Mask');
mask=cat(3,bwImage, bwImage,bwImage);
RGBImage(mask)=0;
subplot(133),imshow(RGBImage),title('RGB with Black White Mask Area');
Hope it helps!
Best Answer