Go to the source code of this file.
Functions | |
| void | HxSegmentationHistogram (HxSegmentation2d *seg, int getDim, double lowBin, double highBin, int nBin) |
| Compute the histogram of each blob in an HxSegmentation2d. More... | |
|
||||||||||||||||||||||||
|
Compute the histogram of each blob in an HxSegmentation2d. The result is stored as feature "Histogram" in a blob.
00020 {
00021 HxImageRep inputIm = seg->getInputImage();
00022 HxImageRep labeledIm = seg->getLabeledImage();
00023 for (HxBlob2dListConstIter b=seg->getBlobBegin() ; b<seg->getBlobEnd() ; b++) {
00024 HxBlob2d* blob = (*b);
00025 int nDim = (getDim <= 0) ? inputIm.pixelDimensionality() : 1;
00026 HxHistogram hist = HxHistogram(REAL_VALUE, nDim, lowBin, highBin, nBin,
00027 lowBin, highBin, nBin,
00028 lowBin, highBin, nBin);
00029 HxBoundingBox bb(blob->sizeMaer());
00030 bb = bb.translate(blob->startMaer());
00031
00032 HxTagList tags;
00033 HxAddTag(tags, "histogram", &hist);
00034 HxAddTag(tags, "getDim", getDim);
00035 HxAddTag(tags, "maskVal", blob->getLabel());
00036 HxAddTag(tags, "boundingBox", bb);
00037 inputIm.exportOpExtra("histogramMask", labeledIm, tags);
00038 blob->addFeature("Histogram", hist);
00039 }
00040 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001