Function File: [vals] = qtgetblk (I, S, dim)
Function File: [vals,idx] = qtgetblk (I, S, dim)
Function File: [vals,r,c] = qtgetblk (I, S, dim)

Obtain block values from a quadtree decomposition.

[vals]=qtgetblk(I,S,dim) returns a dim-by-dim-by-k array in vals which contains the dim-by-dim blocks in the quadtree decomposition (S, which is returned by qtdecomp) of I. If there are no blocks, an empty matrix is returned.

[vals,idx]=qtgetblk(I,S,dim) returns vals as described above. In addition, it returns idx, a vector which contains the linear indices of the upper left corner of each block returned (the same result as find(full(S)==dim)).

[vals,r,c]=qtgetblk(I,S,dim) returns vals as described, and two vectors, r and c, which contain the row and column coordinates of the blocks returned.

See also: qtdecomp, qtsetblk.

Demonstration 1

The following code

 [vals,r,c]=qtgetblk(eye(4),qtdecomp(eye(4)),2)
 % Returns 2 blocks, at [1,3] and [3,1] (2*2 zeros blocks)

Produces the following output

vals =

ans(:,:,1) =

   0   0
   0   0

ans(:,:,2) =

   0   0
   0   0

r =

   3
   1

c =

   1
   3

Package: image