我正在用 ARToolkit plus 做一个小项目。我发现检测到的标记 id 始终为 -1 很奇怪,因为标记的置信度也始终为 0.0。我已经加载了标准 ARTK plus zip 提供的 patt.hiro 文件。下面的代码显示了我在做什么:
“DrawGLScene”函数的片段:
//Render the webcam background
IplImage* img = showWebcam();
// do the OpenGL camera setup
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(tracker->getTracker()->getProjectionMatrix());
//Detect the markers in the video frame
ARToolKitPlus::ARMarkerInfo* markerinfo=0;
int nummarkers = detectMarkers(img, &markerinfo);
'detectMarkers' 功能:
int detectMarkers(IplImage* image, ARToolKitPlus::ARMarkerInfo** markerinfo){
cvFlip(image, image, 0);
int nummarkers;
tracker->getTracker()->calc((uchar*)(image->imageData), -1, false, markerinfo, &nummarkers);
return nummarkers;
该程序成功地检测到场景中的标记,但没有给它们任何 id 或置信度比,即使标记是内存中加载的标记。任何帮助都非常感谢!