Actually "trionew" is a matrix of 1*73728......and i have converted this matrix into 256*256 image...." imshow(uint8(blocksn))" and now i have to perform reverse operation.......means from this image i have to extract "trionew"
from "trionew " i derived this image "imshow(uint8(blocksn));".................after this i have to derive back "trionew" from this image
1 view (last 30 days)
Show older comments
a=imread('baboon.jpg'); [r c p]=size(a); if p==3 a=rgb2gray(a); end % imshow(a); input=a; input=input; input=double(input); [row col] = size(input); len=row*col; block=0; Q1={}; Q2={}; z=1; k=16; mid=sqrt(k); blokval=k; bit=zeros(1,len); bitcount=1; for x=1:mid:row for y=1:mid:col count=0; t=0; s=0; a = input(x:x+(mid-1),y:y+(mid-1)); %grouping of pixels in 4*4 or 8*8 matrix takes place block=block+1; m=mean(mean(a)); m=round(m); %formation of bit plane for i=1:mid for j=1:mid if a(i,j)>=m bit(1,bitcount)=1; bitcount=bitcount+1; count=count+1; p=a(i,j); s=s+p; else bit(1,bitcount)=0; bitcount=bitcount+1; c=a(i,j); t=t+c; end end end %lower mean q1=floor(inv((k-count)) *t); Q1{z}=q1; %higher mean q2=floor(inv((count))*s); Q2{z}=q2; z=z+1; clear a; end end lev=size(Q2); levv=lev(2) * (k+2); tt=1; zz=1; ww=1; %trio formation trio=zeros(1,levv); while(zz<=lev(2)) trio(1,tt)=Q1{zz}; tt=tt+1; trio(1,tt)=Q2{zz}; tt=tt+1; for kk=1:k trio(1,tt)=bit(1,ww); tt=tt+1; ww=ww+1; end zz=zz+1; end bitcount=bitcount-1; save bit bit; save bitcount bitcount; save Q1 Q1; save Q2 Q2; save row row; save count count; save col col; save block; save trio trio; warndlg('Encoding completed');
bit1=reshape(bit,[row,col]); N=sqrt(block); load trio; trionew=trio; Input=bit1; original=Input; target=Input; [filename, pathname] = uigetfile('*.txt', 'Pick secret message'); fid = fopen(filename); F = fread(fid); s = char(F'); fclose(fid); len=length(F); handles.lend=len; sz1=size(Input); segblock=sz1(1)/N; size1=sz1(1)*sz1(2); sz2=size(F); size2=sz2(1); if (len*8)<=(N*N) val=(N*N)-(len*8); j=1; for i=1:len k=8 ; while(k>=1) x(1,j)=bitget(F(i),k); k=k-1; j=j+1; end end for v=(len*8)+1:N*N x(1,v)=0; end Mc=size(sz1,1); Nc=size(sz1,2); Mm=size(sz2,1); Nm=size(sz2,2); message_vector=round(F./256); rand('state',34); for (kk=1:100) pn_sequence_h=round(rand(sz1/segblock,sz1/segblock)); end size1=N*N; sequence=reshape(abs(pn_sequence_h),[1,size1]); for z=1:size1 xored(1,z)=xor(x(z),sequence(z)); end mm=1; gg=1; segblock1=segblock^2; for z=1:size1 if xored(1,z)==1 a = not(bit(gg:gg+(segblock1-1))); trionew(mm:mm+(segblock1+1))=[Q2{z} Q1{z} a]; end mm=mm+(segblock1+2); gg = gg +segblock1; end %from this trionew i have derived final image"imshow(uint8(blocksn));" embedtrio=trionew; kn=segblock1; k1n=sqrt(kn); blocksn=[]; [r c]=size(embedtrio); len=r*c; pp=1; saf=1; sa=k1n; sbf=1; sb=k1n; while(pp<=len) a=embedtrio(pp); pp=pp+1; b=embedtrio(pp); pp=pp+1; mn=1; kj=1; for jj=1:kn if kj>k1n mn=mn+1; kj=1; end if embedtrio(pp)==0 output1(mn,kj)=a; pp=pp+1; kj=kj+1; else output1(mn,kj)=b; pp=pp+1; kj=kj+1; end end blocksn(saf:sa,sbf:sb)=output1; sbf=sb+1; sb=sbf+(k1n-1); if sb>row saf=sa+1; sa=saf+(k1n-1); sbf=1; sb=k1n; end end imshow(uint8(blocksn)); * %and from this image i want to extract "trionew" which i had above *
Answers (1)
Image Analyst
on 22 Jul 2014
I don't know what to do with this. Please read http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer and http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup and attach your baboon.jpg image.
3 Comments
See Also
Categories
Find more on Display Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!