フィルターのクリア

How to scramble an image?

18 ビュー (過去 30 日間)
Sneha P S
Sneha P S 2018 年 4 月 26 日
コメント済み: Walter Roberson 2018 年 5 月 13 日
I need to scramble an image and want to get back the orginal image. So i used the below code
im = imread('cameraman.tif');
vec = randperm(numel(im));
vec = reshape(vec, size(im));
out = im(vec);
%To reconstruct the original image
reconstruct = zeros(size(im), class(im));
reconstruct(vec) = out;
But here each time the scrambling is done randomly. Is there any method to scramble the same pixels all the time. That is how to choose the pixels to change. Please help me with this as it is an urgent need.
  2 件のコメント
Sneha P S
Sneha P S 2018 年 4 月 26 日
Please help me with this problem
Walter Roberson
Walter Roberson 2018 年 5 月 13 日

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

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 4 月 26 日
Add this add beginning of your code
rng(10); % you can use any number.
this will seed random number generator with same value every time.

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by