| Customize Help

Blob reconstruction



Although the Blob Analysis module is used mainly for blob feature calculation purposes, some of the Mblob...() functions can be used to perform blob image reconstruction. An example of this is the MblobReconstruct() function.

Blob reconstruction allows you to remove small particles in an image without distorting the shape of the remaining blobs, which can occur when successive erosion or dilation operations are performed on an image.

Using the different operations of the MblobReconstruct() function, you can:

  • Reconstruct blobs from a seed image. The M_RECONSTRUCT_FROM_SEED operation copies to the destination buffer only those blobs that have a corresponding seed pixel in the seed buffer. Blobs that are not seeded are replaced according to the selected processing mode.

    Note that when performing this operation in grayscale processing mode and with M_FOREGROUND_ZERO set, blobs in the source image which are not seeded are filled with the average grayscale value of the background.

  • Delete blobs that touch a border of the image. The M_ERASE_BORDER_BLOBS operation copies only those blobs that do not touch the border to the destination buffer.

    Note that when performing this operation in grayscale processing mode and with M_FOREGROUND_ZERO set, border blobs are filled with the average grayscale value of the background.

  • Fill holes in blobs. The M_FILL_HOLES operation copies the source buffer to the destination buffer, filling those blobs that contain holes according to the selected processing mode. Holes that touch the image border are not considered to be holes.

    Note that when performing this operation in grayscale processing mode, the holes are filled with the average grayscale value of the blob.

  • Extract holes from blobs. The M_EXTRACT_HOLES operation copies only the holes within the blobs found in the source buffer. Holes that touch the image border are not considered to be holes.

    Note that when performing this operation in grayscale processing mode, the copied blob holes are filled with the average grayscale value of the blob in the source buffer. Also, when using the grayscale mode with M_FOREGROUND_ZERO set, the blobs are filled with the average grayscale value of the background.

Finally, you can perform other types of blob reconstruction by calling specific MIL functions, one after the other. For example, to fill all blobs with a required value, use MblobSelect() in conjunction with MblobDraw() and/or MblobLabel(). You can use MblobLabel() to fill the blobs with their label values. You could use M_DRAW_BLOBS to fill the blobs with a user-specified value. Alternatively, you could use M_DRAW_BLOBS_CONTOUR + M_DRAW_HOLES_CONTOUR to only fill the borders of the blobs with the user-specified value.