I am working on image steganography code using MATLAB and s, n, p are calculated values which I am getting as per requirement but struggling to get “Bits_to_Modify ” column result shown in below table
Output of Existing program
First converting text to bytes, then calculating index variable (called as p) & formula is MOD(No of Bytes,3).I have text length as 2 bytes so Index Variable (P) is 2..Code:My text=’ab’ TextLength=2 Binary representation of text: s= 0110000101100010 n=8 (Textlength*4) p= 2 0 1 2 0 1 2 0
I will always have index variable values as 0 or 1 or 2 which will be based on no. of Bytes I have assigned
so on till end of my bits.for first two bits (01) , index variable assigned as 2
for next two bits (10), index variable assigned as 0
for next two bits (00), index variable assigned as 1
for next two bits (01), index variable assigned as 2..
In 5th Pixel need to embed the data bits 01 in 6th and 8th bit locations, and next value of p becomes 0. Need to embed the next data bits 10 into 6th Pixel in 6th and 7th bit locations, next value of p becomes 1. Now need to embed the next two bits 00 into 7th Pixel in 7th and 8th bit locations and so on.
QuestionCode:Pixcel IndexVariable Bits_to_Modify 5 2 b6=0 b8=1 6 0 b6=1 b7=0 7 1 b7=0 b8=0 8 2 b6=0 b8=1 9 0 b6=0 b7=1 10 1 b7=1 b8=0 11 2 b6=0 b8=0 12 0 b6=1 b7=0
I have written the following program syntax most same to C, taking above values of S,n & P which i am getting
but it dont give following output..It keeps repeating values in output..I have tried logic on paper and looks correct. Please provide me direction for what i am missing in logic
Code:for j=0:2:2*n-2 for i=1:1:n if p(i)==2 p1= p(i) pv=(i+4) b6=s(j+1) b8=s(j+2) end if p(i)==0 p1= p(i) pv=(i+4) b6=s(j+1) b7=s(j+2) end if p(i)==1 p1= p(i) pv=(i+4) b7=s(j+1) b8=s(j+2) end end end
Code:p1=2 pv=5 b6=0 b8=1 p1=0 pv=6 b6=1 b7=0 p1=1 pv=7 b7=0 b8=0 p1=2 pv=8 b6=0 b8=1 p1=0 pv=9 b6=0 b7=1 p1=1 pv=10 b7=1 b8=0 p1=2 pv=11 b6=0 b8=0 p1=0 pv=12 b6=1 b7=0