MATLAB: How to display pair image (One RGB and other binary)

eyefundusimage displayimage processingophthalmologyretina

Surprise, when I want to pair display of two images, one is RGB and other binary, Matlab showed some error. It perfectly works with gray and binary. Any idea to do this, one must RGB and other binary.I have attached one image for your kind reference.
%Pair Display
k=imread('02_dr.jpg');
k1=rgb2gray(k);
k2=im2bw(k1);
result=[k,k2];
imshow(result);
%end

Best Answer

Try this:
rgbImage = imread('02_dr.jpg');
grayImage = rgb2gray(rgbImage);
binaryImage = uint8(im2bw(grayImage));
result=[rgbImage, cat(3, binaryImage, binaryImage, binaryImage)];
imshow(result);
And see section 20.5 here in Vision Bib for much better algorithms that you're using.