image scrambling in matlab

3 Ansichten (letzte 30 Tage)
vardhit
vardhit am 5 Aug. 2013
i want to simply divide a given digital image into small segments and scramble them(jumble). thus encrypting them and also decrypt them.plz help
  3 Kommentare
Walter Roberson
Walter Roberson am 5 Aug. 2013
Anyone with a reputation of 5 or higher can add tags.
vardhit
vardhit am 6 Aug. 2013
thanx for your reply :) you are right...i apologize for the same :) i want a simple encryption technique using scrambling. i am a newbie that is why i asked for code/function. i want an image to be split into smaller images(cells). if i have 100x100 pixel image .then i want it to be divided into 10x10 smaller segments. i want them to be scrambles/jumbled so that the original image is hidden. i also want to decrypt it. plz guide me. :)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 6 Aug. 2013
Bearbeitet: Jan am 7 Aug. 2013
If you are talking about an RGB image:
img = rand(100, 100, 3);
block = reshape(img, [10, 10, 10, 10, 3]);
block = permute(block, [1, 3, 2, 4, 5]);
block = reshape(block, [100, 10, 10, 3]);
mix = randperm(100);
scrambled = reshape(block(mix, :, :, :), 100, 100, 3); % EDITED: reshape added
And the descrambling runs the other way around.
  7 Kommentare
Manpreet
Manpreet am 27 Apr. 2015
Sir, On reshaping we will get a new image which will contains scrambled value only not image pixels value.
Walter Roberson
Walter Roberson am 4 Mai 2015
No, Manpreet, the code Jan provided moves all three bit planes for a pixel together and does not change the representation. Every output pixels has an RGB that can be tracked directly to an input pixel. If you wish to verify this experimentally then replace Jan's original line
img = rand(100,100,3);
with
img = repmat(reshape(1:100*100)/(100*100),[100,100]), [1, 1, 3]);
this will produce an RGB image containing shades of grey, with the R, G, and B all being the same. You can image() it to observe this. Then when you look at the resulting image "scrambled" you will find that it continues to contain shades of grey and that the R, G, and B planes for any one location are all the same, and differ from every other location; this establishes that the planes were all moved together and establishes that the values are just moved around, not calculated or interpolated.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 5 Aug. 2013
Try the File Exchange, and you might find similar things to what you want, such as the 15 tile sliding puzzles:

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by