Error in matlab code

hello Experts,
I am getting an error in this code which is shown on this image. Plus I assigned b=1 but it is showing 393.

Any help would be appreciated.

Hello marie.

Without the full code, it is difficult to know exactly what is happening.

From what i can gather, the issue is the argument passed to the array dct2. So, whatever watermarked_image() is returning, is exceeding size(dct2).

If you post more code, and post it as text (not an image), then I can run it myself, and will be able to help a lot more.

Hope this helps.

I managed to get an output, by changing the following:

% Around line 44
ind_2 = b:b+blocksize-1;
ind_1 = a:a+blocksize-1;

Just switch the arrays around. If this inverts your image, I am not sure, but this way the sizes matched up.

Also, trying to write to a file named: dct_wa:ermarked_lenal.jpg caused some issue. I am not sure why.
So, I changed the file name. (Around Line 88)

I hope this helps

1 Like