Skip to main content
Version: 14 Oct 2024

MLMarkerTrackerSettings.cs

Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

using System;

namespace UnityEngine.XR.MagicLeap
{
public partial class MLMarkerTracker
{
[Serializable]
public struct TrackerSettings
{
public bool EnableMarkerScanning;

public MarkerType MarkerTypes;

public ArucoDictionaryName ArucoDicitonary;

public float ArucoMarkerSize;

public float QRCodeSize;

public Profile TrackerProfile;

public CustomProfile CustomTrackerProfile;

internal TrackerSettings(bool enableMarkerScanning, MarkerType markerTypes, float qRCodeSize, ArucoDictionaryName arucoDicitonary, float arucoMarkerSize, Profile profile, CustomProfile customProfile)
{
EnableMarkerScanning = enableMarkerScanning;
ArucoDicitonary = arucoDicitonary;
ArucoMarkerSize = arucoMarkerSize;
QRCodeSize = qRCodeSize;
MarkerTypes = markerTypes;
TrackerProfile = profile;
CustomTrackerProfile = customProfile;
}

public static TrackerSettings Create(bool enableMarkerScanning = false, MarkerType markerTypes = MarkerType.None, float qRCodeSize = 0.1f, ArucoDictionaryName arucoDicitonary = ArucoDictionaryName.DICT_5X5_100, float arucoMarkerSize = 0.1f, Profile profile = Profile.Default, CustomProfile customProfile = default) =>
new TrackerSettings(enableMarkerScanning, markerTypes, qRCodeSize, arucoDicitonary, arucoMarkerSize, profile, customProfile);

public override string ToString() => $" {this.EnableMarkerScanning}, {this.MarkerTypes}, {this.ArucoDicitonary}, {this.QRCodeSize}, {this.ArucoMarkerSize}, {this.TrackerProfile}, {this.CustomTrackerProfile}";

[Serializable]
public struct CustomProfile
{
public FPSHint FPSHint;

public ResolutionHint ResolutionHint;

public CameraHint CameraHint;

public FullAnalysisIntervalHint FullAnalysisIntervalHint;

public CornerRefineMethod CornerRefineMethod;

public bool UseEdgeRefinement;

internal CustomProfile(FPSHint fpsHint, ResolutionHint resolutionHint, CameraHint cameraHint, FullAnalysisIntervalHint fullAnalysisIntervalHint, CornerRefineMethod cornerRefineMethod, bool useEdgeRefinement)
{
FPSHint = fpsHint;
ResolutionHint = resolutionHint;
CameraHint = cameraHint;
FullAnalysisIntervalHint = fullAnalysisIntervalHint;
CornerRefineMethod = cornerRefineMethod;
UseEdgeRefinement = useEdgeRefinement;
}

public static CustomProfile Create(FPSHint fpsHint = FPSHint.Medium, ResolutionHint resolutionHint = ResolutionHint.Low, CameraHint cameraHint = CameraHint.RGB, FullAnalysisIntervalHint fullAnalysisIntervalHint = FullAnalysisIntervalHint.Medium, CornerRefineMethod cornerRefineMethod = CornerRefineMethod.None, bool useEdgeRefinement = false) =>
new CustomProfile(fpsHint, resolutionHint, cameraHint, fullAnalysisIntervalHint, cornerRefineMethod, useEdgeRefinement);

public override string ToString() => $"{this.FPSHint}, {this.ResolutionHint}, {this.CameraHint}, {this.FullAnalysisIntervalHint}, {this.CornerRefineMethod}, {this.UseEdgeRefinement}";
}
}

}
}