Using Values from an image array in an equation to give a new image
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2015-8-21
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 个评论
Image Analyst
2015-8-21
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, []);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!