Images viewing through axes in matlab GUI

2 visualizzazioni (ultimi 30 giorni)
i have a simple code to retrieve images using histogram .. i would like to view the result images that satisfy condition from Axes1..to Axes5 ..
srcFiles = dir(my directory);
for i = 1 : length(srcFiles)
filename = strcat(path,'\',srcFiles(i).name);
Imaged1= imread(filename);
Imaged2 = imread('D:\2','jpeg'); % Image 2
Imageg1 = rgb2gray(Imaged1);
Imageg2 = rgb2gray(Imaged2);
% Calculate the Normalized Histogram of Image 1 and Image 2
hn1 = imhist(Imageg1)./numel(Imageg1);
hn2 = imhist(Imageg2)./numel(Imageg2);
% Calculate the histogram error
y = sum((hn1 - hn2).^2);
if (y <= 0.005)
disp('not similar');
else
* _{{{ View Result Images from Axes2 .... Axes5. }}}_*
end

Risposta accettata

Walter Roberson
Walter Roberson il 2 Apr 2016
Ahead of time:
axeslist = [Axes2, Axes3, Axes4, Axes5];
cur_ax_idx = 0;
Then in the code, when the condition is met,
if cur_ax_idx < length(axeslist)
cur_ax_idx = cur_ax_idx + 1;
cur_ax = axeslist(cur_ax_idx);
... now show the result on axes cur_ax
else
warning('you need more axes to display all of the results')
end

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by