I want histogram plot for all values. but i am getting only for last value. how could i get it for all values. and if i giving two histogram plot then i am getting only one plot. how could i change it
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want histogram plot for all values. but i am getting only for last value. how could i get it for all values. and if i giving two histogram plot then i am getting only one plot. how could i change it? my code: clc; clear all; close all; myFolder = 'G:\pro\aluminium_foil'; filePattern = fullfile(myFolder, '*.png'); jpegFiles = dir(filePattern); sigma=2; for k = 1:length(jpegFiles) baseFileName = jpegFiles(k).name; fullFileName = fullfile(myFolder, baseFileName); %fprintf(1, 'Now reading %s\n', fullFileName); I = imread(fullFileName);
end for s=1:length(sigma) sigma = sigma(s); Wx = floor(3*sigma); x = [-Wx:Wx]; [xx,yy] = meshgrid(x,x); g0 = -exp(-(xx.^2+yy.^2)/(2*sigma^2))/(2*pi*sigma^4);
F{s}.Gx = xx.*g0;
F{s}.Gy = yy.*g0;
F{s}.Gxx = (1-xx.^2/sigma^2).*g0;
F{s}.Gxy = -(xx.*yy/sigma^2).*g0;
F{s}.Gyy = (1-yy.^2/sigma^2).*g0;
end sij = sigma; Ix = sij*imfilter(I,F{s}.Gx ,'same', 'replicate'); Iy = sij*imfilter(I, F{s}.Gy, 'same', 'replicate'); Ixx = sij^2*imfilter(I, F{s}.Gxx, 'same', 'replicate'); Ixy = sij^2*imfilter(I, F{s}.Gxy, 'same', 'replicate'); Iyy = sij^2*imfilter(I, F{s}.Gyy, 'same', 'replicate'); Ix=double(Ix); Iy=double(Iy); Ixx=double(Ixx); Ixy=double(Ixy); Iyy=double(Iyy); g = sqrt(Ix.*Ix + Iy.*Iy); histogram(g) d = sqrt( (Ixx-Iyy).^2+ 4*Ixy.^2 ); histogram(d) i want histogram for both g and d. but i am not getting it. and i am getting for only for last d value. for other remaining images i need hist plot for d and g. what i have to change? thanks in advance
0 commentaires
Réponse acceptée
Image Analyst
le 16 Sep 2018
What do you consider a "value"? An image? Your code repeatedly reads in all images in a folder but overwrites them all so when the loop is done you're left with just one I, the last one.
Also, there is no histogram drawing inside the loop, just one after both of your loops are over, so of course you will only get one histogram. You need to put it inside a loop if you want a histogram for each image.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Histograms dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!