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

Matt Kindig
Matt Kindig 2013년 8월 5일
How are the "small segments" defined? Are you trying to make a puzzle? Where does the encryption/decryption come into play?
Also, "provide necessary code!" comes across as demanding to the readers of this forum. At worst, someone with sufficient privileges could tag this with the "doit4me" tag, which would essentially doom your chances of getting any help from us. I'd recommend editing your question to a) provide more details as to what you are trying to do, and b) to come across as more polite and respectful of the time of the (volunteer) forum contributors.
Walter Roberson
Walter Roberson 2013년 8월 5일
Anyone with a reputation of 5 or higher can add tags.
vardhit
vardhit 2013년 8월 6일
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. :)

댓글을 달려면 로그인하십시오.

 채택된 답변

Jan
Jan 2013년 8월 6일
편집: Jan 2013년 8월 7일

1 개 추천

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

vardhit
vardhit 2013년 8월 6일
thank you for ur help :) i'll try it out !
vardhit
vardhit 2013년 8월 6일
i have a doubt regarding decryption. while encryption we jumbled the blocks randomly now if i want to decrypt the encrypted image,i have to put the blocks in its original location as before. how i can achieve that?
Jan
Jan 2013년 8월 6일
You have to store the result of randperm together with the image, e.g. in the comment section. Or you can replace the dynamic call of randperm by one specific reply of randperm.
vardhit
vardhit 2013년 8월 7일
편집: vardhit 2013년 8월 7일
here block,mix and scrambled are 4 d arrays. when i use command imshow or imwrite on them. it shows an error !
imshow(scrambled) ??? Error using ==> imageDisplayValidateParams>validateCData at 114 Unsupported dimension
Error in ==> imageDisplayValidateParams at 31 common_args.CData = validateCData(common_args.CData,image_type);
Error in ==> imageDisplayParseInputs at 79 common_args = imageDisplayValidateParams(common_args);
Error in ==> imshow at 199 [common_args,specific_args] = ...
Jan
Jan 2013년 8월 7일
Then use reshape(scrambled, 100, 100, 3) to obtain the standard RGB arrays.
Manpreet
Manpreet 2015년 4월 27일
Sir, On reshaping we will get a new image which will contains scrambled value only not image pixels value.
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

질문:

2013년 8월 5일

댓글:

2015년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by