ABSTRACT
A novel visual cryptography scheme called region incrementing visual cryptography (RIVC), for sharing visual secrets with multiple secrecy levels in a single image. In the proposed n level RIVC scheme, the content of an image S is designated to multiple regions associated with n secret levels, and encoded to n+1 shares with the following features: (a) each share cannot obtain any of the secrets in S, (b) any t(2<t,n+1)shares can be used to reveal t-1 levels of secrets, (c) the number and locations of not-yet-revealed secrets are unknown to users, (d) all secrets in S can be disclosed when all of the n+1 shares are available, and (e) the secrets are recognized by visually inspecting correctly stacked shares without computation. The basis matrices for constructing the proposed-level RIVC with small values of n=2, 3, 4 are introduced, and the results from two experiments are presented.
FULL PROJECT
Region Incrementing Visual Cryptography
PRESENTATION:
1. MAIN
%Clearing memory and command window
clc;clear all;close all;
%Getting Input
INPUT = 'lena.bmp';
in_img = imread(INPUT);
sz = size(in_img);
imshow(in_img);title('Input Image');
%Secret Binary Image
secret_img = imread('secret.bmp');
figure;imshow(secret_img);title('Secret Binary Image');
sec_sz = size(secret_img);
%Halftone Image Conversion
halftone_img = im2bw(uint8(floyd(in_img)));
figure;imshow(halftone_img);title('Halftoned Image');
rev_halftone_img = ~halftone_img;
figure;imshow(rev_halftone_img);title('Reverse Halftoned Image');
%Secret information embedding on the shares
for i=1:sec_sz(1)
for j=1:sec_sz(2)
p = ~(secret_img(i,j));
M = random_select(p);%encoded secret information
x_cor = 2*i-1;%randomly denotes the position in the cover image
y_cor = 2*j-1;
halftone_img(x_cor,y_cor) = M(1,1);
halftone_img(x_cor+1,y_cor+1) = M(1,2);
rev_halftone_img(x_cor,y_cor) = M(2,1);
rev_halftone_img(x_cor+1,y_cor+1) = M(2,2);
end
end
%Displaying Shares
figure;imshow(halftone_img);title('Share 1');
figure;imshow(rev_halftone_img);title('Share 2');
%Bordering shares for easy Visual Superimposing
% halftone_img(1,:)=0;halftone_img(end,:)=0;
% halftone_img(:,1)=0;halftone_img(:,end)=0;
% rev_halftone_img(1,:)=0;rev_halftone_img(end,:)=0;
% rev_halftone_img(:,1)=0;rev_halftone_img(:,end)=0;
% imwrite(halftone_img,'Share_1.bmp');
% imwrite(rev_halftone_img,'Share_2.bmp');
%Shares superimposing
temp = halftone_img + rev_halftone_img;
figure;imshow(~temp);title('Super Imposed Output');
2. JARVIS
function[halftoned] = jarvis(x)
x = double(x);
[M,N] = size(x);
T = 127.5;
y = x;
error = 0;
y= [127.5*ones(M,2) y 127.5*ones(M,2) ; 127.5*ones(2,N+4)];
% y= [0*ones(M,2) y 0*ones(M,2) ; 0*ones(2,N+4)];
z = y;
for rows = 1:M
for cols = 3:N+2
z(rows,cols) =255*(y(rows,cols)>=T);
error = -z(rows,cols) + y(rows,cols);
y(rows,cols+2) = 5/48 * error + y(rows,cols+2);
y(rows,cols+1) = 7/48 * error + y(rows,cols+1);
y(rows+1,cols+2) = 3/48 * error + y(rows+1,cols+2);
y(rows+1,cols+1) = 5/48 * error + y(rows+1,cols+1);
y(rows+1,cols+0) = 7/48 * error + y(rows+1,cols+0);
y(rows+1,cols-1) = 5/48 * error + y(rows+1,cols-1);
y(rows+1,cols-2) = 3/48 * error + y(rows+1,cols-2);
y(rows+2,cols+2) = 1/48 * error + y(rows+2,cols+2);
y(rows+2,cols+1) = 3/48 * error + y(rows+2,cols+1);
y(rows+2,cols+0) = 5/48 * error + y(rows+2,cols+0);
y(rows+2,cols-1) = 3/48 * error + y(rows+2,cols-1);
y(rows+2,cols-2) = 1/48 * error + y(rows+2,cols-2);
end
end
halftoned = z(1:M,3:N+2);
z = z(1:M,3:N+2);
y = y(1:M,3:N+2);
3 . RIVIS SCRIPT
clc;
clear all;
close all;
inImg = imread('rivc.bmp');
n=input('Nth level Secrecy');
k=input('enter secrecy level');
s = size(inImg);
share1 = ones(s(1), (2 * s(2)));
share2 = ones(s(1), (2 * s(2)));
share3 = ones(s(1), (2 * s(2)));
share4 = ones(s(1), (2 * s(2)));
[x y] = find(inImg == 1);
len = length(x);
for i=1:len
a=x(i);b=y(i);
pixShare=choose(n,k,0);
share1((a),(2*b):(2*b+5))=pixShare(1,1:6);
share2((a),(2*b):(2*b+5))=pixShare(2,1:6);
share3((a),(2*b):(2*b+5))=pixShare(3,1:6);
share4((a),(2*b):(2*b+5))=pixShare(4,1:6);
end
[x y] = find(inImg == 0);
len = length(x);
for i=1:len
a=x(i);b=y(i);
pixShare=choose(n,k,1);
share1((a),(2*b):(2*b+5))=pixShare(1,1:6);
share2((a),(2*b):(2*b+5))=pixShare(2,1:6);
share3((a),(2*b):(2*b+5))=pixShare(3,1:6);
share4((a),(2*b):(2*b+5))=pixShare(4,1:6);
end
figure;imshow(share1);title('Share 1');
figure;imshow(share2);title('Share 2');
figure;imshow(share3);title('Share 3');
figure;imshow(share4);title('Share 4');
share12=bitor(share1, share2);
share13=bitor(share12, share3);
share14=bitor(share13,share4);
share14 = ~share14;
disp('Share Generation Completed.');
figure;imshow(share14);title('Total');
4 .RANDOM SELECT
function out = random_select(p)
noshifts= floor(1.9*rand(1));
if(p==0)%p=0, C_0, white pixel
if (noshifts == 0)
out = [0 1;0 1];%M_1
else
out = [1 0;1 0];%M_2
end
else%p=1, C_1, black pixel
if (noshifts == 0)
out = [0 1;1 0];%M_1
else
out = [1 0;0 1];%M_2
end
end
5. FLOYD
function[halftoned] = floyd(x)
x = double(x);
[M,N] = size(x);
T = 127.5; %Threshold
y = x;
error = 0;
for rows = 1:M-1
%Left Boundary of Image
z(rows,1) =255*(y(rows,1)>=T);
error = -z(rows,1) + y(rows,1);
y(rows,1+1) = 7/16 * error + y(rows,1+1);
y(rows+1,1+1) = 1/16 * error + y(rows+1,1+1);
y(rows+1,1) = 5/16 * error + y(rows+1,1);
for cols = 2:N-1
%Center of Image
z(rows,cols) =255*(y(rows,cols)>=T);
error = -z(rows,cols) + y(rows,cols);
y(rows,cols+1) = 7/16 * error + y(rows,cols+1);
y(rows+1,cols+1) = 1/16 * error + y(rows+1,cols+1);
y(rows+1,cols) = 5/16 * error + y(rows+1,cols);
y(rows+1,cols-1) = 3/16 * error + y(rows+1,cols-1);
end
%Right Boundary of Image
z(rows,N) =255*(y(rows,N)>=T);
error = -z(rows,N) + y(rows,N);
y(rows+1,N) = 5/16 * error + y(rows+1,N);
y(rows+1,N-1) = 3/16 * error + y(rows+1,N-1);
end
%Bottom & Left Boundary of Image
rows = M;
z(rows,1) =255*(y(rows,1)>=T);
error = -z(rows,1) + y(rows,1);
y(rows,1+1) = 7/16 * error + y(rows,1+1);
%Bottom & Center of Image
for cols = 2:N-1
z(rows,cols) =255*(y(rows,cols)>=T);
error = -z(rows,cols) + y(rows,cols);
y(rows,cols+1) = 7/16 * error + y(rows,cols+1);
end
%Bottom & Right Boundary of Image
z(rows,N) =255*(y(rows,N)>=T);
error = -z(rows,N) + y(rows,N);
%output Halftoned Image
halftoned = z;
2 comments:
dear sir
first of all thanks a lot for giving this valuable codes,,
but sir i am facing a problem while implementing the codes of rivs script.
its "showing undefined function or method choose"
sir plz solve my problem i will be very grateful for u..
plz mail me on aman.agrawal.aiesec@gmail.com
sir pleease provide the code for "combined DCT and Companding for PAPR reduction in ofdm signals" for my project
Post a Comment