what is the formula to divide an image into number of blocks?

2 ビュー (過去 30 日間)
anu
anu 2018 年 2 月 8 日
回答済み: Walter Roberson 2018 年 2 月 8 日
I know how to divide image into blocks using Matlab. But I want to know generalized formula to divide an image into blocks.
  1 件のコメント
Adam
Adam 2018 年 2 月 8 日
If you know how to do it in Matlab then it isn't really a Matlab question to understand the generalized maths.
You can divide an image up however you want though. There isn't one formula that works for every kind of dividing up you would ever want to do.

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

回答 (2 件)

KSSV
KSSV 2018 年 2 月 8 日

Walter Roberson
Walter Roberson 2018 年 2 月 8 日
Converting from block numbers to matrix indices:
starting matrix position in a direction = (block number in that direction, minus 1) times (block size in that direction), then plus 1
ending matrix position in a direction = (block number in that direction) times (block size in that direction), but never more than matrix size in that direction (because the last block in the direction might be a partial block)
Converting from matrix indices to block number:
block number in a direction = floor( (matrix position in that direction) minus 1) divided by block size in that direction) plus 1
For example if the block size was 64, the matrix index 219 would be block number floor((219-1)/64) + 1 = 4 in that direction. The first block would be index 1 to 64, the second block would be 65 to 128, the third block would be 129 to 192, the fourth block would be 193 to 256, so block #4 in the direction is correct for matrix index 219.

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by