segmRandom

[ XITE Reference Manual | XITE home ]

Name

segmRandom - draw two regions, random border

Syntax

 #include <xite/segmentation.h>

 int segmRandom( IBAND band, double prob[3][2],
    int lpv, int rpv );

Description

<band> is altered into a band with two regions with value <lpv> (left pixel value) on the left part, and <rpv> on the right. The border separating the regions is made with a kind of random walk, or 2. order markow process, starting in the center of the upper line. In each step, the border may go down-left (here denoted left), down, or down-right (right).

The probablity of going in each of the three directions left, down and right, are given in the table prob. The three rows in the table indicating the prevous direction of the walk. The two columns in the table is the probability for going left and right. The probability for going down is computed, because the total probability always is equal one.

 The table <prob>:
   prob[0][0] = p(left | left)
   prob[1][0] = p(left | down)
   prob[2][0] = p(left | rigth)
   prob[0][1] = p(right | left)
   prob[1][1] = p(right | down)
   prob[2][1] = p(right | right)

Restrictions

Accepts only UNS_BYTE pixles.

Return value

 0 : OK
 2 : Bad pixle type
 3 : Bad probabilities
 4 : Bad pixel values

Author

Martin Torpe Lie, BLAB, ifi, UiO

Id

$Id: segmRandom.c,v 1.16 1996/11/08 14:05:22 svein Exp $