Using Values from an image array in an equation to give a new image
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Robert Roy
le 21 Août 2015
Commenté : Image Analyst
le 21 Août 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 commentaires
Réponse acceptée
Image Analyst
le 21 Août 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 commentaires
Image Analyst
le 21 Août 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, []);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!