plotting the histogram of images (difference in MATLAB and ImageJ)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to plot the histogram of a medical image (512*512) in MATLAB but as I could not find how to set a good range for the x-y axis and I was not sure about the accuracy of imhist command (it looked somehow strange!) I tried to write the code as following however it does not work. I will highly appreciate any suggestions on how to remove the error(s) and plot the histogram of the image in this regard.
A=dicomread('med.dcm');
C := matrix (255,2);
B := matrix(512 512);
binwidth = max(A(:))- min(A(:));
for k=1:512
for l=1:512
for j=0:256
A(k,l) = min (A(:))+j*binwidth;
if A(k,l)<A(k,l)+binwidth/2
B(k,l)== A(k,l);
elseif A(k,l)== A(k,l)+binwidth/2
B(k,l)== A(k,l);
else
B(k,l)== A(k,l)+binwidth
end
end
end
end
s==0;
for i=min(A(:)): max(A(:))
for p=1:262144
for k=1:512
for l=1:512
if B(k,l)== i
C(p,2)==s+1;
else
i=i+binwidth;
C(p,2)==s;
C(p,1)==i;
end
end
end
end
end
hist(C(:))
9 Kommentare
jonas
am 13 Aug. 2018
Bearbeitet: jonas
am 13 Aug. 2018
Well, I've never used ImageJ, but to me it seems quite obvious that those two images are not identical. See attached figure. My eyes, as well as the features of the histogram, tells me that the ImageJ one has been tampered with somehow. My guess is that the filter you applied is not the same in MATLAB as in ImageJ. Perhaps the unit of 7 differs, or perhaps it is the method involved that is different.
And no, I'm not saying that ImageJ does anything automatically. The others images you uploaded does not have the same smooth features.
Antworten (0)
Siehe auch
Kategorien
Mehr zu 3-D Volumetric Image Processing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!