I am not getting all the images as output in my code.Please help me.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Roshni gupta
am 14 Aug. 2017
Kommentiert: Walter Roberson
am 14 Aug. 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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 14 Aug. 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 Kommentare
Image Analyst
am 14 Aug. 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
am 14 Aug. 2017
You can also use subplot(), and there are various ways of putting multiple images in the same axes.
Weitere Antworten (1)
Image Analyst
am 14 Aug. 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.
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!