How to make image intensity equalization for multiple images.

98 ビュー (過去 30 日間)
Ivan Shorokhov
Ivan Shorokhov 2015 年 7 月 1 日
コメント済み: mohd akmal masud 2018 年 3 月 14 日
Given: I have 9 gray-scale images of the same size with slightly different intensity.
Want: I want to make uniform intensity for all the images.
Currently done: Just now I'm doing image adjustment followed be image equalization for each single image, by using code below
for x=1:9
eq_image(:,:,x)=histeq(imadjust(some_image(:,:,x)));
figure(x); imshow(eq_image(:,:,x), []);
end
Needed: How to make intensity the same for all 9 images?
[ACKNOWLEDGMENTS]
Thank you for help: Kerem tezcan, Image Analyst

採用された回答

Kerem  tezcan
Kerem tezcan 2015 年 7 月 1 日
編集済み: Image Analyst 2016 年 5 月 31 日
Hey,
When you do histogram equalization, you do that separately for each image, which is not what you want, as you have also stated.
You can normalize the images to one of them. For example choose the first image as the reference, and then calculate the mean intensities of all the images, and find the scaling between each image with the reference image by the formula: sc(n) = mean_of_ref / mean_of_ims(n). Then you can multiply all the images with the corresponding individualized scaling and you will have the same mean intensity for all the images.
Other approaches would be to normalize them according to their maximum values, or similarly to the minimum values, or to the median values.
For the scaling according to the mean of the first image, the code would look like this:
for x=1:9
mns(x) = mean2(some_image(:, :, x));
scaled_image(:, :, x) = some_image(:, :, x) * (mns(1) / mns(x));
end
You can do the histogram equalization independently of the scaling, but doing that afterwards will change the mean of any image you do it to.
  2 件のコメント
Ivan Shorokhov
Ivan Shorokhov 2015 年 7 月 1 日
That is what I wanted to hear. Thank you very much for such an open answer!
Soum
Soum 2016 年 5 月 31 日
Thank you very much for your pretty answer Kerem tezcan

サインインしてコメントする。

その他の回答 (2 件)

Ivan Shorokhov
Ivan Shorokhov 2015 年 7 月 2 日
Another example/code for histogram equalization – might be useful.
M = zeros(256,1,'uint8'); % Store mapping - Cast to uint8 to respect data type
hist1 = imhist(img1); % Compute histograms
hist2 = imhist(img2);
cdf1 = cumsum(hist1) / numel(img1); %Compute CDFs
cdf2 = cumsum(hist2) / numel(img2);
% Compute the mapping
for idx = 1 : 256
[~,ind] = min(abs(cdf1(idx) - cdf2));
M(idx) = ind-1;
End
%Now apply the mapping to get first image to make
%the image look like the distribution of the second image
out = M(double(img1)+1);

Image Analyst
Image Analyst 2015 年 7 月 2 日
You can do linear scaling like kerem suggested. Another option is to use imhistmatch() to match images 2 and higher to image #1.
  2 件のコメント
Ivan Shorokhov
Ivan Shorokhov 2015 年 7 月 3 日
Thank you!
mohd akmal masud
mohd akmal masud 2018 年 3 月 14 日
Hi all
i want try open multiple images using implay. but want to change contrast first. Below is my code, but still error. anyone can help me.
P = zeros(512, 512, 313);
for K = 1 : 313
petname = sprintf('TRANSA001_CT%03d.dcm', K);
P(:,:,K) = dicomread(petname);
end
Out(:,:,K) = imadjust(P(:,:,K));
implay(Out, [-182 292]);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by