简体   繁体   中英

In Matlab, I need a function/script that reads the element ij in two different images and outputs a new image which is the output of a function

Pretty simple:

I need a script that reads the element ij of TWO images (same size). These two elements will be the input of a function that I have (actually a fuzzy logic system). I want the output of this function to form a new image, this one is made with the output of my function for every ij element of the TWO images opened before.

Thanks very much!

Rodrigo

The naive approach:

sz = size(img1);
out = zeros(sz,class(img1));
for i=1:sz(1)
     for j=1:sz(2)
         out(i,j) = myFunc(img1(i,j), img2(i,j));
     end
end

If your function is properly vectorized, you can just do:

out = myFunc(img1,img2);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM