// Update is called once per frame void Update() { UDetectMarkersData _markerData = Aruco.UDetectMarkers(_webCamTexture.GetPixels32(), _webCamTexture.width, _webCamTexture.height); if (_markerData.markerIds.Length > 0) { int[] markersIds = _markerData.markerIds; List <List <Vector2> > markers = _markerData.markers; List <List <Vector2> > rejectedCandidates = _markerData.rejectedCandidates; DrawQuad(markersIds, markers, rejectedCandidates); } }
void TransformGameObjects(UBoardMarkerPoseEstimationDataEuler framePose, UDetectMarkersData frameMarkers) { double[][] eulerAngles = framePose.eulerAngles; Vec3d tvec = framePose.tvec; float scale = Utilities.CalculateScale(tvec, boardParameters.markerLength, originalScale); if (frameMarkers.markerIds.Length > 2) { _ARRootTransform.position = Utilities.CalculateBoardAveragePosition(_ARRootTransform.position, frameMarkers.markers); _ARRootTransform.rotation = Utilities.CalculateEulerAngleRotation(eulerAngles, _ARRootTransform.rotation); _ARRootTransform.localScale = new Vector3(scale, scale, scale); } }
// Update is called once per frame void Update() { // detect markers in the frame with specified board parameters UDetectMarkersData _markerData = Aruco.UDetectMarkers(_webCamTexture.GetPixels32(), _webCamTexture.width, _webCamTexture.height); if (_markerData.markerIds.Length > 0) { int[] markersIds = _markerData.markerIds; List <List <Vector2> > markers = _markerData.markers; List <List <Vector2> > rejectedCandidates = _markerData.rejectedCandidates; DrawMarkers(markersIds, markers, rejectedCandidates); } }