Dinâmicas e Valores de Extinção (2)

Revisitado

Autor: rubens
Data: 26/03/2008

Resumo

Para testar nova implementação da MaxTree (com desempate) e criar testes para a toolbox.

// These values are previously calculated:
//     nn is the node attribute value
//     nc is the maximum value among the children attributes

if(nc > nn) {
    // the node will be extinguished; set its extinction value
    // and go to the next regional maximum
    aux1[i][j] = nn;
    break;
}
else if(nc == nn) {
    if(aux2[p][c] == 1) {
        // the node has a maximum attribute but it is not the first one;
        // the node will be extinguished; set its extinction value
        // and go to the next regional maximum
        aux1[i][j] = nn;
        break;
    }
    else {
        // this is the first node with attribute equal to the maximum;
        // set our flag and continue descending the tree
        aux2[p][c] = 1;
    }
}
SDC Morphology Toolbox for Python-numpy V1.6 12aug2011 (build 2000)

Valores de Extinção (área e altura)

Imagem Original.

(a)

(b)

(c)

(a) Máximos regionais. Valores de Extinção: (b) área, (c) altura.

Evolução dos Máximos Regionais (área)

*** A = 0 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="81" index="0" level="0" sx="450" sy="450" volume="1850" xmax="9" xmin="0" ymax="9" ymin="0">
        <node area="99" height="80" index="0" level="10" sx="441" sy="450" volume="1850" xmax="9" xmin="0" ymax="9" ymin="0">
            <node area="12" height="70" index="0" level="50" sx="60" sy="66" volume="600" xmax="6" xmin="4" ymax="7" ymin="4">
                <node area="2" height="30" index="0" level="80" sx="8" sy="9" volume="60" xmax="4" xmin="4" ymax="5" ymin="4"/>
                <node area="2" height="30" index="1" level="80" sx="11" sy="12" volume="60" xmax="6" xmin="5" ymax="6" ymin="6"/>
            </node>
            <node area="4" height="30" index="0" level="40" sx="6" sy="30" volume="120" xmax="2" xmin="1" ymax="8" ymin="7"/>
            <node area="12" height="10" index="0" level="20" sx="18" sy="14" volume="120" xmax="3" xmin="0" ymax="3" ymin="0"/>
            <node area="2" height="10" index="1" level="20" sx="17" sy="18" volume="20" xmax="9" xmin="8" ymax="9" ymin="9"/>
        </node>
    </node>
</maxtree>

*** A = 3 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="51" index="0" level="0" sx="450" sy="450" volume="1710" xmax="9" xmin="0" ymax="9" ymin="0">
        <node area="99" height="50" index="0" level="10" sx="441" sy="450" volume="1710" xmax="9" xmin="0" ymax="9" ymin="0">
            <node area="12" height="40" index="0" level="50" sx="60" sy="66" volume="480" xmax="6" xmin="4" ymax="7" ymin="4"/>
            <node area="4" height="30" index="0" level="40" sx="6" sy="30" volume="120" xmax="2" xmin="1" ymax="8" ymin="7"/>
            <node area="12" height="10" index="0" level="20" sx="18" sy="14" volume="120" xmax="3" xmin="0" ymax="3" ymin="0"/>
        </node>
    </node>
</maxtree>

*** A = 5 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="51" index="0" level="0" sx="450" sy="450" volume="1590" xmax="9" xmin="0" ymax="9" ymin="0">
        <node area="99" height="50" index="0" level="10" sx="441" sy="450" volume="1590" xmax="9" xmin="0" ymax="9" ymin="0">
            <node area="12" height="40" index="0" level="50" sx="60" sy="66" volume="480" xmax="6" xmin="4" ymax="7" ymin="4"/>
            <node area="12" height="10" index="0" level="20" sx="18" sy="14" volume="120" xmax="3" xmin="0" ymax="3" ymin="0"/>
        </node>
    </node>
</maxtree>

