imA = imread('L:\array\tcf\6C_A500k\z001_t001.cam6.tif');
imB = imread('L:\array\tcf\6C_interpolant\z001_t001.cam6.tif');

imA=double(imA);
imB=double(imB);
im_res=imA-imB;
disp(norm(im_res(:))/norm(imA(:)));

imA_demosaic= demosaic(uint8(imA), 'bggr');
imB_demosaic= demosaic(uint8(imB), 'bggr');

%% plot
figure(1);
clf;
subplot(1,2,1);
image(imA_demosaic);
axis equal tight ij;
ax=gca;

subplot(1,2,2);
image(imB_demosaic);
axis equal tight ij;
ax(2)=gca;

linkaxes(ax,'xy');

%% residual
figure(2);
clf;
imagesc(im_res.');
axis equal tight ij;