How to obtain statistical parameters of images by comparing with ground truth image
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i stored my images in im1,im2,im3,...., i want to find statistical parameters by comparing with ground truth image. i want to use loop for this. i am getting error when i call image in the loop using im' num2str(j) '. Here i have included my code
grn_i=im2bw(I1,0.5);
im1=im2bw(I2,0.5);
im2=im2bw(I3,0.5);
im3=im2bw(I4,0.5);
im4=im2bw(I5,0.5);
im5=im2bw(I6,0.5);
%m=imread(['folder_path\im' num2str(i) '.jpg']).
for j=1:5
[Accuracy, Sensitivity, Specitivity] = EvaluateImageSegmentationScores(grn_i, im' num2str(j) ');
[Jaccard,Dice,rfp,rfn]=sevaluate(grn_i, im'num2str(j)');
end
i am getting error in the loop
[Accuracy, Sensitivity, Specitivity] = EvaluateImageSegmentationScores(grn_i, im' num2str(j) ');
0 Kommentare
Antworten (1)
Rahul
am 3 Dez. 2024
After observing the code shared by you and the error message being encountered, I can see that you're trying to access the images 'im1', 'im2', etc., using dynamic variable names. Accessing variables dynamically in the way shared is not supported by MATLAB. This is also captured in the following MATLAB Answers:
Instead, consider defining a cell array or regular array to store variables of images and access using index of the loop.
Here is an example:
% Here I am creating a cell array 'images' and storing all images as specified in the code given.
images = {im2bw(I2, 0.5), im2bw(I3, 0.5), im2bw(I4, 0.5), im2bw(I5, 0.5), im2bw(I6, 0.5)};
grn_i=im2bw(I1,0.5);
for j = 1:5
% Evaluate segmentation scores based on j-th element of 'images' array
[Accuracy, Sensitivity, Specitivity] = EvaluateImageSegmentationScores(grn_i, images{j});
[Jaccard, Dice, rfp, rfn] = sevaluate(grn_i, images{j});
end
The following MathWorks documentation can be referred to know more:
'Accessing Data in Cell Array': https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-cell-array.html
Thanks.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Segmentation and Analysis 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!