*** A = 13 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="11" index="0" level="0" sx="450" sy="450" volume="990" xmax="9" xmin="0" ymax="9" ymin="0">
        <node area="99" height="10" index="0" level="10" sx="441" sy="450" volume="990" xmax="9" xmin="0" ymax="9" ymin="0"/>
    </node>
</maxtree>

(a) A = 0: 5 regional maxima.

(b) A = 3: 3 regional maxima.

(c) A = 5: 2 regional maxima.

(d) A = 13: 1 regional maxima.

Evolução dos máximos regionais.

Evolução dos Máximos Regionais (altura)

*** H = 0 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="81" index="0" level="0" sx="450" sy="450" volume="1850" xmax="9" xmin="0" ymax="9" ymin="0">
        <node area="99" height="80" index="0" level="10" sx="441" sy="450" volume="1850" xmax="9" xmin="0" ymax="9" ymin="0">
            <node area="12" height="70" index="0" level="50" sx="60" sy="66" volume="600" xmax="6" xmin="4" ymax="7" ymin="4">
                <node area="2" height="30" index="0" level="80" sx="8" sy="9" volume="60" xmax="4" xmin="4" ymax="5" ymin="4"/>
                <node area="2" height="30" index="1" level="80" sx="11" sy="12" volume="60" xmax="6" xmin="5" ymax="6" ymin="6"/>
            </node>
            <node area="4" height="30" index="0" level="40" sx="6" sy="30" volume="120" xmax="2" xmin="1" ymax="8" ymin="7"/>
            <node area="12" height="10" index="0" level="20" sx="18" sy="14" volume="120" xmax="3" xmin="0" ymax="3" ymin="0"/>
            <node area="2" height="10" index="1" level="20" sx="17" sy="18" volume="20" xmax="9" xmin="8" ymax="9" ymin="9"/>
        </node>
    </node>
</maxtree>

*** H = 4 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="71" index="0" level="0" sx="450" sy="450" volume="1630" xmax="9" xmin="0" ymax="9" ymin="0">
        <node area="99" height="70" index="0" level="10" sx="441" sy="450" volume="1630" xmax="9" xmin="0" ymax="9" ymin="0">
            <node area="12" height="60" index="0" level="50" sx="60" sy="66" volume="560" xmax="6" xmin="4" ymax="7" ymin="4">
                <node area="2" height="20" index="0" level="70" sx="8" sy="9" volume="40" xmax="4" xmin="4" ymax="5" ymin="4"/>
                <node area="2" height="20" index="1" level="70" sx="11" sy="12" volume="40" xmax="6" xmin="5" ymax="6" ymin="6"/>
            </node>
            <node area="4" height="20" index="0" level="30" sx="6" sy="30" volume="80" xmax="2" xmin="1" ymax="8" ymin="7"/>
        </node>
    </node>
</maxtree>

*** H = 8 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="45" index="0" level="0" sx="450" sy="450" volume="1398" xmax="9" xmin="0" ymax="9" ymin="0">
        <node area="99" height="44" index="0" level="10" sx="441" sy="450" volume="1398" xmax="9" xmin="0" ymax="9" ymin="0">
            <node area="12" height="34" index="0" level="44" sx="60" sy="66" volume="408" xmax="6" xmin="4" ymax="7" ymin="4"/>
        </node>
    </node>
</maxtree>

*** H = 13 ***
<?xml version="1.0" ?>
<maxtree>
    <node area="100" height="1" index="0" level="0" sx="450" sy="450" volume="0" xmax="9" xmin="0" ymax="9" ymin="0"/>
</maxtree>

(a) H = 0: 5 regional maxima.

(b) H = 4: 3 regional maxima.

(c) H = 8: 1 regional maxima.

(d) H = 13: 1 regional maxima.

Evolução dos máximos regionais.

A MaxTree

1 mxt = maxtree(img)
2 
3 idx = maxgetindex(mxt)
4 
5 cb1 = chessboard_image(img)
6 cb2 = chessboard_image(idx)
7 adshow(cb1, title='Level')
8 adshow(cb2, title='Index')

Level

Index

MaxTree Nodes