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 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Image Analyst
Image Analyst el 3 de Nov. de 2018

Más respuestas (2)

awezmm
awezmm el 3 de Nov. de 2018
Editada: awezmm el 3 de Nov. de 2018
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 comentarios
jyoti dabass
jyoti dabass el 4 de Nov. de 2018
I accepted the answer but i had tried plot. Its not giving the waveforms required. Anyways thanks for the code.
Image Analyst
Image Analyst el 4 de Nov. de 2018
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;

Iniciar sesión para comentar.


jyoti dabass
jyoti dabass el 4 de Nov. de 2018
Thank you..Its working fine.

Community Treasure Hunt

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

Start Hunting!

Translated by