How do I split my 200 pixel image up into 8 by 8?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a 200 pixel image (lena) that i need to split into patches, each one 25 x 25. Is there a way I can do this without manually doing the following?
lena11 = lena(1:25,1:25);
lena12 = lena(1:25,25:49);
lena21 = lena(25:49,1:25);
0 件のコメント
回答 (3 件)
Azzi Abdelmalek
2015 年 7 月 29 日
A=rand(200)
p=1:25:200
[ii,jj]=ndgrid(p,p)
out=arrayfun(@(x,y) A(x:x+24,y:y+24),ii,jj,'un',0)
0 件のコメント
Walter Roberson
2015 年 7 月 29 日
lenacell = mat2cell(lena, 25 * ones(1,8), 25 * ones(1,8), size(lena,3));
0 件のコメント
Image Analyst
2015 年 7 月 30 日
See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_split_an_image_into_non-overlapping_blocks.3F
It shows 2 ways - the mat2cell() way, and the indexing way like you showed.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Polygons についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!