Matlab彩色图像配准
图像处理课上要求实现彩色图像配准,合成后颜色不变
但是按照官方说明操作时,总是报错:All dimention …greater than 4…,应该是实现imregister时,只能从单个维度实现配准。
于是一位大佬出现直接解决问题:
pic_fixed = imread(‘1.jpg’); pic_moving = imread(‘2.jpg’);
[optimizer,metric]=imregconfig(‘monomodal’); for i=1:3
pic_registered(:,:,i) = imregister(pic_moving(:,:,i),pic_fixed(:,:,i),‘affine’,optimizer,metric);
end imwrite(pic_composite,‘融合图像.jpg’);
pic_composite=imfuse(pic_fixed,pic_registered,‘blend’);
subplot(221),imshow(pic_fixed),title(‘参考图像’);
subplot(222),imshow(pic_moving),title(‘失配图像’);
subplot(223),imshow(pic_registered),title(‘配准图像’);
subplot(224),imshow(pic_composite),title(‘融合图像’);