如何制作两张相同尺寸的图像?

时间:2013-10-19 06:15:28

标签: matlab

我有两张尺寸相同但尺寸不同的图片我如何制作相同尺寸的图片以便我可以减去下面的图像说明

 d=imread('dif5.jpg');

>> f=size(d);

>> f

f = 900        1200           3

g=ndims(d);

>> g

g = 3

>> h=imread('dif4.jpg');

>> j=size(h);

>> j

j = 363   484     3

>> k=ndims(h);

>> k

k = 3

2 个答案:

答案 0 :(得分:0)

你必须resample图像;信号处理工具箱包含一个实现 - 也可能是针对图像的现成功能。

脱离我的头顶(尚未测试):

a = resample(f, 900, 363)'; %% should produce 1200 x 363 x 3 (transposed) image
b = resample(b, 1200, 484)'; %% produces 363 x 484 x 3 image

c = b - h;  %% diff of the resampled image and the smaller image

还可以使用implementations双线性,双三次等仅使用标准函数:

答案 1 :(得分:0)

这是设计imresize的工作。

d = imread('dif5.jpg'); % 900 x 1200 x 3
h = imread('dif4.jpg'); % 363 x 484 x 3
dh = imresize(h,[size(d,1) size(d,2)],'bicubic'); % or 'linear', etc.
diffImg = dh - d; % 900 x 1200 x 3
相关问题