MATLAB Answers


can i get the matlab code for scrambling a digital image based on arnold transformations??

Asked by sumaya
on 24 Mar 2014
Latest activity Commented on by Hyelda Kefas on 19 Feb 2018 at 11:39
clear all;
close all;
A = imread('cameraman.tif');
while t<T2
    for i=[0:N-1]
        for j=[0:N-1]


I tried your code but its seems like its not working. Its giving error of "Attempted to access iscram(0,0); index must be a positive integer or logical.

Error in ==> iscram(i,j)=iscram(mod(i+j,N),mod(i+(2*j),N)); "

how can i solve this error ??

Log in to comment.

2 Answers

Answer by Image Analyst
on 23 Nov 2014
Edited by Image Analyst
on 30 Dec 2016
 Accepted Answer

I don't really know what this code is doing or if I'm even doing it correctly, but here's a version of the code that "works": [OLD CODE DELETED]

[EDIT] - See vastly improved working code in my comment further down, and also attached here.


the code given above is only for square image right?? But i'm getting output for 135*298 image also...

I redid that code I posted, now that I understand it a little more, and a "fixed" version is attached. From Wikipedia, it seems that the code only works on square images. I tried to generalize it for rectangular images and always got the image wrapped around vertically. It never reconstituted itself. So maybe you'll have to use other scrambling methods.

Good day sir!!! Please sir i tried modifying the attached code above to read in two images that is the Original image and the Key image in the case of encryption then the scrambling and unscrambling procedures to get back the original image using Arnold's cat map but i keep getting errors. Please i need further help on it. Thanks for always being there for us.

Log in to comment.

Answer by Manpreet on 1 May 2015

I am doing a project on Image watermarking using Discrete Wavelet Transform(DWT) and Encryption. It is carried out in the following steps 1.) Select the host image( Image in which watermark will be hided). 2.) Select the watermark. 3.) Encrypt the watermark using the following code as given by sir(Image analyst) 4.) Watermarking using DWT.

5.) Recover the Encrypted watermark using recovery formula.

6.) Decryption of watermark using the following code which is also attached. This is also given by Image Analyst

My Question is that I have made many attacks on Watermarked Image like Rotation, Scaling, Croping but PSNR and MSE between (Watermark and Decrypted watermark) after and before attack remain Infinity and Zero respectively.

I think During Decryption, I have used same ran permutation that I used to ENCRYPT the image. So I think, Attacks have no effect on decrypted image.

Question is how to improve my code or what suggestions you can give me.

I need Help. Though, I am trying but yr valuable suggestions can make code more effective and fast



Manpreet you need to move your material here into a new Question. It is out of place here and probably no-one will even read it carefully until you create a new Question for it.

manpreet , could u please help me ..i m having a same problem with using RSA in watermarking.

Discussion of RSA or any other non-trivial encryption is not permitted here due to the laws of the USA.

Log in to comment.

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today