MATLAB: I am not getting all the images as output in the code.Please help me.

digital image processing

I want to get 4 images as my output.
  1. Original image
  2. Enhanced image
  3. Binarized image
  4. Hough transform image
But after running the below code, I am getting only binarized image and hough tranform image as my output. Can anyone please help me solving that.
code:-
rgbimage = imread('2.jpg');
imshow(rgbimage);
equalisedimage = rgbimage;
for channel = 1:3
equalisedimage(:, :, channel) = histeq(rgbimage(:, :, channel)); %apply histogram equalisation to each channel
end
imshow(equalisedimage);
% imshowpair(rgbimage, equalisedimage, 'montage');
%image_binarization
[X,map] = imread('2.jpg');
binarizedimage=imshow(X,map);
%title('Original indexed image');
bw = im2bw(X,map,0.5);
imshow(bw);
%houghtransform
RGB = imread('2.jpg');
I = rgb2gray(RGB);
BW = edge(I,'canny'); %canny is a method to find edges
[H,T,R] = hough(BW, 'Theta', 44:0.5:46);
figure
imshow(imadjust(mat2gray(H)),'XData',T,'YData',R,...
'InitialMagnification','fit');
% title('Limited Theta Range Hough Transform of Gantrycrane Image');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal;
colormap(gca,hot)
%houghtransform..

Best Answer

Your code does three imshow() using the same implicit current axes. The second imshow() erases the first one; the third imshow() erases the second one. After the third imshow() you figure() and so create a new implicit current axes for the transformed image to be displayed in, so that one does not erase the previous one.
You should either be using figure() to show each image in its own figure, or you should be using subplot() to put them in different axes on the same figure, or you should be taking steps to display them all in a single axes, similar to the imshowpair() that is commented out.