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

1 Ansicht (letzte 30 Tage)
anu
anu am 8 Feb. 2018
Beantwortet: Walter Roberson am 8 Feb. 2018
I know how to divide image into blocks using Matlab. But I want to know generalized formula to divide an image into blocks.
  1 Kommentar
Adam
Adam am 8 Feb. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

KSSV
KSSV am 8 Feb. 2018

Walter Roberson
Walter Roberson am 8 Feb. 2018
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.

Community Treasure Hunt

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

Start Hunting!

Translated by