I am not getting all the images as output in my code.Please help me.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Roshni gupta
le 14 Août 2017
Commenté : Walter Roberson
le 14 Août 2017
I want to get 4 images as my output.
- Original image
- Enhanced image
- Binarized image
- 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..
0 commentaires
Réponse acceptée
Walter Roberson
le 14 Août 2017
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.
6 commentaires
Image Analyst
le 14 Août 2017
It pops up a brand new window. When you call imshow(), the image will then appear on this new window instead of the old/prior window.
Walter Roberson
le 14 Août 2017
You can also use subplot(), and there are various ways of putting multiple images in the same axes.
Plus de réponses (1)
Image Analyst
le 14 Août 2017
By the way, equalisedimage will most likely be a bizarre looking image. And since you don't use it, don't compute it. histeq() is bad enough on a gray scale image, but on a color image, it will just be nonsense.
Also be aware that bw and BW are different variables since MATLAB is case sensitive.
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!