VisionX HowTos

How to implement an object localizer

If you object localizer is purely image based, there is a framework prepared that you can use and fill with your own functionality. Follow these instructions on implementing an ObjectLocalizationProcessor: Implementing RGB ObjectLocalizerProcessors

Otherwise, you need to implement the Ice interface memoryx::ObjectLocalizerInterface. Depending on the input you use you should also inherit from the visionx::PointCloudProcessor or visionx::PointCloudAndImageProcessor. If you encounter compilation problems due to multiple inheritance, follow the instructions here: I have compilation problems due to multiple inheritance.

Essentially, you have to implement the function ObjectLocalizationResultList localizeObjectClasses(ObjectClassNameList objectClassNames) from the interface. The input is a list of (usually just one) object names, and the output is a list of localization results. You can potentially return several results for the same object.

This function is automatically called by MemoryX when somebody requested the localization of an object. The appropriate localizer for the object is saved in the object class in the memory (usually either in PriorKnowledge or LongtermMemory). When the object is in the PriorKowledge, the localizer can be set using the PriorKnowledgeEditor gui plugin. Otherwise, the localizer for an object class can be set like this:

...
// create object class (or get it from somewhere)
memoryx::ObjectClassPtr newObjectClass = memoryx::ObjectClassPtr(new memoryx::ObjectClass());
newObjectClass->setName(objectName);
// set localizer and default motion model
memoryx::ObjectRecognitionWrapperPtr recognitionWrapper = newObjectClass->addWrapper(new memoryx::ObjectRecognitionWrapper());
recognitionWrapper->setDefaultMotionModel("Static");
recognitionWrapper->setRecognitionMethod("MyGloriousLocalizer");
ObjectRecognitionWrapper.h
memoryx::EntityWrappers::ObjectRecognitionWrapperPtr
IceInternal::Handle< ObjectRecognitionWrapper > ObjectRecognitionWrapperPtr
Definition: ObjectRecognitionWrapper.h:56
MemoryXCoreObjectFactories.h
memoryx::ObjectClass
Definition: ObjectClass.h:37
memoryx::ObjectClassPtr
IceInternal::Handle< ObjectClass > ObjectClassPtr
Definition: ObjectClass.h:35