# how to divide image into 25 equal parts

4 ビュー (過去 30 日間)
neha agarwal 2017 年 6 月 29 日

i want to divide image into 25 equal parts

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

### 回答 (2 件)

Kevin Xia 2017 年 6 月 29 日
You can use mat2tiles, which is available here for download: http://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-inarray-varargin- . You'll have to crop/resize the image to make the dimensions dividable by 5 though.
##### 0 件のコメント-2 件の古いコメントを表示-2 件の古いコメントを非表示

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

DGM 2022 年 3 月 22 日
If the image geometry is integer-divisible by the tiling, then you can use mat2cell() or direct indexing.
Since this question is underspecified, I'm going to assume that the image geometry is not necessarily integer-divisible by 5 or 25. How such cases are handled depends on the intent.
MIMT (File Exchange) has tools that can tile multiframe images into single-frame images, and also do the reverse. MIMT imdetile() can take any single-frame image and split it into any rectangular tiling, regardless of geometry. The user can optionally specify how the image is to be fit to the required tiling.
Consider the simple example:
inpict = imread('peppers.png'); % 384x512x3
stack = imdetile(inpict,[5 5]); % 77x102x3x25
In this case, the image is obviously not integer-divisible by 5. For the sake of viewing, I'm showing the result as a padded montage. The 4D stack can be processed using basic indexing.

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

### カテゴリ

Help Center および File ExchangeImages についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by