EasyObject - Analyzing Blobs

EasyObject

Objects and holes found by the EasyObject library.

Purpose

EasyObject is the blob analysis library of eVision. A blob is a grouping of neighboring pixels of the same gray level range. The pixels from a blob are connected: there exists a path between any couple of pixels from the blob that is entirely within the blob. This is also called connected-componenent analysis.

EasyObject can be used on BW8 .NET Python, BW16 .NET Python and C24 .NET Python images and its processing can be restricted to ROIs and to complex regions.

Selecting Blobs in an Image

#include <eVision/EasyObject/EasyObject2/EImageEncoder.h>
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// Image encoder
EImageEncoder encoder;
// Coded image
ECodedImage2 codedImage;
// ...
// Encode the source image
encoder.Encode(srcImage, codedImage);
// Create a blob selection
EObjectSelection selection;
selection.AddObjects(codedImage);
// Remove the Small blobs
selection.RemoveUsingUnsignedIntegerFeature(EFeature_Area, 100, ESingleThresholdMode_Less);
// Retrieve the number of remaining blobs
unsigned int numBlobs = selection.GetElementCount();
// Sort the remaining blobs based on their area
selection.Sort(EFeature_Area, ESortDirection_Ascending);
// Retrieve the selected blobs
for (unsigned int index = 0; index < numBlobs; index++)
{
  float centerX = selection.GetElement(index).GetGravityCenterX();
  float centerY = selection.GetElement(index).GetGravityCenterY();
}
using eVision;
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// Image encoder
EImageEncoder encoder = new EImageEncoder();
// Coded image
ECodedImage2 codedImage = new ECodedImage2();
// ...
// Encode the source image
encoder.Encode(srcImage, codedImage);
// Create a blob selection
EObjectSelection selection = new EObjectSelection();
selection.AddObjects(codedImage);
// Remove the small blobs
selection.RemoveUsingUnsignedIntegerFeature(EFeature.Area, 100, ESingleThresholdMode.Less);
// Retrieve the number of remaining blobs
uint numBlobs = selection.ElementCount;
// Sort the remaining blobs based on their area
selection.Sort(EFeature.Area, ESortDirection.Ascending);
// Retrieve the selected blobs
for (uint index = 0; index < numBlobs; index++)
{
  float centerX = selection.GetElement(index).GravityCenterX;
  float centerY = selection.GetElement(index).GravityCenterY;
}
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# Image encoder
encoder = eVision.EImageEncoder()
# Coded image
codedImage = eVision.ECodedImage2()
# ...
# Encode the source image
encoder.Encode(src_image, codedImage)
# Create a blob selection
selection = eVision.EObjectSelection()
selection.AddObjects(codedImage)
# Remove the small blobs
selection.RemoveUsingUnsignedIntegerFeature(eVision.EFeature.Area, 100, eVision.ESingleThresholdMode.Less)
# Retrieve the number of remaining blobs
numBlobs = selection.ElementCount
# Sort the remaining blobs based on their area
selection.Sort(eVision.EFeature.Area, eVision.ESortDirection.Ascending)
# Retrieve the selected blobs
for index in range(numBlobs):
    centerX = selection.GetElement(index).GravityCenterX
    centerY = selection.GetElement(index).GravityCenterY

Contents

Process and Workflow

How EasyObject encodes images and builds blobs.

Process and Workflow
Encoding an Image

Segment and build blobs.

EasyObject - Encoding an Image
Objects, Holes, and their Features

Build holes and computes various features.

Objects, Holes and their Features
Selecting and Sorting Blobs

Select and sort objects and holes.

Selecting and Sorting Blobs
Object Template Matcher

Matching objects to a template.

Object Template Matcher
EChecker

Validate images using a Golden Template.

EChecker - Validating Golden Templates