I am not getting all the images as output in my code.Please help me.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2017-8-14
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 个评论
Image Analyst
2017-8-14
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
2017-8-14
You can also use subplot(), and there are various ways of putting multiple images in the same axes.
更多回答(1 个)
Image Analyst
2017-8-14
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!