MATLAB: Using Values from an image array in an equation to give a new image

image processingimagesc

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

Best Answer

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.