Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxImageToSegmentation.h File Reference

More...

#include "HxImageRep.h"

Go to the source code of this file.

Functions

HxSegmentation2dHxImageToSegmentation (HxImageRep input, HxImageRep segments, int connectivity, int minArea)
 Convert image segments to an HxSegmentation2d. More...


Detailed Description


Function Documentation

HxSegmentation2d* HxImageToSegmentation HxImageRep    input,
HxImageRep    segments,
int    connectivity,
int    minArea
 

Convert image segments to an HxSegmentation2d.

00259 {
00260     HxTagList tags;
00261     HxAddTag(tags, "connectivity", connectivity);
00262     HxAddTag(tags, "minArea", minArea);
00263 
00264     HxSegmentation2d* seg = new HxSegmentation2d();
00265     seg->setInputImage(input);
00266     HxAddTag(tags, "segmentation", seg);
00267 
00268     HxImageRep labeled = segments.queueBasedOp(segments, "ImageToSegmentation",
00269                                                tags);
00270     seg->setLabeledImage(labeled);
00271 
00272     // because in filling the neigbours list, we were looking only in the past,
00273     // not in the future we still have to make the list of neigbours symetric
00274     HxBlob2dRelation* relation = seg->getRelation("neighbours");
00275     for (HxBlob2dListConstIter bi=relation->getBlobBegin() ; 
00276                                bi<relation->getBlobEnd() ; bi++) {
00277         HxBlob2dListConstIter bj = bi;
00278         bj++;
00279         HxBlob2dListBackInserter ins = relation->findRelatedBlobsInserter(*bi);
00280         for ( ; bj<relation->getBlobEnd() ; bj++) {
00281             for (HxBlob2dListConstIter bk = relation->findRelatedBlobsBegin(*bj) ;
00282                                        bk < relation->findRelatedBlobsEnd(*bj) ;
00283                                        bk++) {
00284                 if ((*bi)->getLabel() == (*bk)->getLabel()) {
00285                     *ins++ = *bj;
00286                 }
00287             }
00288         }
00289     }
00290     return seg;
00291 }


Generated on Tue Feb 3 14:18:48 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001