Drawing 2D Features from a List of E3DObjects

The code shows how to draw the ERegion of each extracted object.

C++

#include <eVision/Easy3D/Easy3DObject/E3DObjectExtractor.h>
#include <eVision/Easy/EGenericDrawAdapter.h>
using namespace eVision;
using namespace eVision::Easy3D;
E3DObjectExtractor extractor;
// Get the list of E3DObjects
std::vector<E3DObject> objects = extractor.GetObjects();

// Get the dimensions of the 2D feature
ERegion region = extractor.GetObjectsMask();

// Get an image on which to draw the 3D objects
EImageC24A image(region.GetBoundingBoxWidth(), region.GetBoundingBoxHeight());
EGenericDrawAdapter drawContext(&image);

// Draw the ERegion of each object
int nObjects = (int)objects.size();
for (int i = 0; i < nObjects; i++)
  objects[i].Draw(&drawContext, E3DObjectFeature_ERegion, ERGBColor(0, 255, 0));

C#

using eVision;
using eVision.Easy3D;
E3DObjectExtractor extractor = new E3DObjectExtractor();

// Get the list of E3DObjects
E3DObject[] objects = extractor.Objects;

// Get the dimensions of the 2D feature
ERegion region = extractor.ObjectsMask;

// Get an image on which to draw the 3D objects
EImageC24A image = new EImageC24A(region.BoundingBoxWidth, region.BoundingBoxHeight);
EGenericDrawAdapter drawContext = new EGenericDrawAdapter(image);

// Draw the ERegion of each object
int nObjects = objects.Length;
for (int i = 0; i < nObjects; i++)
  objects[i].Draw(drawContext, E3DObjectFeature.ERegion, new ERGBColor(0, 255, 0));

Python

import eVision
from eVision import Easy3D
extractor = Easy3D.E3DObjectExtractor()

# Get the list of E3DObjects
objects = extractor.Objects

# Get the dimensions of the 2D feature
region = extractor.ObjectsMask

# The drawing surface
display_img = eVision.EImageC24A(width=region.BoundingBoxWidth, height=region.BoundingBoxHeight)
draw_adapter = eVision.EGenericDrawAdapter(display_img)

# Draw the ERegion of each object
for object_i in objects:
    object_i.Draw(draw_adapter, Easy3D.E3DObjectFeature.ERegion, eVision.ERGBColor(0, 255, 0))