0

I am attempting to embed data from a text file(which contains only numeric data) into LL subband of an image using a steganography. I am getting an error "Error using bitset ASSUMEDTYPE must be an integer type name" in the line of code:

L(ii,jj)=bitset(L(ii,jj),1,stego(ii,jj));

I have attempted to run in debugger but I am having no luck. I think it must be something to do with the data type of L?? I have tried changing image to binary,double etc but I still get this error! Please can someone give me some advice on where I am going wrong?I have a insert my code below

 % loading cover image
img=imread('lena.bmp');
image=im2double(img); 


% get DWT of image
[LL,LH,HL,HH] = dwt2(image,'haar');

A = importdata('minutiaTest.txt');
I = dec2bin(A,8);

L=LL;

% determine size of LL subband 
Mc=size(L,1);   %Height
Nc=size(L,2);   %Width


% determine size of message object
Mm=size(I,1);   %Height
Nm=size(I,2);   %Width


for ii = 1:Mc
    for jj = 1:Nc
        stego(ii,jj)=I(mod(ii,Mm)+1,mod(jj,Nm)+1);
    end
end


for ii = 1:Mc
    for jj = 1:Nc
       L(ii,jj)=bitset(L(ii,jj),1,stego(ii,jj));
    end
end

stego_image = idwt2(LL,LH,HL,HH,'haar');
imwrite(uint8(stego_image),'stego.bmp');
figure; imshow(stego_image,title('Stego image'));
  • I get `Undefined function 'P' for input arguments of type 'double'.` because `P` doesn't exist as a variable and it thinks it's a function. You have a commented out line `%P=double(PI);`, but even so, there is no `PI`. You probably still have a matrix `P` lying around because you haven't cleared the memory yet. How would you normally calculate `P` with this code? – Reti43 Dec 16 '14 at 22:50
  • I changed to P=double(L) as I want to work with the LL subband but still same error. Would I change image to binary image? I dont know! – Hitmanpaddy Dec 16 '14 at 23:01
  • `bitset` requires a signed or unsigned integer array and `dwt2` returns floats. `double` only changes the precision, not the type of variable. Just a heads up, clean up your code to prevent confusion for everyone here and yourself. You have a lot of irrelevant code commented out and some that actually matters. For example, you have `dwt2(image,'haar');`, but `image=im2double(img);` is commented out. – Reti43 Dec 16 '14 at 23:10
  • OK thank you. Is there a way around this? Would I be on the correct track thinking uint8 instead of double? Can bitset still be used with DWT? – Hitmanpaddy Dec 16 '14 at 23:16
  • You can either use `dwt2` and round the floats to integers (not recommended because you lose information), or use the Integer Wavelet Transform or Lifting Scheme. Matlab has something like that in `lwt2`. Type `help lwt2` for more details. Another heads up, in your current code you modify `L`, but still use `LL` in `idwt2`. – Reti43 Dec 16 '14 at 23:31

0 Answers0