WVR_CreateTrackableMarker¶
-
WVR_EXPORT WVR_Result WVR_CreateTrackableMarker(const WVR_TrackableMarkerCreateInfo * createInfo)
Function is used to create a trackable marker.
Developers use this API to create a trackable marker with input WVR_TrackableMarkerCreateInfo structure.
- Version
- API Level 13
- Parameters
createInfo
: creation information, refer to WVR_TrackableMarkerCreateInfo
- Return Value
WVR_Success
: create a trackable marker successfully.others
: WVR_Result mean failure.
How to use¶
Sample function:
#include <wvr/wvr_marker.h>
if (WVR_StartMarker() == WVR_Success) {
//
// start marker observer
if (WVR_StartMarkerObserver(WVR_MarkerObserverTarget_Aruco) == WVR_Success) {
// Start Aruco marker observer related resources success
if (WVR_StartMarkerDetection(WVR_MarkerObserverTarget_Aruco) == WVR_Success)) {
// Start detecting the Aruco marker, and the Aruco marker detection will be WVR_MarkerObserverState_Detecting
uint32_t count = 0;
int result = WVR_GetArucoMarkers(0, &count, WVR_PoseOriginModel_OriginOnGround, nullptr);
if (result==0 & count!=0) {
std::vector<WVR_ArucoMarker> markers(count);
int ret = WVR_GetArucoMarkers(count, &count, WVR_PoseOriginModel_OriginOnGround, markers.data());
if (ret != WVR_Success) {
LOGE("%s(%d) WVR_GetArucoMarkers failed ret=(%d)", __FUNCTION__, __LINE__, ret);
return;
}
for (int i = 0 ; i < count ; i ++) {
// get the Aruco markers
// collect createInfo and create trackable marker
WVR_TrackableMarkerCreateInfo info = {markers[i].uuid, "test name"};
WVR_CreateTrackableMarker(&info);
}
}
// Stop detecting Aruco marker
if (WVR_StopMarkerDetection(WVR_MarkerObserverTarget_Aruco) == WVR_Success)) {
// The Aruco marker detection will be WVR_MarkerObserverState_Idle
}
}
// release Aruco marker observer related resources success
if (WVR_StopMarkerObserver(WVR_MarkerObserverTarget_Aruco) == WVR_Success) {
}
}
WVR_StopMarker();
} else {
// start marker failed!
}