regionYline

[ XITE Reference Manual | XITE home ]

Contents


Name

regionYline - split an image into homogenous regions

Syntax

 #include <xite/region.h>

 BiffStatus regionYline( IBAND input,
    region*** regions, int nc, int sort,
    int split, int* size );

Description

Makes a yline representation of the regions in the input image. At return, the regions pointer will point at an array of region pointers, indexable from 0 to size. Element 0 will always be nil, the other elements will point at region objects. The input image defines regions by the pixel values. All pixels with the same value belongs to the same object. A region is a connected (4- or 8-) set of pixels from the same object.

Every region struct has a pointer "ylines" to an array of yline pointers. This array is indexable on the interval region->ymin .. region->ymax. The yline pointers point to a list of yline structs, the list ends when yline->next == nil. Every such list represents all yline segments on the actual line in the input image, belonging to this region.

nc is neighbour connectedness - should be 4 or 8. If there is an object in the image with object number (pixel value) 0, the object is supposed to be the background, and the opposite nc value is applied to that object.

sort - sort the regions with respect to object number. The regions array will then point at the first region found in every object, the region->next pointer can be followed to see the other regions in the object. The regions array may have a lot of nil pointers, as it is indexed with object numbers.

split - split all objects, except an eventual backgroud object with object number 0, so that every region of an object will form an individual object. Useful for thresholded images.

Restrictions

input must have pixel type unsigned byte.

Return value

 0 => ok
 1 => Bad pixel type input band
 2 => Bad neighbour type, should be 4 or 8
 3 => Can't alloc enough virtual memory, too many regions

Example

 IBAND i;
 region **regs;
 int size;
 if (regionYline(i, &regs, 4, FALSE, TRUE, &size))
    ERROR(..);

See also

regionAnalyse(1), regionArea(3), regionConvexHull(3), regionCreate(3), regionDraw(3), regionFree(3), regionHisto(3), regionHistoUpdate(3), regionImoment(3), regionInsertYline(3), regionDeleteYline(3) regionEndInsert(3), regionXmean(3), regionYmean(3), regionMean(3), regionXmin(3), regionXmax(3), regionYmin(3), regionYmax(3), regionMinMax(3), regionCMoment(3), regionPMoment(3), regionMoment(3), regionPerform(3), regionPerimeter(3), regionIsPoint(3), regionPoint(3), regionSearch(3), regionSort(3), regionCopy(3), regionUnion(3), regionOverlap(3), regionNeighbor(3), regionVolume(3)

Author

Tor Lønnestad, BLAB, Ifi, UiO

Id

$Id: regionYline.c,v 1.33 1997/05/05 12:38:37 tor Exp $