matlab - How to make face image scramble? -
i want scramble face image. don't know command in matlab programming make face scramble. please indicate me?
and want scramble shuffling pixels.
you combine randperm , reshape, this:
img = reshape(img(randperm(numel(img))), size(img));
alternative solution: "scramble pixel blocks"
you this:
img = imread('http://www.ricbit.com/uploaded_images/lena-713374.jpg'); blocksize = 64; nrows = size(img, 1) / blocksize; ncols = size(img, 2) / blocksize; scramble = mat2cell(img, ones(1, nrows) * blocksize, ones(1, ncols) * blocksize, size(img, 3)); scramble = cell2mat(reshape(scramble(randperm(nrows * ncols)), nrows, ncols)); subplot(1,2,1), imshow(img); title('source image'); subplot(1,2,2), imshow(scramble); title('scrambled image');
where blocksize
width , height of block, in pixels (ex.: 64 x 64)
note: blocksize must common factor of original image width , height values.
Comments
Post a Comment