Image segmentation - Split and Merge (Quadtrees)

后端 未结 3 1082
囚心锁ツ
囚心锁ツ 2021-02-06 10:08

Is there an implementation for the split and merge method of image segmentation? any advice would be much appreciated.

3条回答
  •  死守一世寂寞
    2021-02-06 10:31

    What segmentation is about?

    Segmentation means division of your image into several connected regions. Basically, you could do segmentation with two definitions of region: you could define a region as a group of connected similar pixels, or a set of connected pixels surrounded by discontinuities (edges). Split and merge uses the first approach.

    Mathematically speaking: if your whole image is represented by the set of pixels (called R), than you would like to get subsets such as

    1. Segmentation is complete, so all subregions sum up to the whole R. Union of all regions is R1 U R2 U ... U Rn = R.
    2. Ri is connected.
    3. Regions are distinct. Ri∩Rj=∅ given that i≠j
    4. Regions have similar properties. This could be expressed by a function called the homogenity criterion (P). It should give TRUE for the members of the given region, and FALSE for all the other regions.
    5. Neighbor regions cannot been merged. For all regions P(Ri U Rj)=FALSE given that i≠j.

    What split and merge algorithm is about?

    So first, we have to choose a homogenity criterion. A homogenity criterion could be global (depending on the whole region) or local (depending on a small window of the region, and if it's true for all windows, than it's true for the region). A simple example could be the deviation from average should be smaller than a threshold. ∀pi∈Ri: |pi-μ|≤f*σ.

    The split and merge algorithm have two phases: the split, and the merge phase. In the split phase we recursively split regions into four subregions (starting with the whole image as one region) until our homogenity criterion is met in all subregions. It's easy to see that the 1-4 conditions of segmentation are met. We proceed to merge step in order to satisfy the 5th condition.

    In the merge step we check that P(Ri U Rj)=TRUE for each two neighbor regions, and merge the two regions. We repeat this step until no more changes are necessary. Now we met all the conditions, we had our image segmented into subregions.

    Pseudocode

    Here is a pseudocode to split and merge algorithm:

    1. Init: we have only one big region (the whole image).
    2. Split: If P(Ri)=TRUE proceed to next step. Otherwise subdivide Ri to four subregions and perform step 2 on them.
    3. Merge: If Ri and Rj are neighbors and P(Ri U Rj) = TRUE, merge the two regions, than repeat step 3. If there are no such regions we are finished.

提交回复
热议问题