how to display images using subplot in right corner of gui

3 次查看(过去 30 天)
I = imread('11.jpg'); I = rgb2gray(I); m=1; srcFiles = dir('fruits\*.jpg'); % the folder in which ur images exists for j = 1 : 30
filename = strcat('fruits\',srcFiles(j).name);
filenam = strcat('fruits',srcFiles(j).name);
I = imread(filename);
%I=graythresh(I);
%I=imresize(I,[20,15]);
%fr=strcat('features',filenam,'.mat');
b=dlmread('features11.mat')
%b1=dlmread(fr)
b1=dlmread('frs.mat')
sum=0;
for i=1:8
g = (b(i) - b1(j,i))^2
sum=sum+g
end
dist = sqrt(sum);
E_dist(j)=dist
disp(E_dist);
sd=sort(E_dist)
if(E_dist(j) <.0061)
subplot(3,3,m)
imshow(I);
m=m+1;
end
end
%sd=sort(E_dist)

回答(2 个)

Dishant Arora
Dishant Arora 2014-6-20
h = subplot('position' , [0.7,0.7,0.2,0.2]) % [left bottom width height]
imshow(imageName , 'parent' , h);

Image Analyst
Image Analyst 2014-6-20
subplot(3,3,3) will be in the upper right corner. The others, with values of 1-2 and 4-9 in the third argument, will be displayed at the other locations of a 3 by 3 grid of images.
  2 个评论
Anamika baruah
Anamika baruah 2014-6-21
i dont understand your code..please give me code to display multiple image in gui in the right part using subplot
Image Analyst
Image Analyst 2014-6-21
You already have the code - you wrote it. Just call subplot(3,3,3) right before you call imshow() and the image will get displayed in the upper right corner. Here it is again:
subplot(3,3,3);
imshow(yourImage);

请先登录,再进行评论。

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by