adjusts the intensity of the image
3 次查看(过去 30 天)
显示 更早的评论
hi recently i'm studying matlab...i have to adjusts the intensity of the image whit n transformed with different intensity range(>1 and <1)and show their histogram.don't undestand the solution; the code is:
function InspectImadjust(img,tol, n)
img_gray=rgb2gray(img)
if nargin<3
n = 3;
end
if nargin<2
tol = 0.05;
end
figure;
subplot(n+1,2,1);
imshow(img_gray);
title('Immagine a Livelli di grigio');
subplot(n+1,2,2);
imhist(img_gray);
title('istogramma ORIG');
xlabel('l.d.g.');
ylabel('#pixels');
%%CONTRAST STRETCHING
%Sintassi generale: J = imadjust(I,[low_in; high_in],[low_out; high_out],gamma)
step = 1/n;
gammaMin = [];
for i=1:floor(n/2) %%da 1 fino a 1
gammaMin = [1-(i*step)];
end
gammaMin = fliplr(gammaMin);
gammaMax = [];
for i=1:floor(n/2)
gammaMax = [1+(i*step)];
end
gamma = [gammaMin 1 gammaMax];
i = 3;
for g = gamma
img_CS = imadjust(img_gray, stretchlim(img_gray, tol), [], g);
subplot(n+1,2,i);
imshow(img_CS)
title(['tol: ' num2str(tol) '. gamma: ' num2str(g)]);
subplot(n+1,2,i+1);
imhist(img_CS);
i = i + 2;
end
end
why the code use step = 1/n?why estimate gammaMin = [1-(i*step)] and gammaMax = [1+(i*step)]?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Gamma Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!