32 #include <Color/ColorParameterSet.h>
33 #include <Visualizer/OpenGLVisualizer.h>
34 #include <ObjectFinder/ObjectFinderStereo.h>
45 static const std::size_t SegmentableBitmapWidth = 64;
46 static const std::size_t SegmentableBitmapSize = SegmentableBitmapWidth * SegmentableBitmapWidth;
48 static const std::size_t SegmentableBitmapUInt32Size = SegmentableBitmapSize / 32;
55 std::uint32_t
bitmap[SegmentableBitmapUInt32Size];
68 std::unique_ptr<SegmentableTemplateHeader>
data;
69 std::unique_ptr<CFloatMatrix>
model;
79 static inline Eigen::Vector3f stringToVector3f(std::string propertyValue)
82 sscanf(propertyValue.c_str(),
"%f, %f, %f", &vec.data()[0], &vec.data()[1], &vec.data()[2]);
89 defineOptionalProperty<std::string>(
"ColorParameterFile",
"VisionX/examples/cebit-colors.txt",
"The color parameter file configures the colors used for segmentable recognition (usually colors.txt)");
90 defineOptionalProperty<int>(
"MinPixelsPerRegion", 6000,
"Minimum number of pixels per region for detecting a uniformly colored object");
91 defineOptionalProperty<float>(
"MaxEpipolarDistance", 12,
"Maximum epipolar line distance allowed for a valid 3D recognition result");
93 defineOptionalProperty<std::string>(
"TemplatePath",
"VisionX/templates");
98 defineOptionalProperty<Eigen::Vector3f>(
"MinPoint", Eigen::Vector3f(-3000.0f, -3000.0f, 100.0f),
"min point for valid result bounding box").setFactory(f);
99 defineOptionalProperty<Eigen::Vector3f>(
"MaxPoint", Eigen::Vector3f(3000.0f, 3000.0f, 3500.0f),
"max point for valid result bounding box").setFactory(f);
101 defineOptionalProperty<float>(
"TemplateMatchThreshold", 0.7f,
"");
102 defineOptionalProperty<float>(
"SizeRatioThreshold", 0.7f,
"");
103 defineOptionalProperty<float>(
"CorrelationThreshold", 0.7f,
"");
105 defineOptionalProperty<bool>(
"SingleInstance",
true,
"");
127 void reportStereoCalibrationChanged(
const StereoCalibration& stereoCalibration,
bool x,
const std::string& referenceName,
const Ice::Current&
c = Ice::emptyCurrent)
override
139 return "SegmentableTemplateRecognition";
159 debugObserver = getTopic<armarx::DebugObserverInterfacePrx>(getProperty<std::string>(
"DebugObserverName").getValue());
196 void visualizeResults(
const Object3DList& objectList, CByteImage**
resultImages);
198 float calculateRecognitionCertainty(
const std::string& objectClassName,
const Object3DEntry& entry);
201 std::shared_ptr<CGLContext> contextGL;
202 std::shared_ptr<COpenGLVisualizer> m_pOpenGLVisualizer;
203 std::shared_ptr<CObjectFinderStereo> m_pObjectFinderStereo;
206 int paramMinPixelsPerRegion = 200;
207 float paramTemplateMatchThreshold = 0.7f;
208 float paramSizeRatioThreshold = 0.7f;
209 float paramCorrelationThreshold = 0.7f;
210 bool paramSingleInstance =
true;
213 std::string templatePath;
214 float minPixelsPerRegion;
215 float maxEpipolarDistance;
216 CColorParameterSet colorParameters;
218 std::map<std::string, SegmentableTemplateEntry> database;
220 Vec3d validResultBoundingBoxMin, validResultBoundingBoxMax;
223 std::map<std::string, int> seq;