필터 지우기
필터 지우기

How do I split my 200 pixel image up into 8 by 8?

조회 수: 2 (최근 30일)
tash7827
tash7827 2015년 7월 29일
답변: Image Analyst 2015년 7월 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);

답변 (3개)

Azzi Abdelmalek
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)

Walter Roberson
Walter Roberson 2015년 7월 29일
lenacell = mat2cell(lena, 25 * ones(1,8), 25 * ones(1,8), size(lena,3));

Image Analyst
Image Analyst 2015년 7월 30일
It shows 2 ways - the mat2cell() way, and the indexing way like you showed.

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by