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

1 回表示 (過去 30 日間)
Robert Roy
Robert Roy 2015 年 8 月 21 日
コメント済み: Image Analyst 2015 年 8 月 21 日
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

採用された回答

Image Analyst
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 件のコメント
Robert Roy
Robert Roy 2015 年 8 月 21 日
Its not 0/0, sorry thats just to setup the arrary. How would I go about not making it integer if i was not to divide them? Thanks
Image Analyst
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 ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by