Пример #1
0
int TrackerMultiMarker::calc(const unsigned char* nImage) {
	numDetected = 0;
	int tmpNumDetected;
	ARMarkerInfo *tmp_markers;

	if (useDetectLite) {
		if (arDetectMarkerLite(const_cast<unsigned char*> (nImage), this->thresh, &tmp_markers, &tmpNumDetected) < 0)
			return 0;
	} else {
		if (arDetectMarker(const_cast<unsigned char*> (nImage), this->thresh, &tmp_markers, &tmpNumDetected) < 0)
			return 0;
	}

	for (int i = 0; i < tmpNumDetected; i++)
		if (tmp_markers[i].id != -1) {
			detectedMarkers[numDetected] = tmp_markers[i];
			detectedMarkerIDs[numDetected++] = tmp_markers[i].id;
			if (numDetected >= MAX_IMAGE_PATTERNS) // increase this value if more markers should be possible to be detected in one image...
				break;
		}

	if (executeMultiMarkerPoseEstimator(tmp_markers, tmpNumDetected, config) < 0)
		return 0;

	convertTransformationMatrixToOpenGLStyle(config->trans, this->gl_para);
	return numDetected;
}
Пример #2
0
void TrackerSingleMarker::selectDetectedMarker(const int id) {
    for (int i = 0; i < marker_num; i++) {
        if (marker_info[i].id == id) {
            executeSingleMarkerPoseEstimator(&marker_info[i], patt_center, patt_width, patt_trans);
            convertTransformationMatrixToOpenGLStyle(patt_trans, this->gl_para);
            confidence = marker_info[i].cf;
        }
    }
}