Interpolation Between Two Matrices
Show older comments
I would like to interpolate between two matrices with the same dimensions using the interp function on MATLAB. However, I do not understand how to apply it in this case. The Matrices are from two image slices that are seperated by 1 mm. I would like to know the image slice in between these two slices. I've tried using the method of simply averaging the two images but I would like to try something more sophisticated.
Thanks! Kevin
Answers (1)
If you want the average between two matrices, using mean is smart enough. There is no need for a more sophisticated method.
I have no idea, where the 1mm might come into play.
img1 = rand(10, 15, 3);
img2 = rand(10, 15, 3);
imgAvg1 = 0.5 * (img1 + img2);
Or:
imgPool = cat(1, img1(:).', img2(:).');
imgInter = interp1(1:2, imgPool, 1.5);
imgAvg2 = reshape(imgInter, size(img1));
Bother methods calculate the same average RGB color. This works with 2D gray scale images also
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!