spliting image to 16x16 blocks

hi i have an image with size 320x240 i want to split it to 16x16 blocks but i don't use for loop. i don't process these blocks and i only save theme that after 30 frame i do LBP 3d on it? can you help me

답변 (2개)

Jan
Jan 2013년 3월 4일

2 개 추천

SplitImage = reshape(Image, 16, 20, 16, 15);
SplitImage = permute(SplitImage, [1, 3, 2, 4]);
SplitImage = reshape(SplitImage, [16, 16, 300]);
Walter Roberson
Walter Roberson 2013년 3월 4일

0 개 추천

SplitImage = mat2cell(Image, 16 * ones(1, size(Image,1) / 16), 16 * ones(1, size(Image,2) / 16), size(Image,3));

댓글 수: 3

MAT2CELL does use a for-loop implicitly, though I suspect the OP is excessively concerned about loops.
Also, I'll just mention this file FEX:mat2tiles, which offers an easier interface.
SplitImage=mat2tiles(Image,[16,16]);
nadia naji
nadia naji 2013년 3월 4일
thanks for your help i use this function
Matt J
Matt J 2013년 3월 4일
Glad it does what you want, though if speed was your goal, Jan's method is about 4 times faster.

댓글을 달려면 로그인하십시오.

질문:

2013년 3월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by