I wish to read 322 images of mammogram then wish to apply the enhancement techniques say histogram equalization and then wish to calculate contrast improvement index (CII) of all 322 images followed by showing results of all 322 images graphically

2 次查看(过去 30 天)
My problem is I am not able to understand how to use for loop or other technique to read 322 images followed by applying the enhancement techniques on all 322 images, calculation of CII and entropy of all and showing their results graphically. I have all 322 images in a folder.

采纳的回答

Image Analyst
Image Analyst 2018-11-3

更多回答(2 个)

awezmm
awezmm 2018-11-3
编辑:awezmm 2018-11-3
First check out these, I think they are doing exactly what you want: mmgimg1
Make sure your images are grayscale
For reading images I suggest you use imagedatastore: imageDatastore
You would do:
%Put the full path of the folder containing all your images in location argument below.
imds = imageDatastore('location')
%Now you will have to use for loop to read all the images
for i = 1:length(imds.Files)
%getting file name of an image
curr_image_cell_name = imds.Files(i);
curr_image_file_name = curr_image_cell_name{1,1};
%reading current image
curr_image = imread(curr_image_file_name);
%now you can adjust your image here, note that your images have to be grayscale
%there are a variet methods: check out this site:
%https://www.mathworks.com/help/images/contrast-enhancement-techniques.html
%some examples, note that your images have to be grayscale
image_imadjust = imadjust(curr_image);
image_histeq = histeq(curr_image);
image_adapthisteq = adapthisteq(curr_image);
%you can show this graphically by plotting the histograms of different images
%figure. This is explained in:
%https://www.mathworks.com/help/images/contrast-enhancement-techniques.html
imshow(imhist(curr_image))
%entropy of grayscale image:
%https://www.mathworks.com/help/images/ref/entropy.html
ent = entropy(curr_image);
disp(ent)
end
  4 个评论
Image Analyst
Image Analyst 2018-11-4
For the end of the loop, try
ent(i) = entropy(curr_image);
fprintf('For image #%d of %d, the entropy is %f.\n', i, length(imds.Files), ent(i));
end
plot(ent, 'b-', 'LineWidth', 2);
grid on;

请先登录,再进行评论。


jyoti dabass
jyoti dabass 2018-11-4
Thank you..Its working fine.

类别

Help CenterFile Exchange 中查找有关 Get Started with Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by