1 内容介绍
本文研究了一种空域中的图像分解技术,进而利用改种分解方法,探 讨了图像插值算法.本文提出的图像分解方法的主要思想是:利用类型确定的滤波器(如低通)对原始图像滤波,将图像分解为高频和低频两部分,并对分解得到的 低频或高频成分进行处理,图像可分解成不同频率分量的图层之和,进而在各个图层上进行相应的插值处理,最后利用逆变换得到最终的结果.
2 仿真代码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Implementation of 'Minimized-Laplacian Residual Interpolation for Color Image Demosaicking'
%
% This code is available only for reserch purpose.
% If you use this code for future publications,
% please cite the following paper.
%
% Daisuke Kiku, Yusuke Monno, Masayuki Tanaka, and Masatoshi Okutomi,
% 'Minimized-Laplacian Residual Interpolation for Color Image Demosaicking',
% IS&T/SPIE Electronic Imaging, Digital Photography X, 2014.
%
% Main funtion
% rgb_dem = demosaick(rgb, pattern, sigma)
%
% Input
% - rgb : full RGB image
% - pattern : mosaic pattern
% default : 'grbg'
% others : 'rggb','gbrg','bggr'
% - sigma : standard deviation of gaussian filter(default : 1.4)
% * For IMAX image dataset, 1 works well.
% * For Kodak image dataset, 1e8 works well.
%
% Output
% - rgb_dem : result image
%
% Copyright (C) 2013 Daisuke Kiku. All rights reserved.
% dkiku@ok.ctrl.titech.ac.jp
%
% November 26, 2013.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
% read image
rgb = imread('lena.tiff');
figure
subplot(211)
imshow(rgb,[]);title('原图')
% cast to double
rgb = double(rgb);
% mosaic pattern
% G R ..
% B G ..
% : :
pattern = 'grbg';
% demosaicking
sigma = 1.4;
rgb_dem = demosaick(rgb, pattern, sigma);
% save image
imwrite(uint8(rgb_dem), 'lena_MLRI.tiff');
% show image
subplot(212)
imshow(rgb_dem/255);title('插值图')
% calculate PSNR and CPSNR
psnr = impsnr(rgb, rgb_dem, 255, 10);
cpsnr = imcpsnr(rgb, rgb_dem, 255, 10);
% print PSNR and CPSNR
fprintf( sprintf( 'Red:%f\n', psnr(1) ) );
fprintf( sprintf( 'Green:%f\n', psnr(2) ) );
fprintf( sprintf( 'Blue:%f\n', psnr(3) ) );
fprintf( sprintf( 'CPSNR:%f\n', cpsnr ) );
3 运行结果
4 参考文献
[1]吴颖, 田岩. 基于滤波器分解的图像插值算法[J]. 武汉船舶职业技术学院学报, 2009, 8(2):3.