Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Quadtree decomposition

`S = qtdecomp(I)`

`S = qtdecomp(I,threshold)`

`S = qtdecomp(I,threshold,mindim)`

```
S = qtdecomp(I,threshold,[mindim
maxdim])
```

`S = qtdecomp(I,fun)`

`qtdecomp`

is appropriate primarily for square images whose dimensions are a power of 2, such as 128-by-128 or 512-by-512. These images can be divided until the blocks are as small as 1-by-1. If you use`qtdecomp`

with an image whose dimensions are not a power of 2, at some point the blocks cannot be divided further. For example, if an image is 96-by-96, it can be divided into blocks of size 48-by-48, then 24-by-24, 12-by-12, 6-by-6, and finally 3-by-3. No further division beyond 3-by-3 is possible. To process this image, you must set`mindim`

to 3 (or to 3 times a power of 2); if you are using the syntax that includes a function,`fun`

, the function must return`0`

at the point when the block cannot be divided further.

The `qtdecomp`

function divides a square image into four equal-sized
square blocks, and then tests each block to see if it meets some criterion of
homogeneity. If a block meets the criterion, it is not divided any further. If it does
not meet the criterion, it is subdivided again into four blocks, and the test criterion
is applied to those blocks. This process is repeated iteratively until each block meets
the criterion. The result can have blocks of several different sizes.