버전 (2.88 KB) 작성자: Jurgen
Split image or matrix into subparts using simple syntax.
다운로드 수: 1.2K
업데이트 날짜: 2013/5/2

라이선스 보기

Divide image/matrix into cell array of blocks. Can specify per dimension in how many pieces it needs to divide. See examples in help section for a quick idea of how it works.

I = imsplit(im,2) splits image into 2x2 blocks etc.

I = imsplit(rgb,3,3) splits an rgb image 'rgb' into 1x1x3 cell array containing colorplanes.

Instead of a mat2cell wrapper this uses my own implementation of indexing (using permute) to split matrices into smaller and smaller pieces.
Since MATLAB's Answers get a lot of those submatrix questions I thought I'd share what I made.

No handling of uneven divisions, ie can not divide 400 pixel width into 3 blocks--common usage with images is crop or resize, then split. Recommend mat2cell or Matt J's mat2tiles(File ID: #35085) for uneven blocks.

May be faster if use a wrapper for mat2cell, but still pretty fast in its own right.

If you have imdisp() you can display the resulting cell array as you would an image. The illustration was created using imdisp with the 'bordersize' option to add 1% margins between the blocks.

인용 양식

Jurgen (2024). Imsplit (, MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2008a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
Help CenterMATLAB Answers에서 Neighborhood and Block Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보

Patched cell indexing. Cell2mat() should return original for all outputs now.

Expanded description