Function Reference
— Function File: siz = bestblk ([m n], k)
— Function File: [mb nb] = bestblk ([m n], k)

Calculates the best size of block for block processing.

siz=bestblk([m,n],k) calculates the optimal block size for block processing for a m-by-n image. k is the maximum side dimension of the block. Its default value is 100. siz is a row vector which contains row and column dimensions for the block.

[mb,nb]=bestblk([m,n],k) behaves as described above but returns block dimensions to mb and nb.

Algorithm:

For each dimension (m and n), it follows this algorithm:

1.- If dimension is less or equal than k, it returns the dimension value.

2.- If not then returns the value between round(min(dimension/10,k/2)) which minimizes padding.

See also: blkproc

Demonstration 1

The following code

 siz=bestblk([200;10],50)
 # Best block is [20,10]

Produces the following output

siz =

   20
   10