divide an image into blocks

How can I divide an image into a specific number of blocks, stir them and get a new messy image?

回答 (1 件)

Matt J
Matt J 2019 年 9 月 26 日
編集済み: Matt J 2019 年 9 月 26 日

0 投票

Using mat2tiles,
it is very easy:
initialImage=imread('sherlock.jpg');
blocksize=[40,40,inf]; %must divide evenly into size(initialImage)
C=mat2tiles(initialImage,blocksize);
C(:)=C(randperm(numel(C)));
messyImage=cell2mat(C);
figure;
subplot(1,2,1);
imshow(initialImage);
subplot(1,2,2)
imshow(messyImage)

質問済み:

2019 年 9 月 25 日

編集済み:

2019 年 9 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by