Using Values from an image array in an equation to give a new image
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Robert Roy
am 21 Aug. 2015
Kommentiert: Image Analyst
am 21 Aug. 2015
Hi there, I have two images arrays that I want to ratio in an equation to give a new image T however I am having problems doing this.
AvgImg1 = uint16(zeros(1024,1280)); AvgImg1 Values
AvgImg2=uint16(zeros(1024,1280)); AvgImg2 Values
K1=imagesc((AvgImg1));
K2=imagesc((AvgImg2));
T=uint16(zeros(1024,1280)
T=constant*ln(K1/K2);
plot T
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 21 Aug. 2015
So what do you think 0/0 should give? Also, don't make them integer if you're going to divide them. And use imshow(T, []) instead of plot() to display the resulting image. And you don't need to preallocate T in this case.
2 Kommentare
Image Analyst
am 21 Aug. 2015
Don't use K1 and K2 at all - they're just handles to the images, not the images themselves which are called AvgImg1 and AvgImg2. Cast them to double or else you will get an integer divide and the quotient will be either 0 or 1. Then use ./ instead of / to do an element by element divide.
AvgImg1 = uint16(zeros(1024,1280)); %AvgImg1 Values
AvgImg2=uint16(zeros(1024,1280)); % AvgImg2 Values
subplot(2,2,1);
imshow(AvgImg1);
subplot(2,2,2);
imshow(AvgImg2);
T=constant*ln(double(AvgImg1) ./ double(AvgImg2));
subplot(2,2,3);
imshow(T, []);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 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!