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 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Image Analyst
Image Analyst am 3 Nov. 2018

Weitere Antworten (2)

awezmm
awezmm am 3 Nov. 2018
Bearbeitet: awezmm am 3 Nov. 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 Kommentare
jyoti dabass
jyoti dabass am 4 Nov. 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 am 4 Nov. 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;

Melden Sie sich an, um zu kommentieren.


jyoti dabass
jyoti dabass am 4 Nov. 2018
Thank you..Its working fine.

Kategorien

Mehr zu Get Started with Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by