Introduction:
Nowadays, digital images and video are gradually replacing their conventional analog counterparts .This is quite understandable because digital format is easy to edit, modify, and exploit. Digital images and videos can be readily shared via computer networks and conveniently processed for queries in databases. Also, digital storage does not age or degrade with usage. On the other hand, thanks to powerful editing programs, it is very easy even for an amateur to maliciously modify digital media and create "perfect" forgeries. It is usually much more complicated to tamper with analog tapes and images.Robust authentication scheme:
here is a scheme to ensure the authenticity of digital images is presented. Their authentication technique is able to detect malicious tamperingof images even if they have been incidentally distorted by common image processingoperations.
Code:
function [window]=gaussian_window()
% gaussian window
N_window=7; % window length
sigma=1;
[x, y] = meshgrid(-(ceil(sigma*2)):4*sigma/(N_window-1):ceil(sigma*2));
window = (1/(2*pi*sigma^2)).*exp(-0.5.*(x.^2+y.^2)./sigma^2);
return
Step 2: (Function to calculate Variance)
function [var_map] = getVarianceMap(im,Bayer,dim)
% extend pattern over all image
pattern = kron(ones(dim(1)/2,dim(2)/2), Bayer);
% separate acquired and interpolate pixels for a 7x7 window
mask = [1, 0, 1, 0, 1, 0, 1;
0, 1, 0, 1, 0, 1, 0;
1, 0, 1, 0, 1, 0, 1;
0, 1, 0, 1, 0, 1, 0;
1, 0, 1, 0, 1, 0, 1;
0, 1, 0, 1, 0, 1, 0;
1, 0, 1, 0, 1, 0, 1];
% gaussian window fo mean and variance
window = gaussian_window().*mask;
mc = sum(sum(window));
vc = 1 - (sum(sum((window.^2))));
window_mean = window./mc;
% local variance of acquired pixels
acquired = im.*(pattern);
mean_map_acquired = imfilter(acquired,window_mean,'replicate').*pattern;
sqmean_map_acquired = imfilter(acquired.^2,window_mean,'replicate').*pattern;
var_map_acquired = (sqmean_map_acquired - (mean_map_acquired.^2))/vc;
% local variance of interpolated pixels
interpolated = im.*(1-pattern);
mean_map_interpolated = imfilter(interpolated,window_mean,'replicate').*(1-pattern);
sqmean_map_interpolated = imfilter(interpolated.^2,window_mean,'replicate').*(1-pattern);
var_map_interpolated = (sqmean_map_interpolated - (mean_map_interpolated.^2))/vc;
var_map = var_map_acquired + var_map_interpolated;
return
Step 3: (Output)
Hello, i run code and have a bug as:
ReplyDelete>> getVarianceMap
Error using getVarianceMap (line 5)
Not enough input arguments.
can you Show me your solution?