WVR_GetTrackableMarkerState¶
-
WVR_EXPORT WVR_Result WVR_GetTrackableMarkerState(WVR_Uuid uuid, WVR_PoseOriginModel originModel, WVR_TrackableMarkerState * state)
Function is used to retrieve WVR_TrackableMarkerState related to the trackable marker with input uuid WVR_Uuid.
Developers use this API to retrieve the trackable marker information.
- Version
- API Level 13
- Parameters
uuid
: the trackable marker with input uuid WVR_Uuid.originModel
: Only WVR_PoseOriginModel_OriginOnHead and WVR_PoseOriginModel_OriginOnGround are supported, refer to WVR_PoseOriginModel.state
: the returned data related to the trackable marker with input uuid WVR_Uuid.
- Return Value
WVR_Success
: Get the the state of the 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
uint32_t tracker_count = 0;
if (WVR_EnumerateTrackableMarkers(WVR_MarkerObserverTarget_Aruco, 0, &tracker_count, nullptr) == WVR_Success) {
LOGI("WVR_EnumerateTrackableMarkers - tracker_count(%d)", tracker_count);
for (int i = 0; i < tracker_count; i++) {
LOGI("WVR_EnumerateTrackableMarkers - i(%d) ++", i);
std::vector<WVR_Uuid> uuids(tracker_count);
if (WVR_EnumerateTrackableMarkers(WVR_MarkerObserverTarget_Aruco, tracker_count,
&tracker_count, uuids.data()) == WVR_Success) {
WVR_TrackableMarkerState state{};
if (WVR_GetTrackableMarkerState(uuids[i], WVR_PoseOriginModel_OriginOnGround, &state) == WVR_Success) {
// get trackable marker state
}
WVR_ArucoMarkerData arucoData{};
if (WVR_GetArucoMarkerData(uuids[i], &arucoData) == WVR_Success) {
// get trackable marker related to Aruco specific data
}
}
// release Aruco marker observer related resources success
if (WVR_StopMarkerObserver(WVR_MarkerObserverTarget_Aruco) == WVR_Success) {
}
}
WVR_StopMarker();
} else {
// start marker failed!
}