フィルターのクリア

how to divide a picture into 25 pieces and display in one figure randomly?

2 ビュー (過去 30 日間)
Dimitri
Dimitri 2015 年 3 月 13 日
編集済み: Dimitri 2015 年 3 月 13 日
Hello everyone,
I'm willing to divide a picture into 25 pieces 5X5 and display them in one figure randomly, any suggestions ?
thanks ,
Dimitri

採用された回答

Michael Haderlein
Michael Haderlein 2015 年 3 月 13 日
One way:
img=imread('test.jpg'); %read the image
cimg=mat2cell(img(1:5*fix(end/5),1:5*fix(end/5),:),fix(size(img,1)/5)*ones(5,1),fix(size(img,2)/5)*ones(1,5),3); %divide it into 5x5 parts - if one dimension is not multiple of 5, the remaining elements will be cleared!
scimg=reshape(cimg(randperm(25)),5,5); %shuffle the pieces
simg=cell2mat(scimg); %put them back to an image
figure, imshow(img), figure, imshow(simg) %display both the ordered and the mixed image
  1 件のコメント
Dimitri
Dimitri 2015 年 3 月 13 日
編集済み: Dimitri 2015 年 3 月 13 日
thank you very much !

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by