Function File: blk_size = bestblk (IMS)
Function File: blk_size = bestblk (IMS, max)
Function File: [Mb, Nb, …] = bestblk (…)

Calculate block best size for block processing.

Given a matrix of size IMS, calculates the largest size for distinct blocks blk_size, that minimize padding and is smaller than or equal to k (defaults to 100)

The output blk_size is a row vector for the block size. If there are multiple output arguments, the number of rows is assigned to the first (Mb), and the number of columns to the second (Nb), etc.

To determine blk_size, the following is performed for each dimension:

  1. If dimension IMS is less or equal than k, it returns the dimension value.
  2. If not, find the highest value between min (dimension/10, k/2) which minimizes padding.

See also: blockproc, col2im, im2col.

Demonstration 1

The following code

 siz = bestblk ([200; 10], 50);
 disp (siz)

Produces the following output

50   10

Package: image