I want to do RGB scrambling as part of image cryptography. While executing a code, I got an error message
"Subscript indices must either be real positive integers or logicals".
The code is given below;
iscram=cipher;
N=256;
T=1.4938*N+40.8689;
disp(T);
t=0;
T2=ceil(T);
disp(T2);
c=[T];
while t<T2
for i=[0:N-1]
for j=[0:N-1]
iscram(i,j)=iscram(mod(i+j,N),mod(i+(2*j),N));
end
end
t=t+1;
end
How do I solve this. Can anyone help me?

 採用された回答

Walter Roberson
Walter Roberson 2018 年 9 月 22 日

1 投票

MATLAB subscript start at 1 not 0

5 件のコメント

A.Mariya Jomet
A.Mariya Jomet 2018 年 9 月 24 日
then do I need to edit as i=(1:N) and j=(1:N)
Walter Roberson
Walter Roberson 2018 年 9 月 24 日
Yes. You might need to adjust your mod() calculation.
A.Mariya Jomet
A.Mariya Jomet 2018 年 9 月 25 日
Thank you so much. I did some adjustments in the mod calculation and got the results as per the requirement. Thank you for your suggestions.
rousol makki
rousol makki 2019 年 7 月 27 日
mrs mariya can you give me the code of this code please .... i realy need it in my project
Image Analyst
Image Analyst 2019 年 7 月 28 日
Like I said, it's Arnold's cat map and I gave code in my answer below. I've also attached it here. You can probably use that. It's been a while since she logged in so she may not answer you.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2018 年 9 月 22 日

1 投票

That looks like it's Arnold's cat map. See my Arnold's cat map demo, attached.

6 件のコメント

A.Mariya Jomet
A.Mariya Jomet 2018 年 9 月 24 日
Thank you. Sir, I am not familiar with these scrambling methods. I just need RGB scrambling for color image encryption. I require any simple method. is this the simplest method?
A.Mariya Jomet
A.Mariya Jomet 2018 年 9 月 24 日
@ Image Analyst I did the code you have provide. But didn't get any results, instead the program continue to execute with out ending. Why that so?
Walter Roberson
Walter Roberson 2018 年 9 月 24 日
Due to the laws of the United States, we cannot assist you on "encryption". On the other hand, we can suggest that some people are interested in the mathematical properties of "chaotic maps" such as the Arnold Cat Map.
A.Mariya Jomet
A.Mariya Jomet 2018 年 9 月 24 日
it's ok sir, thank you so much for your kind replay and valuable suggestion.
Image Analyst
Image Analyst 2018 年 9 月 24 日
編集済み: Image Analyst 2019 年 7 月 28 日
The Arnold's cat map is a way of scrambling, not encrypting, the image. I'm not changing the values really, just rearranging them. The original values are all still there. If you repeatedly run my cat map demo on the output, eventually the original RGB image will be recovered. So it's cyclic, periodic. After each iteration, you should get a scrambled image. Eventually you will see the original image displayed. Not sure what you meant by not getting any results - it should show a series of images - one at each iteration - like below.
For the toysflash.png demo image, you'll see in the command window:
Back to Original after 68 Iterations.
Elapsed time = 8.3 seconds.
A.Mariya Jomet
A.Mariya Jomet 2018 年 9 月 25 日
I got results by executing the code that you provided.But that wasn't exactly what I required. I did some adjustments in the mod() calculation part, by using the conditions provided in your code,and I got desired output. Thank you so much for your suggestions.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeEncryption / Cryptography についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by