I don't know what kind of help you need, but we're not supposed to talk about cryptography on the Mathworks servers.
VC program for color images
1 次查看(过去 30 天)
显示 更早的评论
I was writing a program for my college project.The program'saim is to hid color images using meaningful shares.So in order to hide an image.I used two cover images.I was supposed to write two function programs for the main programs.I am unable to accept values returned from the first function SecCodTbl.
Here is the code for the main program %main.m %Clear Memory & Command Window clc; clear all; close all;
%Read input color image(Secret Image) inpsi=imread('lenaV.jpg');
%cmy output opsi=rgb2cmy(inpsi); figure;imshow(opsi);
%Read input color image(Cover Image A) inpca=imread('veg.jpg');
%cmy output opca=rgb2cmy(inpca); opca=imresize(opca,[512 512]); figure;imshow(opca);
%Read input color image(Cover Image B) inpcb=imread('Castle.png');
%cmy output opcb=rgb2cmy(inpcb); figure;imshow(opcb); share1=zeros(512,512,3); share2=zeros(512,512,3); %Secret coding table [share1, share2] = SecCodTbl(opsi); figure;imshow(share1); figure;imshow(share2);
and the function SecCodTbl %SecCodTbl.m function [share1, share2] = SecCodTbl(inImg)
s=size(inImg); for i=1:s(1) for j=1:s(2) if(inImg(i,j)=='w') share1(2*i-1,2*j-1)='y'; share1(2*i-1,2*j)='c'; share1(2*i,2*j-1)='w'; share1(2*i,2*j)='m'; share2(2*i-1,2*j-1)='y'; share2(2*i-1,2*j)='c'; share2(2*i,2*j-1)='w'; share2(2*i,2*j)='m';
elseif(inImg(i,j)=='c')
share1(2*i-1,2*j-1)='y';
share1(2*i-1,2*j)='c';
share1(2*i,2*j-1)='w';
share1(2*i,2*j)='m';
share2(2*i-1,2*j-1)='y';
share2(2*i-1,2*j)='w';
share2(2*i,2*j-1)='c';
share2(2*i,2*j)='m';
elseif(inImg(i,j)=='m')
share1(2*i-1,2*j-1)='y';
share1(2*i-1,2*j)='c';
share1(2*i,2*j-1)='w';
share1(2*i,2*j)='m';
share2(2*i-1,2*j-1)='y';
share2(2*i-1,2*j)='c';
share2(2*i,2*j-1)='m';
share2(2*i,2*j)='w';
elseif(inImg(i,j)=='y')
share1(2*i-1,2*j-1)='y';
share1(2*i-1,2*j)='c';
share1(2*i,2*j-1)='w';
share1(2*i,2*j)='m';
share2(2*i-1,2*j-1)='y';
share2(2*i-1,2*j)='c';
share2(2*i,2*j-1)='m';
share2(2*i,2*j)='w';
elseif(inImg(i,j)=='b')
share1(2*i-1,2*j-1)='y';
share1(2*i-1,2*j)='c';
share1(2*i,2*j-1)='w';
share1(2*i,2*j)='m';
share2(2*i-1,2*j-1)='y';
share2(2*i-1,2*j)='m';
share2(2*i,2*j-1)='w';
share2(2*i,2*j)='c';
elseif(inImg(i,j)=='r')
share1(2*i-1,2*j-1)='y';
share1(2*i-1,2*j)='c';
share1(2*i,2*j-1)='w';
share1(2*i,2*j)='m';
share2(2*i-1,2*j-1)='m';
share2(2*i-1,2*j)='c';
share2(2*i,2*j-1)='w';
share2(2*i,2*j)='y';
elseif(inImg(i,j)=='g')
share1(2*i-1,2*j-1)='y';
share1(2*i-1,2*j)='c';
share1(2*i,2*j-1)='w';
share1(2*i,2*j)='m';
share2(2*i-1,2*j-1)='c';
share2(2*i-1,2*j)='y';
share2(2*i,2*j-1)='w';
share2(2*i,2*j)='m';
elseif(inImg(i,j)=='k')
share1(2*i-1,2*j-1)='y';
share1(2*i-1,2*j)='c';
share1(2*i,2*j-1)='w';
share1(2*i,2*j)='m';
share2(2*i-1,2*j-1)='m';
share2(2*i-1,2*j)='w';
share2(2*i,2*j-1)='c';
share2(2*i,2*j)='y'
end
end
end
Please help me out.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Encryption / Cryptography 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!