Skip to content
Beat Küng edited this page Jul 16, 2012 · 3 revisions

Table of Contents

Overview

This function block offers two distinct operation groups:

  • Labeling: Finds regions in a binary (black/white) input image and calculates labels as well as bounding rectangles around them.
  • Image moments: Calculates a number of image moments from a labeled binary input image. Already present results are reused, i.e. if an image moment requires the object perimeter as in input variable, it does not unnecessarily recalculate it if this value has already been calculated.
Comments in the code are in german.

Credits

Implemented by Martin Kurmann and Sandro Gort as part of their Bachelor Thesis. Many thanks for their contribution!

Dependencies

Oscar modules:

API (Labeling)

regionLabeling

Calculates the perimeter of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_BOUNDINGBOX *bb: Resulting bounding boxes around the objects and their label.
Return value:
  • void

API (Image moments)

getPerimeter

Calculates the perimeter of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated perimeter will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void

getArea

Calculates the area of an object in the give image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated area will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void

getCompactness

Calculates the compactness (Perimeter^2/Area) of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated compactness will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void

getBalancePoint

Calculates the mass centre of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated mass centre will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void

getContourBalancePoint

Calculates the mass centre of the contour of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated mass centre will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void

getFourier

Calculates the Fourier spectrum of the contour of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated Fourier Magnitude will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void

numberOfHoles

Calculates the number of holes of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated number of holes will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void

meanDistance2BalancePoint

Calculates the mean distance of the contour to the balance point of an object in the given image region.

Arguments:

  • uint8* pBw: Image region to analyze.
  • uint32 width: Width of the image region.
  • uint32 height: Height of the image region.
  • struct G_DESCRIPTOR *descr: Object descriptor where the calculated distance will be stored.
  • struct G_BOUNDINGBOX *bb: Bounding box in the image region containing the object and its label.
Return value:
  • void
Clone this wiki locally