Interpolation Between Two Matrices
显示 更早的评论
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
回答(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
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!